Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Here is my problematic code:

\begin{tikzpicture}
\draw  (0,0)  to [bend left=20] (3,3) node[midway] {midway label};
\end{tikzpicture}

I wanted to put a label midway of the line, but instead the label is at (0,0).

If I remove [bend left=20], the line is not bent, and the label still misplaced. If I remove to and replace it by --, then it works fine, but my line is not bent any more.

\begin{tikzpicture}
\draw (0,0) -- (3,3) node[midway] {midway label};
\end{tikzpicture}

Works fine.

The problem occurs with MacTeX 2011 and MacTeX 2012.

share|improve this question
    
Hi Loick, welcome to TeX.sx! It's generally preferred to post full compilable examples instead of just snippets. And a tip: Inline code (like the [bend left=20] in your post) can be formatted by enclosing them in backticks. –  Jake Jul 22 '12 at 9:29

2 Answers 2

up vote 12 down vote accepted

You should move node[midway] {midway label} before the last coordinate.

Some examples:

\documentclass[11pt,a4paper]{article}
\usepackage{tikz}

\begin{document}
\begin{tikzpicture}
\draw  (0,0)  to [bend left=20] node[midway] {midway label}(3,3) ;
\draw[xshift=4cm]  (0,0)  to [bend left=20] node[midway,left] {midway label}(3,3) ;
\draw[xshift=6cm]  (0,0)  to [bend left=20] node[midway,right] {midway label}(3,3) ;
\end{tikzpicture}

\begin{tikzpicture}
\draw  (0,0)  to [bend left=20] node[sloped,midway,above] {midway label}(3,3) ;
\end{tikzpicture}
\end{document}

enter image description here

share|improve this answer

You can also use the pos=<value from 0 to 1> key (see manual section 16.8) to specify where on your curve the node should be. A little example illustrating this for 0.1 increments from 0 to 1:

\documentclass[parskip]{scrartcl}
\usepackage[margin=15mm,landscape]{geometry}
\usepackage{tikz}

\begin{document}

\foreach \x in {0,0.1,...,1}
{   \begin{tikzpicture}[scale=0.2]
    \draw  (0,0)  to [bend left=20] node[pos=\x,fill=red,circle,inner sep=2pt] {} (3,3) ;
    \end{tikzpicture}
}

\end{document}

enter image description here

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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