# Why do coordinates in Bezier curves add to the padding in TikZ?

I have a little tikzpicture drawn with a Bezier curve, that I use in the text. I noticed that it has an unusual amount of horizontal white space, more than e.g. a circle:

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{calc}
\begin{document}
Lorem
\begin{tikzpicture}
\coordinate (a) at (-1,2);
\draw (0,0) .. controls (a) and ($2*(a -| 0,0)-(a)$) .. (0,0);
\end{tikzpicture}
ipsum

Lorem
\begin{tikzpicture}
\coordinate (a) at (-1,2);
\end{tikzpicture}
ipsum
\end{document}


I think that the white space comes from the coordinates that are used in the controls-syntax of the Bezier curves:

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{calc}
\begin{document}
Lorem
\begin{tikzpicture}
\coordinate (a) at (-1,2);
\draw (0,0) .. controls (a) and ($2*(a -| 0,0)-(a)$) .. (0,0);
\node[red] at (a)                  {$\cdot$};
\node[red] at ($2*(a -| 0,0)-(a)$) {$\cdot$};
\end{tikzpicture}
ipsum
\end{document}


But just adding the coordinate to e.g. the circle picture doesn't give that extra white space! What's going on here? How can I avoid that?

• Related but not dupe : tex.stackexchange.com/questions/43621/… Apr 13 '15 at 18:15
• The circle picture doesn't get the extra white space as the the picture's bounding box is only updated when a coordinate is used in a path. It you use \path (a); after the coordinate is defined, the bounding box will be updated. Apr 14 '15 at 7:15

Based on What type of curve is used by Tikz when I "bend" an edge?, your example code can be changed to:

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{calc,decorations.pathreplacing,shapes.misc}
\tikzset{
show control points/.style={
decoration={show path construction, curveto code={
\draw [blue, dashed]
(\tikzinputsegmentfirst) -- (\tikzinputsegmentsupporta)
node [at end, cross out, draw, solid, red, inner sep=2pt]{};
\draw [blue, dashed]
(\tikzinputsegmentsupportb) -- (\tikzinputsegmentlast)
node [at start, cross out, draw, solid, red, inner sep=2pt]{};
}
},
postaction=decorate
},
}
\begin{document}
Lorem
\begin{tikzpicture}
\coordinate (a) at (-1,2);
\draw[show control points] (0,0) .. controls (a) and ($2*(a -| 0,0)-(a)$) .. (0,0);
\end{tikzpicture}
ipsum

Lorem
\begin{tikzpicture}
\coordinate (a) at (-1,2);
\draw[show control points] (0,0) circle [radius=0.4cm];
\end{tikzpicture}
ipsum
\end{document}


This shows the Bezier control points which look like this:

Note that the bounding box for a TikZ figure includes all of the control points. You can use \useasboundingbox to fix this:

    Lorem
\begin{tikzpicture}
\coordinate (a) at (-1,2);
\useasboundingbox (-.2,0) rectangle (.2,1.5);
\draw[show control points] (0,0) .. controls (a) and ($2*(a -| 0,0)-(a)$) .. (0,0);
\end{tikzpicture}
ipsum


which yields:

• That's a very beautiful demonstration. Apr 14 '15 at 13:55