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}
2
  • 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. Sep 16, 2012 at 17:25
  • 1
    Using \documentclass{standalone} \usepackage{tikz} instead of \documentclass[tikz]{standalone} fixes the problem. Sep 16, 2012 at 17:28

1 Answer 1

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}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .