# Inline TikZ - vertical centering

If I inline a bounded line segment like this:

the distance \tikz{ \draw [|-|] (0,0) -- (5ex,0); } overarching the activities


how can I make the line appear vertically centered on the line (automatically taking into account the line height).

-

You can directly tell where the baseline should meet the picture using the baseline option

\documentclass{article}
\usepackage{tikz}
\begin{document}
the distance \tikz[baseline=-0.5ex]{ \draw [|-|] (0,0) -- (5ex,0); } overarching the activities
\end{document}


-
To get a better vertical alignment see this answer. – Claudio Fiandrino Jun 13 '12 at 16:42