![TikZ 控件会引起有关 \hboxes 过满的错误警报](https://linux22.com/image/384946/TikZ%20%E6%8E%A7%E4%BB%B6%E4%BC%9A%E5%BC%95%E8%B5%B7%E6%9C%89%E5%85%B3%20%5Chboxes%20%E8%BF%87%E6%BB%A1%E7%9A%84%E9%94%99%E8%AF%AF%E8%AD%A6%E6%8A%A5.png)
下面的代码
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}
$$
生产
伴随着“Overfull \hbox (43.07889pt too wide)”的警告,尽管图片在边距内非常合适。我推测这是因为 TikZ 控件涉及边距外的贝塞尔曲线的不可见角度。但它是不可见的,所以警告实际上是多余的。
我意识到这是一个小问题(可能不存在),但是 - 可以做些什么来避免这样的消息吗?
答案1
3.0.1a 版的 pgfmanual 第 124 页中提到了两个与边界框大小有关的已知问题:
首先,对角线的线条粗细没有得到正确考虑。其次,曲线的控制点通常位于曲线的“外部”,导致边界框过大。在这种情况下,您应该使用该
[use as bounding box]
选项。
在这个特定问题中,第二个原因是错误的,因为控制点位于实际可见图形之外,但被视为边界框。
也可以使用命令\useasboundingbox
,它是 的缩写\path[use as bounding box]
。设置边界框的最简单方法是使用类似以下内容:
\path[use as bounding box] (0,0) rectangle (4,4);
当然,每张图片的正确坐标都不同。
在这种特定情况下(-5,-.8)
似乎(5,1.2)
提供了良好的结果:
\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}