考虑下面的 MWE,在完全更新的 TeX Live 2015 上,这给了我这个错误:
/opt/texlive/2015/texmf-dist/tex/generic/pgf/libraries/pgflibraryarrows.meta.co
de.tex:208: You can't use `\unskip' in vertical mode.
<recently read> \unskip
l.208 }
梅威瑟:
\documentclass[a4paper]{memoir}
% if xcolor is removed, file compiles
\usepackage{xcolor}
% if \SingleSpacing is removed, file compiles
\SingleSpacing
\usepackage{tikz}
% arrows.meta removed, file compiles
\usetikzlibrary{arrows.meta}
\begin{document}
test
\end{document}
按照所列删除其中之一,示例即可编译。
我猜这与定义为的宏\SingleSpacing
有某种关系memoir
\newcommand*{\SingleSpacing}{%
\setSpacing{\m@m@singlespace}%
\edef\m@m@footnote@spacing{\baselinestretch}%
\edef\m@m@float@spacing{\baselinestretch}%
\vskip\baselineskip% correction for coming into single spacing
}
如果我删除它,\vskip
它就会再次工作。
知道这到底发生什么事吗?
其他人能重现该问题吗?
答案1
根据@UlrikeFischer 的诊断,该问题源于特定情况下\unskip
发出的问题。\pgfmathsetlength
我不知道 的内部结构TikZ
,但这里是对 的第一个分支的重新定义,\pgfmathsetlength
它使用一个临时框,因为它显然需要发出一个\selectfont
然后是一个\unskip
(大概是为了摆脱一些维度定义之后的一些多余的空间)。
\documentclass[a4paper]{memoir}
\usepackage{xcolor}
\SingleSpacing
%\tracingmacros1
%\def\unskip{\BOOM}
\usepackage{tikz}
\typeout{Original meaning of pgfmathsetlength\meaning\pgfmathsetlength}
\newbox\tempbox
\newif\ifdebug
\debugtrue
\makeatletter
\def\pgfmathsetlength #1#2{\expandafter \pgfmath@onquick #2\pgfmath@
{\ifdebug\typeout{HERE\detokenize{#1}\detokenize{#2}}\fi
\setbox\tempbox\hbox{\pgfmath@selectfont#1#2\relax\expandafter}\expandafter#1\the #1\relax
\ifdebug\typeout{#1=\the#1}\fi}%
{\pgfmathparse {#2}\ifpgfmathmathunitsdeclared #1\pgfmathresult mu\relax
\else #1\pgfmathresult pt\relax \fi }\ignorespaces }
\makeatother
\usetikzlibrary{positioning}
\usetikzlibrary{arrows.meta}
\usetikzlibrary{bending}
\begin{document}
% from the manual
\begin{tikzpicture}
\node [circle,draw] (A) {A};
\node [circle,draw] (B) [right=of A] {B};
\draw [draw = blue, thick,
arrows={
Computer Modern Rightarrow [sep]
- Latex[blue!50,length=8pt,bend,line width=0pt]
Stealth[length=8pt,open,bend,sep]}]
(A) edge [bend left=45] (B)
(B) edge [in=-110, out=-70,looseness=8] (B);
\end{tikzpicture}
\end{document}