4

I have a problem with tikz pictures. The problem occurred after installing the new “vanilla” release of TeX Live 2017 on Ubuntu 17.04. Everything worked fine on the older version 2016, and I didn’t have this problem. The 2016 version was not “vanilla” and it was installed from Ubuntu repositories.

I have a tikz picture script

single_quadrant_switch.tex

\documentclass[tikz]{standalone}
\usepackage{tikz}

\begin{document}
\begin{tikzpicture}%[>=latex]
    \draw[style=help lines] (0,0) (3,2);
  \tikzset{font=\large}
    \coordinate (vec3) at (0:5);
    \coordinate (vec4) at (90:5);
    \coordinate (vec5) at (270:5);
    \coordinate (vec6) at (180:5);

  \fill[lightgray!50!white] (0,0) rectangle (4,4);
  \draw[->,very thick,black] (0,0) -- (vec3);
    \draw[->,very thick,black] (0,0) -- (vec4); 
    \draw[->,very thick,black] (0,0) -- (vec5);
    \draw[->,very thick,black] (0,0) -- (vec6);
  \draw (5,-0.2) node [align=left, below] {Switch \\ off state \\ voltage};
  \draw (-0.2,4.9) node [align=left, left] {Switch \\ on state \\ current};

\end{tikzpicture}
\end{document}

When I create a pdf of the picture, it works fine. The problem occurs when I want to include it in another file with the command \includestandalone like this

\includestandalone[width=0.45\textwidth]{Chapter2/Figs/tikz/single_quadrant_switch}

This is the error from the log file

(./Chapter2/Figs/tikz/single_quadrant_switch.tex (/usr/local/texlive/2017/texmf-dist/tex/latex/standalone/standalone.cfg
File: standalone.cfg 2015/07/15 v1.2 Default configuration file for 'standalone' class
Missing character: There is no a in font nullfont!
Missing character: There is no c in font nullfont!
Missing character: There is no t in font nullfont!
Missing character: There is no i in font nullfont!
Missing character: There is no v in font nullfont!
Missing character: There is no e in font nullfont!
Missing character: There is no , in font nullfont!
Missing character: There is no t in font nullfont!
Missing character: There is no i in font nullfont!
Missing character: There is no g in font nullfont!
Missing character: There is no h in font nullfont!
Missing character: There is no t in font nullfont!
Missing character: There is no p in font nullfont!
Missing character: There is no a in font nullfont!
Missing character: There is no g in font nullfont!
Missing character: There is no e in font nullfont!
Missing character: There is no p in font nullfont!
Missing character: There is no r in font nullfont!
Missing character: There is no e in font nullfont!
Missing character: There is no v in font nullfont!
Missing character: There is no i in font nullfont!
Missing character: There is no e in font nullfont!
Missing character: There is no w in font nullfont!
) (/usr/local/texlive/2017/texmf-dist/tex/latex/base/size10.clo
File: size10.clo 2014/09/29 v1.4h Standard LaTeX file (size option)
)
./Chapter2/Figs/tikz/single_quadrant_switch.tex:21: Missing number, treated as zero.
<to be read again> 
                   =
l.21 \end{tikzpicture}

A number should have been here; I inserted `0'.
(If you can't figure out why I needed to see a number,
look up `weird error' in the index to The TeXbook.)

)
File: Chapter2/Figs/tikz/single_quadrant_switch.tex Graphic file (type tex)


./Chapter2/chapter2.tex:39: Package graphics Error: Division by 0.

See the graphics package documentation for explanation.
Type  H <return>  for immediate help.
 ...                                              

l.39 ...Chapter2/Figs/tikz/single_quadrant_switch}

Your command was ignored.
Type  I <command> <return>  to replace it with another command,
or  <return>  to continue without it.


./Chapter2/chapter2.tex:39: Package graphics Error: Division by 0.

See the graphics package documentation for explanation.
Type  H <return>  for immediate help.
 ...                                              

l.39 ...Chapter2/Figs/tikz/single_quadrant_switch}

Your command was ignored.
Type  I <command> <return>  to replace it with another command,
or  <return>  to continue without it.

./Chapter2/chapter2.tex:52: Extra }, or forgotten \endgroup.
\sf@endfloatbox ...gefalse \outer@nobreak \egroup 
                                                  \color@endbox 
l.52  \end{figure}

I've deleted a group-closing symbol because it seems to be
spurious, as in `$x}$'. But perhaps the } is legitimate and
you forgot something else, as in `\hbox{$x}'. In such cases
the way to recover is to insert both the forgotten and the
deleted material, e.g., by typing `I$}'.

./Chapter2/chapter2.tex:52: Too many }'s.
\color@endbox ->\color@endgroup \egroup 

l.52  \end{figure}

You've closed more groups than you opened.
Such booboos are generally harmless, so keep going.


./Chapter2/chapter2.tex:52: LaTeX Error: \begin{document} ended by \end{figure}.

See the LaTeX manual or LaTeX Companion for explanation.
Type  H <return>  for immediate help.
 ...                                              

l.52  \end{figure}

Your command was ignored.
Type  I <command> <return>  to replace it with another command,
or  <return>  to continue without it.

./Chapter2/chapter2.tex:52: Extra \endgroup.
<recently read> \endgroup 

l.52  \end{figure}

Things are pretty mixed up, but I think the worst is over.

Interesting thing is also that a circuitikz picture works fine with the \includestandalone command.

Here is the code for circuitikz and works on 2017 version of TeX Live

diodes_four_quadrant_switch.tex

\documentclass[tikz]{standalone}
\usepackage{tikz}
\usepackage[americanresistors,americaninductors]{circuitikz}
\usetikzlibrary{arrows.meta}
\begin{document}
\tikzstyle{every path}=[line width=0.9pt]
\begin{circuitikz}[american voltages]

  \draw(3,0) node [nigbt, scale=1.8, name=igbt1] {};

  \draw(0,0) to[D, name=D1] (3,3){}
  to[D, name=D2, invert] (6,0){}
  to[D, name=D3, invert] (3,-3){}
  to[D, name=D3] (0,0){};

  \draw (igbt1.C) to[short, -*] (3,3);
  \draw (igbt1.E) to[short, -*] (3,-3);
  \draw (0,0) to[short, *-] ++(-1,0);
  \draw (6,0) to[short, *-] ++(1,0);

\end{circuitikz}
\end{document}

I’m not sure what could be the problem.

I’m adding a simple example to better see the problem

\documentclass{article}
\usepackage[siunitx]{circuitikz}
\usepackage[subpreambles=false, obeyclassoptions=true]{standalone}

\begin{document}
Simple example.

\begin{figure}[htbp!]

    \includestandalone[width=0.45\textwidth]{Chapter2/Figs/tikz/single_quadrant_switch}

    \includestandalone[width=0.45\textwidth]{Chapter2/Figs/tikz/diodes_four_quadrant_switch}


  \end{figure}
\end{document}

I just figured out it has to do something with the parameter obeyclassoptions in standalone package. When it is set to true, I get the error in the new version of Tex Live 2017 (not the old one). But when I set it to false everything works fine.

  • You are not showing how exactly you are including the picture in your main document. Make a complete example. – Ulrike Fischer Jul 18 '17 at 8:59
  • 1
    It works without the obeyclassoptions=true option. And it is probably caused in part by changes in the graphic drivers. You could make a bug report for standalone and hope that it adapts its code. – Ulrike Fischer Jul 18 '17 at 13:56
  • Alternatively, remove tikz from the options in the standalone class. – cfr Jul 20 '17 at 12:42
  • Note that a key difference between the figures is that only one contains text. The problem from the error concerns fonts. – cfr Jul 20 '17 at 12:48
  • Thank you, cfr, it must be some kind of bug as mentioned by Ulrike, I will just leave “obeyclassoptions=false” for now because it seems to fix my problem without side effects. – Roman Konarik Jul 22 '17 at 9:50
3

Note that the tikz option for standalone class is the same as multi=tikzpicture and loading the tikz package. The multi option however creates a new page for every mentioned environment. A new page in standalone requires a new box and therefore group, which can cause problems if the page break is badly placed.

If you have only a single tikzpicture in your standalone file or an extended environment like circuitikz DON'T use tikz class option but simply load the tikz package yourself.

When you use obeyclassoptions the standalone package will try to apply all class options of the standalone files and therefore will wrap the tikzpicture inside circuitikz inside a box, which I guess is the source of your problem.

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.