standalone figure and tabular
Update 2011/12/21
I now release standalone
v1.0 which comes with a varwidth
option to allow
for vertical content with variable width. It uses the varwidth
environment (and package) internally which is based on minipage
. Using this option
you can use a paragraph break (i.e. an empty line) to stack both things. If you
want more vertical space try a \vspace{..}
between them.
\documentclass[varwidth]{standalone}[2011/12/21]
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
\draw (0,0) rectangle (2,3);
\end{tikzpicture}%
\begin{tabular}{cc}
a & b \\\hline
b & c \\
d & e \\
\end{tabular}%
\end{document}
Original answer:
You need to stack the two elements manually without using a line break or new paragraph. You can use a TikZ picture like Ignasi suggested, wrap both into a tabular
or use \shortstack{...\\...}
. It is also possible to stack it using plainTeX commands: \vbox{\hbox{..}\hbox{..}}
.
Examples:
\documentclass{standalone}
\usepackage{tikz}
\begin{document}
\vbox{\hbox{%
\begin{tikzpicture}
\draw (0,0) rectangle (2,3);
\end{tikzpicture}%
}\hbox{%
\begin{tabular}{cc}
a & b \\\hline
b & c \\
d & e \\
\end{tabular}%
}}%
\end{document}
and
\documentclass{standalone}
\usepackage{tikz}
\begin{document}
\shortstack{%
\begin{tikzpicture}
\draw (0,0) rectangle (2,3);
\end{tikzpicture}%
\\%
\begin{tabular}{cc}
a & b \\\hline
b & c \\
d & e \\
\end{tabular}%
}%
\end{document}
With the optional argument of \shortstack
you can select the horizontal alignment of the blocks.
I reused the example code from Ignasi to allow for easy comparison.
If it's possible you can include your tabular inside the tikzpicture.
\documentclass[border=3mm]{standalone}
\usepackage{tikz}
\usetikzlibrary{positioning}
\begin{document}
\begin{tikzpicture}
\node (figure) at (0,0) {\tikz \draw (0,0) rectangle (2,3);};
\node (tabular) [below = of figure] {\begin{tabular}{cc}
a & b \\\hline
b & c \\
d & e \\
\end{tabular}};
\end{tikzpicture}
\end{document}
I've tested standalone
and preview
but although cropped height is correct, cropped width is textwidth. If you know final width, you can use a minipage
to fix it.