have a strange problem running the following code: this works
Code: Select all
\documentclass{standalone}
\usepackage{amsmath}
\usepackage{amssymb} %carica anche amsfonfts
\usepackage{pgfplots}
\pgfplotsset{width=20cm,height=7cm,compat=1.9}
\usetikzlibrary{arrows.meta,angles,quotes,decorations}
\begin{document}
\begin{tikzpicture}
\begin{axis}[
height=5cm,
axis equal,
width=6cm,
axis x line=center,
axis y line=center,
xmin=-6, xmax=5,
ymin=-6, ymax=4,
xtick={0,4},
ytick={0,3},
extra x ticks={-6},
extra x tick style={xticklabel style={above, yshift=1mm}},
extra y ticks={-4.5},
extra y tick labels={$-4.5$},
extra y tick style={yticklabel style={right, xshift=1mm}},
xlabel={$x$},
ylabel={$y$},
ylabel style={yshift=2mm},
]
\coordinate (O) at (axis cs:0,0);
\coordinate (A) at (axis cs:4,0);
\coordinate (B) at (axis cs:4,3);
\coordinate (C) at (axis cs:0,3);
\coordinate (mA) at (axis cs:-6,0);
\coordinate (mB) at (axis cs:-6,-4.5);
\coordinate (mC) at (axis cs:0,-4.5);
\draw[-{Stealth}, color=black, line width=0.5pt] {(O) -- (B)};
\draw[ color=black,dashed, line width=0.5pt] {(A) -- (B)};
\draw[ color=black,dashed, line width=0.5pt] {(C) -- (B)};
\node[right, xshift=1mm,align=left, inner sep=0] at (B){$\vec{v}$};
\draw[-{Stealth}, color=red, line width=0.5pt] {(O) -- (mB)};
\draw[ color=black,dashed, line width=0.5pt] {(mA) -- (mB)};
\draw[ color=black,dashed, line width=0.5pt] {(mC) -- (mB)};
\node[below, xshift=0mm, yshift=-2mm,align=left, inner sep=0] at (mB){$-1,\!5\cdot \vec{v}$};%
\end{axis}
\end{tikzpicture}
\end{document}
while this doesn't, the only modification (marked in the code) is a comma in the code for the tick label
Code: Select all
\documentclass{standalone}
\usepackage{amsmath}
\usepackage{amssymb} %carica anche amsfonfts
\usepackage{pgfplots}
\pgfplotsset{width=20cm,height=7cm,compat=1.9}
\usetikzlibrary{arrows.meta,angles,quotes,decorations}
\begin{document}
\begin{tikzpicture}
\begin{axis}[
height=5cm,
axis equal,
width=6cm,
axis x line=center,
axis y line=center,
xmin=-6, xmax=5,
ymin=-6, ymax=4,
xtick={0,4},
ytick={0,3},
extra x ticks={-6},
extra x tick style={xticklabel style={above, yshift=1mm}},
extra y ticks={-4.5},
extra y tick labels={$-4,5$},% <<<<<------ ONLY CHANGE the comma: 4,5 instead of 4.5
extra y tick style={yticklabel style={right, xshift=1mm}},
xlabel={$x$},
ylabel={$y$},
ylabel style={yshift=2mm},
]
\coordinate (O) at (axis cs:0,0);
\coordinate (A) at (axis cs:4,0);
\coordinate (B) at (axis cs:4,3);
\coordinate (C) at (axis cs:0,3);
\coordinate (mA) at (axis cs:-6,0);
\coordinate (mB) at (axis cs:-6,-4.5);
\coordinate (mC) at (axis cs:0,-4.5);
\draw[-{Stealth}, color=black, line width=0.5pt] {(O) -- (B)};
\draw[ color=black,dashed, line width=0.5pt] {(A) -- (B)};
\draw[ color=black,dashed, line width=0.5pt] {(C) -- (B)};
\node[right, xshift=1mm,align=left, inner sep=0] at (B){$\vec{v}$};
\draw[-{Stealth}, color=red, line width=0.5pt] {(O) -- (mB)};
\draw[ color=black,dashed, line width=0.5pt] {(mA) -- (mB)};
\draw[ color=black,dashed, line width=0.5pt] {(mC) -- (mB)};
\node[below, xshift=0mm, yshift=-2mm,align=left, inner sep=0] at (mB){$-1,\!5\cdot \vec{v}$};%
\end{axis}
\end{tikzpicture}
\end{document}