8

Consider the MWE below, on a fully updated TeX Live 2015, this gives me this error:

/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 }

MWE:

\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}

As listed remove one of the three, and the example compiles.

I'm guessing this is somehow related to \SingleSpacing, a memoir macro defined as

\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
}

if I remove the \vskip it works again.

Any idea what on earth is going on here?

Can others reproduce the problem?

  • tikz later calls xcolor. – Johannes_B Mar 14 '16 at 9:50
  • @Johannes_B, I know, but that does not explain the error. Also in my real document I need to pass options to xcolor, options that does not seem to be relevant here. – daleif Mar 14 '16 at 9:52
  • No, it doesn't explain the error. I can reproduce it, by the way. You can add the options globally when loading documentclass. They will be passed to xcolor. – Johannes_B Mar 14 '16 at 9:55
  • Yep, I can reproduce the problem. So, not something wrong with your installation. – Peter Grill Mar 14 '16 at 10:11
  • The problem is the \vskip\baselineskip. If you add it directly before loading the library you get the error. Not loading xcolor probably "hides" it as xcolor will be loaded by tikz. – Ulrike Fischer Mar 14 '16 at 10:14
4

As diagnosed by @UlrikeFischer, the problem originates in an \unskip issued by \pgfmathsetlength under certain circumstances.

I don't know the innards of TikZ, but here is a re-definition of the first branch of \pgfmathsetlength which uses a temporary box, as it apparently needs to issue a \selectfont and then an \unskip (presumably to get rid of some extraneous space following some dimension definition).

\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}

Blockquote

  • That is one strange bug. Thanks for the run through – daleif Mar 15 '16 at 11:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.