5

I want to make a document out of a single table, for inclusion into PowerPoint, etc., as a PDF just the size of the table, with a small customizable margin. Which document class should I use, and how do I set the margins?

5

standalone would be a good choice.

\documentclass[border=1em]{standalone}

\begin{document}
\begin{tabular}{cc}
  a & b \\
  c & d
\end{tabular}
\end{document}

Note that you don't need the \begin{table}\centering or the \end{table} that normally accompanies a table in a standard document. This is because what these commands do is irrelevant for a standalone table. You don't need to put the table in a float, since there's no surrounding text it needs to fit into. You don't need to center it, because there's nothing to center it against. If it's standing alone, it will take up all the space: centering doesn't mean anything in this context...

  • 2
    The upcoming version of standalone also supports the direct conversion to PNG or other image formats (using an external SW like Image Magick or Ghostscript). – Martin Scharrer Apr 6 '11 at 15:05
  • I tried with a \begin{table}\centering ..., but was getting: ! LaTeX Error: Not in outer par mode. -- on the \centering. Switching to \article, \pagenumering{gobble} and pdfcrop solved it for now. How standalone can be made to work for tables? – Alexy Apr 6 '11 at 22:29
  • @Alexy if you're just using standalone for a table, you don't need to center it: center it with respect to what!? You don't need the table either, just the inner tabular. There's no point making a float if you want to use standalone. It's not going to float anywhere... – Seamus Apr 6 '11 at 22:31
  • @Martin Scharrer when will the new version be on CTAN? – Seamus Apr 8 '11 at 12:41
  • @Seamus: It's mostly done, but still needs some work and testing. I hope I get it out in the next few weeks. – Martin Scharrer Apr 8 '11 at 13:02

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.