5

I have a table, but for cleanliness (I'll use the figure in a paper and in talks), I'd like to compile to a single PDF and include it with includegraphics instead of having the table rendered within the paper.

In the paper, it renders fine. I use these options:

\documentclass[11pt,twocolumn]{article}
\usepackage{graphicx}
\usepackage[margin=1in]{geometry}

But when I move the table into a standalone document with preview, the graphics are far too big for the page. Of course, I can still simply render the figure in its own table inside paper.tex, but I'd like to figure out why this happens. Can you figure it out?

Here is the preview document:

\documentclass[preview=true]{standalone}

\usepackage{standalone}
\usepackage{rotating}
\usepackage{array}

\usepackage{graphicx}
\usepackage{multirow}

\pagestyle{empty}

\begin{document}

\begin{tabular}{m{0.1in}m{1.4in}m{1.4in}m{1.4in}m{1.4in}m{1.4in}}
  &
\multirow{3}{*}{\begin{minipage}{1.4in}\centering {\bf (a)} Control-control densities \end{minipage}} &
 % 1.4 * 3
 \multicolumn{3}{c}{ \begin{minipage}{4.2in}\centering {\bf (b)} Case-control vs. control-control log densities \end{minipage} } \\
 & & \multicolumn{3}{c}{ \begin{minipage}{4.2in}\centering {\includegraphics[width=4.2in]{colorbar.pdf}} \end{minipage} }\\

 & & \begin{minipage}{1.4in} \centering {0 differential} \end{minipage} & \begin{minipage}{1.4in} \centering {53 differential} \end{minipage} & \begin{minipage}{1.4in} \centering {302 differential} \end{minipage}\\

 \begin{sideways}Replicate 1\end{sideways} & 
  \includegraphics[width=1.4in]{null_1-crop.pdf} &
  \includegraphics[width=1.4in]{rep_1_0-crop.pdf} &
  \includegraphics[width=1.4in]{rep_1_53-crop.pdf} &
  \includegraphics[width=1.4in]{rep_1_302-crop.pdf} \\

 \begin{sideways}Replicate 2\end{sideways} & 
  \includegraphics[width=1.4in]{null_2-crop.pdf} &
  \includegraphics[width=1.4in]{rep_2_0-crop.pdf} &
  \includegraphics[width=1.4in]{rep_2_53-crop.pdf} &
  \includegraphics[width=1.4in]{rep_2_302-crop.pdf} \\
\end{tabular}

\end{document}
ShreevatsaR
  • 45,428
  • 10
  • 117
  • 149
user
  • 467

2 Answers2

1

Ah-- it was this line:

\usepackage[margin=1in]{geometry}

Adding it to the standalone document did the trick.

user
  • 467
  • 4
    I'm the author of standalone. Using geometry with the standalone class should not be required and is in general not recommended, because then both will influence the page margin or size. – Martin Scharrer May 19 '13 at 07:45
1

When I remove the trailing empty line after the table or remove the preview option (standalone v1.x) then the issues disappear. Please see Standalone package creates a page with a fixed width which explains why this happens with the preview option. Because of this I consider your question a duplicate of that question and will close it as such shortly. However, I wanted to post the corrected code for you before that. Please find it below.

Note that you also don't need to load the standalone package as long you don't want to include other standalone documents. Please also don't use the old LaTeX 2.0 font macros like \bf any longer. See "Correct" way to bold/italicize text? for an explanation.

\documentclass[preview]{standalone}

\usepackage{rotating}
\usepackage{array}

\usepackage{graphicx}
\usepackage{multirow}

\begin{document}
\begin{tabular}{m{0.1in}m{1.4in}m{1.4in}m{1.4in}m{1.4in}m{1.4in}}
  &
\multirow{3}{*}{\begin{minipage}{1.4in}\centering {\bfseries (a)} Control-control densities \end{minipage}} &
 % 1.4 * 3
 \multicolumn{3}{c}{ \begin{minipage}{4.2in}\centering {\bfseries (b)} Case-control vs. control-control log densities \end{minipage} } \\
 & & \multicolumn{3}{c}{ \begin{minipage}{4.2in}\centering {\includegraphics[width=4.2in]{example-image.pdf}} \end{minipage} }\\

 & & \begin{minipage}{1.4in} \centering {0 differential} \end{minipage} & \begin{minipage}{1.4in} \centering {53 differential} \end{minipage} & \begin{minipage}{1.4in} \centering {302 differential} \end{minipage}\\

 \begin{sideways}Replicate 1\end{sideways} &
  \includegraphics[width=1.4in]{example-image.pdf} &
  \includegraphics[width=1.4in]{example-image.pdf} &
  \includegraphics[width=1.4in]{example-image.pdf} &
  \includegraphics[width=1.4in]{example-image.pdf} \\

 \begin{sideways}Replicate 2\end{sideways} &
  \includegraphics[width=1.4in]{example-image.pdf} &
  \includegraphics[width=1.4in]{example-image.pdf} &
  \includegraphics[width=1.4in]{example-image.pdf} &
  \includegraphics[width=1.4in]{example-image.pdf} \\
\end{tabular}
\end{document}
David Carlisle
  • 757,742
Martin Scharrer
  • 262,582
  • Have you read my bug report e-mail? Here is the code to regenerate the issue. – kiss my armpit May 21 '13 at 06:54
  • @ClickMe: Please use the chat or email for such messages and not unrelated posts. I have read it but didn't had time to test it. What makes you think this is a bug in standalone? Probably the gather* environment adds the space somehow. – Martin Scharrer May 21 '13 at 07:33