Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I am typesetting the following equation:

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

\begin{equation}
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{equation}


\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?

share|improve this question
1  
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
    
Martin: thanks for the tip! –  Ben May 11 '11 at 16:25

1 Answer 1

up vote 8 down vote accepted

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}

\begin{equation}
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{equation}


\end{document} 

Before:                              After:

Before After

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.