On 07/05/2008 7:34 PM, Peter Jepsen wrote:
Hi,
I'm using Sweave with xtable to generate Latex tables. My problem is that some of the tables are too wide, and I would like to use the tiny font for these tables, but not for the others nor for the text. I can't work out how to accomplish that.
The Latex code below does what I want it to, but I have to insert the "\tiny{" and the
closing "}" by hand. It originated from these commands in my .Rnw-file:
<<yearmale, results=tex>>=
yearmale <- with(chol, table(year,male))
yearmale <- rowpct(yearmale) <<yearmale, results=tex>>=
print(xtable(yearmale,caption="My caption"))
$
See ?print.xtable. You can use
print(xtable(yearmale,caption="My caption"), size="\\tiny")
Duncan Murdoch
LATEX CODE:
\begin{table}[ht]
\begin{center}
\tiny{
\begin{tabular}{rlll}
\hline
& Kvinder & Mænd & Total \\
\hline
1998 & 1335 (75\%) & 437 (25\%) & 1772 (100\%) \\
1999 & 1232 (74\%) & 425 (26\%) & 1657 (100\%) \\
2000 & 1427 (74\%) & 502 (26\%) & 1929 (100\%) \\
2001 & 1407 (74\%) & 493 (26\%) & 1900 (100\%) \\
2002 & 1493 (71\%) & 611 (29\%) & 2104 (100\%) \\
2003 & 1684 (75\%) & 566 (25\%) & 2250 (100\%) \\
2004 & 1565 (73\%) & 567 (27\%) & 2132 (100\%) \\
2005 & 1629 (74\%) & 586 (26\%) & 2215 (100\%) \\
2006 & 1448 (72\%) & 553 (28\%) & 2001 (100\%) \\
2007 & 1582 (73\%) & 590 (27\%) & 2172 (100\%) \\
Total & 14802 (74\%) & 5330 (26\%) & 20132 (100\%) \\
\hline
\end{tabular}
}
\caption{My caption}
\end{center}
\end{table}
Can anybody help me? Thank you in advance.
Best regards,
Peter.
______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.