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.

I would like to get 100 "above" the radius, if I consider that the radius comes from the center towards the circle. A little example :

\documentclass[landscape]{scrartcl}
\usepackage{tikz}
\begin{document}     
\begin{tikzpicture}
    \foreach \a in {0,20,...,340}{%
    \draw (0,0)--(\a:4cm) node [pos=.75,above,sloped] {$\a$};
    }
\end{tikzpicture}      
\end{document}

enter image description here

Another example :

    \documentclass[landscape]{scrartcl}
    \usepackage{tikz}
    \begin{document} 
    \begin{tikzpicture}[color=blue] 
      \node (A) at (2,-4){A};
      \node (O) at (0,0){O};
      \node (B) at (-2,-4){B};   
    \draw[color=red] (O)  to node[sloped,above]{label} 
                             node[sloped,above,blue,rotate=180]{label} (A) ; 
    \draw[color=red] (O)  to node[sloped,above]{label}(B) ;
   %\draw[color=red] (B)  to node[sloped,above]{label}(O) ;   
    \end{tikzpicture}    
    \end{document}

enter image description here

In this example, I always thought that if I reverse the nodes then I reverse the top and bottom but I was wrong.

A solution is to use a rotation but...it's not automatic. The only idea I had, is to use the rotation after testing the angle formed by the two points and the horizontal axe.

share|improve this question
2  
The key allow upside down? –  cjorssen Jan 25 '12 at 16:11
    
+1 Fine ! I forgot this key :( I think it's the solution perhaps Christophe you can put your comment in an answer –  Alain Matthes Jan 25 '12 at 16:38
    
You can use auto=right (or left) to get consistent placement on one side of the line. This will cause issues with the placement though, since the right anchor of the node is then used. –  Roelof Spijker Jan 25 '12 at 16:39
    
I need to test the two propositions with concrete examples –  Alain Matthes Jan 25 '12 at 17:04

1 Answer 1

up vote 13 down vote accepted

The key allow upside down might fit your needs.

enter image description here

\documentclass{standalone}
\usepackage{tikz}
\begin{document}     
\begin{tikzpicture}
  \foreach \a in {0,20,...,340}{%
    \draw (0,0) -- (\a:4cm) 
      node [pos=.75,above,sloped,allow upside down] {$\a$};}
\end{tikzpicture}      
\end{document}
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.