2

enter image description here

Hi! I tried to make this graph with this code:

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[spanish]{babel}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{schemata}
\usepackage{graphicx}
\usepackage{pgfplots}
\usepackage{tikz}
\usepackage{etoolbox}
\AtBeginEnvironment{tikzpicture}{\shorthandoff{>}\shorthandoff{<}}{}{}

\begin{tikzpicture}
\draw[thick,->] (0,0) -- (4.5,0) node[anchor=north west] {x axis};
\draw[thick,->] (0,0) -- (0,4.5) node[anchor=south east] {y axis};

\draw[-latex,black] (axis cs:3,0) -- (axis cs:3,1);
\draw[-latex,black] (axis cs:-3,0) -- (axis cs:-3,1);
\end{tikzpicture}

\end{tikzpicture}


\end{document}

But I get the following error.

! Missing \endcsname inserted.\pgfcrdmth@x \draw[-latex,black] (axis cs:3,0)

Help!!!!!

0

1 Answer 1

3

You're not using an axis environment (from pgfplots), so the axis cs doesn't make any sense. Beyond that, just pick useful coordinates for your lines, and add nodes similar to what you did for your axes.

You also have an extra \end{tikzpicture} (and \begin{document} is missing).

(1/3 and 2/3 are wrong in the image, but correct in the code.)

output of code

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[spanish]{babel}
\usepackage{tikz}
\usetikzlibrary{babel} % instead of the manual fix

\begin{document}
\begin{tikzpicture}
\draw[thick,->] (0,0) -- (4.5,0) node[anchor=north west] {x axis};
\draw[thick,->] (0,0) -- (0,4.5) node[anchor=south east] {y axis};

\draw[-latex,black] (3,0) node[below]{$\gamma_{11}$} -- (3,1) node[right] {1/3};
\draw[-latex,black] (1,0) node[below]{$\gamma_{12}$} -- (1,2) node[right] {2/3};

\draw [<->] (1,0.5) -- node[above] {7} (3,0.5);
\end{tikzpicture}
\end{document}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .