# TikZ picture too tall

I am typesetting the following equation:

\documentclass[12pt]{article}
\usepackage{tikz}
\begin{document}

$$f\left( \begin{tikzpicture}[scale=0.5] \tikzstyle{every node}=[fill,shape=circle,minimum size=3pt,inner sep=0pt]; \path (0:0cm) node (center) {}; \path (0:1cm) node (v1) {}; \path (72:1cm) node (v2) {}; \path (2*72:1cm) node (v3) {}; \path (3*72:1cm) node (v4) {}; \path (4*72:1cm) node (v5) {}; \draw (center) -- (v1) (center) -- (v2) (center) -- (v3) (center) -- (v4) (center) -- (v5) (v1) -- (v2) (v2) -- (v3) (v3) -- (v4) (v4) -- (v5) (v5) -- (v1); \end{tikzpicture} \right)$$

\end{document}


However, the brackets become almost twice the size of what is needed. Is there any way of removing the white space below the graph?

• Instead of \path (0:0cm) node (center) {}; you can also write \node at (0:0cm) (center) {};. It's a little shorter. Also have a look on the edge operator which can be used to draw connections between nodes. – Martin Scharrer May 10 '11 at 22:13

By default tikzpictures are placed with the lower border onto the bounding box, like images. Therefore it has a large height but zero depth. You can set the baseline of the picture using the baseline option. On its own it set the baseline through the origin (0,0), but you can also provide any other TikZ coordinate. This coordinate is evaluated at the end of the picture. If you use the special node current bounding box the center of the image is used independently where the original lies. I personally would add an offset so that the center of the picture is around the half height of the f:

\documentclass[12pt]{article}
\usepackage{tikz}
\begin{document}

$$f\left( \begin{tikzpicture}[scale=0.5,baseline={([yshift=-.8ex]current bounding box)}] \tikzstyle{every node}=[fill,shape=circle,minimum size=3pt,inner sep=0pt]; \path (0:0cm) node (center) {}; \path (0:1cm) node (v1) {}; \path (72:1cm) node (v2) {}; \path (2*72:1cm) node (v3) {}; \path (3*72:1cm) node (v4) {}; \path (4*72:1cm) node (v5) {}; \draw (center) -- (v1) (center) -- (v2) (center) -- (v3) (center) -- (v4) (center) -- (v5) (v1) -- (v2) (v2) -- (v3) (v3) -- (v4) (v4) -- (v5) (v5) -- (v1); \end{tikzpicture} \right)$$

\end{document}


Before:                              After: