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?
Tables PDF – How to Create an Enclosing, Fitting PDF for a Table
pdftables
Related Solutions
PhilTeX has a nice article about it: Reading PDFs on portables. It answers some of your TeXnical questions, but I'm afraid it is hard to give advice on things like aspect ratios and font sizes. The medium you're targetting is very diverse and something that works for a laptop might not work on a Kindle.
Update: I just stumbled across a talk on typesetting for the iPad given at TUG2010. It could be interesting, he gives a demo too.
There are many ways.
\includegraphics
with \captionof
The table document is trimmed via pdfcrop table.pdf
.
The caption is added by \captionof
. The continued caption uses an empty optional argument of \captionof
to avoid another entry in the list of tables.
\documentclass{article}
\usepackage{graphicx}
\usepackage{caption}
\begin{document}
\listoftables
\bigskip
\begingroup
\centering
\includegraphics[page=1, width=\linewidth]{table-crop.pdf}
\captionof{table}{Example}
\newpage
\includegraphics[page=2, width=\linewidth]{table-crop.pdf}%
\addtocounter{table}{-1}%
\captionof{table}[]{Example (cont.)}
\par
\endgroup
\end{document}
Package pdfpages
Multiple documents can also be included via package pdfpages
:
\includepdf[pages=-]{table.pdf}
But the placement of the caption is not so easy.
CSV data
If you are the creator of the table, then you can save it as .csv
file and import it in LaTeX. Example with package csvsimple
and longtable
:
\documentclass{article}
\usepackage{longtable}
\usepackage{csvsimple}
\begin{document}
\csvreader[
longtable=lll,
head,
table head={%
\bfseries Name & \bfseries Value & \bfseries Text\\\hline\endhead
\caption{Example}\endlastfoot
},
]{test-table.csv}{
Name=\colname,
Value=\colvalue,
Text=\coltext
}{%
\colname & \colvalue & \coltext
}
\end{document}
And the data file test-table.csv
:
Name,Value,Text
Test 1,1,A
Test 2,2,B
Test 3,3,A
Test 4,4,B
Test 5,5,A
Test 6,6,B
Test 7,7,A
Test 8,8,B
Test 9,9,A
Test 10,10,B
Test 11,11,A
Test 12,12,B
Test 13,13,A
Test 14,14,B
Test 15,15,A
Test 16,16,B
Test 17,17,A
Test 18,18,B
Test 19,19,A
Test 20,20,B
Advantages are more control over the table layout, page breaks, ...
Best Answer
standalone
would be a good choice.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...