TransWikia.com

problem with a tikz image,maybe the preamble?

TeX - LaTeX Asked on March 22, 2021

I wrote this code to draw a graph with some arrows and stuff in it:

documentclass[a4paper,12pt]{book}
usepackage[T1]{fontenc}
usepackage[utf8]{inputenc}
usepackage[english,italian]{babel}

usepackage{amsmath}
usepackage{caption}
usepackage{subcaption}
usepackage[backend=biber]{biblatex}


usepackage{tikz}
usetikzlibrary{calc,quotes,angles}
usepgflibrary{arrows.meta}
usepackage{pgfplots}
usetikzlibrary{calc}

begin{document}

begin{figure}[!ht]
    centering
    begin{tikzpicture}
    begin{axis}[name=plot, 
    xmin=-1, 
    xmax=101, 
    ymin=1.5,
    ymax=3,
    yticklabels={,,}, 
    xticklabels={,,},  
    ytick=empty, 
    xtick=empty, 
    axis line style={draw=none},
    tick style={draw=none}
    ]
    
    addplot[black,mark=.] table{dati_polinomio_Greitzer_esempio.txt};
    coordinate (A) at (14.5,62);
    coordinate (B) at (14.5,147);
    coordinate (C) at (55,133);
    coordinate (D) at (55,62);
    coordinate (E) at (60,62);
    coordinate (F) at (14.5,133);
    coordinate (G) at (25,62);
    coordinate (H) at (25,2);
    coordinate (I) at (14.5,2);
    coordinate (L) at (100,2);
    
    draw[->] (I) -- (B);
    draw[->] (C) -- (D);
    draw[->] (D) -- (C);
    draw[dashed] (A) -- (E);
    draw[->] (F) -- (C);
    draw[->] (C) -- (F);
    draw[->] (G) -- (H);
    draw[->] (H) -- (G);
    draw[->] (I) -- (L);
    
    node[text width=3cm] at (80,100) {2H};
    node[text width=3cm] at (50,139) {2W};
    node[text width=3cm] at (50,25) {$psi_{c0}$};
    node[text width=3cm] at (105,80) {$Psi_c$};
    
    end{axis}
    
    end{tikzpicture}
    caption{textit{Definizione dei parametri del polinomio cubico}}
  label{fig:polinomio cubico}
end{figure}

end{document}

And I get the result I want, like in the picture below:
enter image description here

The problem is when I just copy and paste the code of the image in my thesis, it appears like this:
enter image description here

the preamble of my thesis is this:

documentclass[a4paper,12pt]{book}
usepackage[T1]{fontenc}
usepackage[utf8]{inputenc}
usepackage[english,italian]{babel}
usepackage{url,amsfonts,epsfig}
usepackage{amsmath}
usepackage{caption}
usepackage{subcaption}
usepackage[backend=biber]{biblatex}
addbibresource{capitoli/bibliografia/bibliografia.bib}
usepackage{matlab-prettifier} %pacchetto per scrivere come Matlab

usepackage{fancyhdr}
pagestyle{fancy}
renewcommand{footrulewidth}{0.5pt}
fancyhead[]{} %pulisce il fancyhead
fancyhead[LO]{nouppercase{rightmark}} %sulle dispari la section
fancyhead[RE]{nouppercase{leftmark}} %sulle pari il capitolo
fancyfoot{}
fancyfoot[LO,RE]{thepage} %numeri di pagina, a sinistra sulle dipari, a destra sulle pari

%usepackage{pdfpages}

%queste due righe servono per non far apparire i numeri dei capitoli e delle sezioni nei fancyhead
%renewcommand{chaptermark}[1]{markboth{#1}{}} 
renewcommand{sectionmark}[1]{markright{#1}}
parindent 0ex %serve per l'indentadure dei paragrafi

%paccheetto per i grafici
usepackage{tikz}
usepgflibrary{arrows.meta}
usetikzlibrary{calc,quotes,angles} 
usepackage{pgfplots}
pgfplotsset{compat=1.16} %l'ho messo a caso per il grouplot
usepgfplotslibrary{groupplots} %l'ho messo a caso per il grouplot
usetikzlibrary{calc} %ridondante ma per ora lo tengo



usepackage{hyperref} %pacchetto Harvard che permette il collegamento da indice
begin{document}
end{document}

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP