我最近决定在一个包含大量 TikZ 图形的长文档中尝试使用 autobreak 包,但无法进行编译(使用 lualatex 或 pdflatex)。我将其范围缩小到以下几点:
\documentclass{article}
\usepackage{amsmath}
\usepackage{tikz}
% Without the autobreak package this compiles just fine.
\usepackage{autobreak}
\begin{document}
% Works if I replace align* by equation* environment.
\begin{align*}
\begin{tikzpicture}
% Putting the next two lines on one makes the error go away.
\node{}
child {};
\end{tikzpicture}
\end{align*}
\end{document}
知道这是怎么回事吗?这是自动中断中的错误还是我遗漏了什么?
编辑:我忘了包含错误信息...
! Package pgf Error: No shape named is known.
See the pgf package documentation for explanation.
Type H <return> for immediate help.
...
l.17 \end{align*}
? x
No pages of output.
Transcript written on autobreak-test.log.
答案1
autobreak
安装一段代码进入align
以实现其目的,这会改变环境中换行符的 catcode align
。然后换行符被标记为扩展为空格的控制序列。这在数学模式下通常是无害的,因为无论如何空格都会被忽略。不幸的是,在您发现的极端情况下,这似乎对 TikZ 图形造成了致命的问题:用 代替\space
换行符会导致相同的错误No shape named is known
:
\documentclass{article}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
\node{} \space child {};
\end{tikzpicture}
\end{document}
! Package pgf Error: No shape named is known.
See the pgf package documentation for explanation.
Type H <return> for immediate help.
...
l.8 \node{} \space child {};