Inline TikZ - vertical centering
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}
Neither percusse's nor Claudio's answer worked for me when I wanted to insert a small inline graph. Instead Martin's suggestion of \raisebox
did work.
Example
Code
\documentclass{article}
\usepackage{pgfplots} %for drawing of graphs
\pgfplotsset{compat=newest}
\setlength{\parindent}{0pt}
\begin{document}
The original one
\frame{
\begin{tikzpicture}
\begin{axis}[width=10 ex, height = 3 ex,
scale only axis, hide axis]
\addplot[black] {rand};
\end{axis};
\end{tikzpicture}}
is too high.
And percusse's \verb|[baseline=-0.5 ex]|
\frame{
\begin{tikzpicture}[baseline=-0.5ex]
\begin{axis}[width=10 ex, height = 3 ex,
scale only axis, hide axis]
\addplot[black] {rand};
\end{axis};
\end{tikzpicture}}
does not work, it only shifts
\frame{
\begin{tikzpicture}
\begin{axis}[width=10 ex, height = 3 ex,
scale only axis, hide axis]
\addplot[black] {rand};
\end{axis};
\end{tikzpicture}}
the graph upwards a little.
\verb|\raisebox{-.5 ex}|
\raisebox{-.5 ex}{\frame{
\begin{tikzpicture}
\begin{axis}[
width=10 ex, height = 3 ex, scale only axis,
hide axis,
]
\addplot[black] {rand};
\end{axis};
\end{tikzpicture}}}
does work in this case, but I don't know why.
\end{document}