8

Why does the following code fail to compile?

\documentclass[tikz]{standalone}
\begin{document}
\tikzset{every path/.style={line width=0.66em}}
\begin{tabular}{ll}
 $<$ 1 hour & \tikz \draw (0,0) -- (2.874cm,0) node[anchor=west] {28.74\%};
\end{tabular}
\end{document}
  • Welcome to TeX.sx! In such cases you should always post the exact error message(s) you get. Also the version number of the package/class in question is also useful. – Martin Scharrer Sep 16 '12 at 17:25
  • 1
    Using \documentclass{standalone} \usepackage{tikz} instead of \documentclass[tikz]{standalone} fixes the problem. – Peter Grill Sep 16 '12 at 17:28
5

The tikz option of standalone generates one page for all tikzpictures it finds, because it also enables the multi option. For this it will box and discard everything which is outside of such environments. It is not intended to be used with \tikz inside a tabular. I recommend to drop the tikz option and load the tikz package manually instead.

\documentclass{standalone}
\usepackage{tikz}
\begin{document}
\tikzset{every path/.style={line width=0.66em}}
\begin{tabular}{ll}
 $<$ 1 hour & \tikz \draw (0,0) -- (2.874cm,0) node[anchor=west] {28.74\%};
\end{tabular}
\end{document}

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.