I am very new to LaTeX and Sweave, and I am just playing around with getting some output. That said, the "output" I am getting is very large in size (physcially on the page). For example, one output from a 2x3 crosstab takes up a whole 8.5x11 page. If I try to use the same output in a beamer presentation, maybe 30% of the output fits on 1 slide.

Simply, when pushing output from R using Sweave, how can I control the size of the output?

Thanks in advance!

EDIT: Below is a code snipped within my .Rnw file (before Sweave processing)

cat("Education by Induced")
CrossTable(infert$education, infert$induced, expected = TRUE, format="SPSS")

You can use the \scalebox{} command that comes with the graphicx package. E.g., with


your text will be printed at 70%.

This will only work if you use a Sweave chunk to create an external file (say, tab1.tex) and then include it in the LATEX file using an \include or \input statement, not by printing it directly into you master file with results=tex.


Given my comment and your updated question, I would suggest to look at the Design package which offers convenient LaTeX export of nice-looking Tables, see summary.formula(). Again, the idea would be to write a Table generated this way into a TeX file, and then \input it into your master Rnw file. You can look at Statistical Reporting, Linking S Output with Report Documents, Literate Programming, Managing Analyses, and Documenting Programs and Data for more detailed illustrations.

  • Thanks for the help. I edited my post above to show a code snippet. I am using the gmodels package and the function CrossTable, which to the best of my knowledge can not be used with results=tex, however, I am very new to this game. – Btibert3 Jan 31 '11 at 15:38
  • @Btibert3 Ah, so I think my solution will not work in this case. Still, you can try to write a "texified" output from CrossTable() into a file and then \input it into your Sweave doc. I remember doing this way with automatic reports. But, looking at the output from CrossTable() with the format="SPSS" option, I can imagine this will be tricky to convert the raw table to a tabular. I offer an alternative way in my updated response. – chl Jan 31 '11 at 18:13

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.