3

So I have the following tikz code:

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{intersections}
\begin{document}
\begin{tikzpicture}
    \coordinate (O) at (0,0);
    \path (O) -- ++(4,0) coordinate (B);
    \path[name path=l1] (O) -- ++(40:10);
    \path[name path=l2] (B) -- ++(120:10);
\draw [name intersections={of=l1 and l2, by=A}]
(O) -- (A) node[midway, above left] {$a$} -- (B) -- cycle node[midway, below] {$b$};

\draw (O) ++(0.5,0) arc [start angle=0, end angle=40, radius=0.5] node[above right, midway] {$\theta$};
\node[left] at (O) {$O$};
\node[above] at (A) {$A$};
\node[right] at (B) {$B$};

\end{tikzpicture} \end{document}

Here, the theta label is being covered by the line OA. This is a problem because it doesn't look very good. I want to put it lower down so that it is no longer being covered. However the only other "direction" I can put on the node is right, which will cause the theta label to be covered by the line OB. How can I set the direction or anchor such that it is now exactly between the two lines?

Kookie
  • 366
  • 2
  • 11

1 Answers1

2

I did two things: I changed above right to right and I added a \strut to the \theta node.

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{intersections}
\begin{document}
\begin{tikzpicture}
    \coordinate (O) at (0,0);
    \path (O) -- ++(4,0) coordinate (B);
    \path[name path=l1] (O) -- ++(40:10);
    \path[name path=l2] (B) -- ++(120:10);
\draw [name intersections={of=l1 and l2, by=A}]
(O) -- (A) node[midway, above left] {$a$} -- (B) -- cycle node[midway, below] {$b$};

\draw (O) ++(0.5,0) arc [start angle=0, end angle=40, radius=0.5] 
  node[right,midway] {$\theta$\strut};
\node[left] at (O) {$O$};
\node[above] at (A) {$A$};
\node[right] at (B) {$B$};

\end{tikzpicture} \end{document}

enter image description here

If you want even more control, just add a bottom reaching \rule to the \theta to "push it up", as in

\draw (O) ++(0.5,0) arc [start angle=0, end angle=40, radius=0.5] 
   node[right,midway] {$\theta$\rule[-6pt]{0pt}{0pt}};

enter image description here