4

I have found a strange behavior in TikZ. When using the \draw ... to ... syntax and trying to place nodes along the line with the node[...]{...} syntax, the nodes do not turn up at the expected location.

\documentclass{standalone}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
  \draw(0,0) to[out=60,in=120] (1,0) node[midway]{x};
\end{tikzpicture}
\end{document}

strange position

How is this done properly?

6

enter image description here

\documentclass[tikz, border=3mm]{standalone}

\begin{document}
\begin{tikzpicture}[auto]
  \draw(0,0) to[out=60,in=120] node {x}  (1,0);
\end{tikzpicture}
\end{document}

Instead nodes you can use here quotes:

\documentclass[tikz, border=3mm]{standalone}
\usetikzlibrary{quotes}

\begin{document}
\begin{tikzpicture}
  \draw(0,0) to [out=60,in=120, "x"] (1,0);
\end{tikzpicture}
\end{document}

Result is the same as before.

  • Is there any way to avoid stating above and have the node directly on the arrow? – carsten Jul 19 '17 at 15:56
  • Yes, for tikzpiczure use option auto. See edit of my answer. – Zarko Jul 19 '17 at 15:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.