Code: Select all
\documentclass{article}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
\draw (0,0) -- (5,0);
\node [below] at (1,0) {$a$};
\node [below] at (2,0) {$b$};
\node [below] at (3,0) {$g$};
\end{tikzpicture}
\bigskip
\bigskip
\begin{tikzpicture}
\draw (0,0) -- (5,0);
\node [below] at (1,0) {\vphantom{$abg$}$a$};
\node [below] at (2,0) {\vphantom{$abg$}$b$};
\node [below] at (3,0) {\vphantom{$abg$}$g$};
\end{tikzpicture}
\end{document}
The alignment in the first tikzpicture is decidedly suboptimal. But to fix it, the best code I've come up with that of the second tikzpicture above. Is there an easier way?
Thanks.