# TikZ controls cause false alarms about overfull \hboxes

The following code

Then $e+F$ acts in the standard representation (on $\mathbb C^{mn+k}$) in such a way
that we can decompose this action into the following pieces:

for even $m$,
$$\begin{tikzpicture}[>=stealth,->,scale=1.25,every node/.style={anchor=south}] \node (1) at (-4,0) {\mathbb C^n}; \node (2) at (-3,0) {\mathbb C^n}; \node (l) at (-2,0) {\cdots\vphantom{\mathbb C^n}}; \node (m/2) at (-1,0) {\mathbb C^n}; \node at (0,0) {\mathbb C^k}; \node (-m/2) at (1,0) {\mathbb C^n}; \node (-l) at (2,0) {\cdots\vphantom{\mathbb C^n}}; \node (-2) at (3,0) {\mathbb C^n}; \node (-1) at (4,0) {\mathbb C^n}; \draw (1) -- node[above] {e_1} (2); \draw (2) -- node[above] {e_2} (l); \draw (l) -- node[above] {e_{\frac m2-1}} (m/2); \draw (m/2) .. controls (-.2,.8) and (.2,.8) .. node[above] {e_{\frac m2}} (-m/2); \draw (-m/2) -- node[above] {e_{\frac m2+1}} (-l); \draw (-l) -- node[above] {e_{m-2}} (-2); \draw (-2) -- node[above] {e_{m-1}} (-1); \draw (-1) .. controls (7,-.5) and (-7,-.5) .. node[below] {F} (1); \end{tikzpicture}$$


produces accompanied with the warning about "Overfull \hbox (43.07889pt too wide)", although the picture fits pretty well within margins. I presume this happens because TikZ controls involve invisible angle for the Bezier curve that is outside margins. But it is invisible, so the warning is actually redundant.

I realize this is a minor (maybe nonexistent) issue, but still - could something be done to avoid such messages?

• Take a look at the use as bounding box option on page 124 of the pfgmanual. – Skillmon Oct 28 '18 at 12:30
• @S Wow this was quick! – მამუკა ჯიბლაძე Oct 28 '18 at 12:33
• Coincidence, but thanks :) – Skillmon Oct 28 '18 at 12:35
• @Skillmon I have manual for 3.0.1a, there it is on page 175 (section 15.8), with examples; there is also a version \useasboundingbox. All in all, - don't you want to make this an answer? I believe it can be useful for others too, no? – მამუკა ჯიბლაძე Oct 28 '18 at 12:35
• Note that you shouldn't use  for displayed maths, instead one should use $ and $ in LaTeX. – Skillmon Oct 28 '18 at 12:42

## 1 Answer

There are two known issues mentioned in the pgfmanual of version 3.0.1a on page 124 related to the size of the bounding box:

First, the line thickness of diagonal lines is not taken into account correctly. Second, control points of a curve often lie far “outside” the curve and make the bounding box too large. In this case, you should use the [use as bounding box] option.

In this specific question the second reason is at fault, because the control points lie outside the actually visible figure, but are considered for the bounding box.

The command \useasboundingbox can also be used, which is an abbreviation for \path[use as bounding box]. The easiest way to set a bounding box is the use of something like:

\path[use as bounding box] (0,0) rectangle (4,4);


Of course the correct coordinates differ from picture to picture.

In this specific case (-5,-.8) and (5,1.2) seem to provide good results:

\documentclass[border=2mm,tikz]{standalone}

\usepackage{amssymb}

\begin{document}
\begin{tikzpicture}[>=stealth,->,scale=1.25,every node/.style={anchor=south}]
\path[use as bounding box] (-5,-.8) rectangle (5,1.2);
\node (1) at (-4,0) {$\mathbb C^n$};
\node (2) at (-3,0) {$\mathbb C^n$};
\node (l) at (-2,0) {$\cdots\vphantom{\mathbb C^n}$};
\node (m/2) at (-1,0) {$\mathbb C^n$};
\node at (0,0) {$\mathbb C^k$};
\node (-m/2) at (1,0) {$\mathbb C^n$};
\node (-l) at (2,0) {$\cdots\vphantom{\mathbb C^n}$};
\node (-2) at (3,0) {$\mathbb C^n$};
\node (-1) at (4,0) {$\mathbb C^n$};
\draw (1) -- node[above] {$e_1$} (2);
\draw (2) -- node[above] {$e_2$} (l);
\draw (l) -- node[above] {$e_{\frac m2-1}$} (m/2);
\draw (m/2) .. controls (-.2,.8) and (.2,.8) .. node[above] {$e_{\frac m2}$} (-m/2);
\draw (-m/2) -- node[above] {$e_{\frac m2+1}$} (-l);
\draw (-l) -- node[above] {$e_{m-2}$} (-2);
\draw (-2) -- node[above] {$e_{m-1}$} (-1);
\draw (-1) .. controls (7,-.5) and (-7,-.5) .. node[below] {$F$} (1);
\end{tikzpicture}
\end{document} 