0
print(xtable(x, type = "latex"),
  floating = FALSE,
  tabular.environment = "longtable",
  file = "/Path/Filename.tex")

I am using the above code to output a table directly from R. I am using longtable because I need it to span pages. But I also need to scale it, so it fits on each page.

I thought it would be as simple as:

print(xtable(x, type = "latex"),
  floating = FALSE,
  tabular.environment = "longtable",
  scalebox = 0.7,
  file = "/Users/burtonpp/Documents/Tex/InfoTrellis/tables/pipeline.tex")

But, alas, this does not work. The scalebox line causes it not to compile.

Thoughts?

3
  • I fairly sure that a scalebox cannot span pages, so putting a longtable inside a scalebox cannot work. You need to do something else, like reducing font size or if there is a lot of text in one of the columns, make it a p column or similar, so the text will wrap across lines. Jan 19, 2019 at 21:14
  • You should never use \scalebox for tables. You'll get inconsistent font sizes and sometimes unreadable tables. It's bettr to play with the font size locally, and/or the value of \tabcolsep (default 6pt).
    – Bernard
    Jan 19, 2019 at 21:17
  • scaling tables is simply evil, why would you do that?:-) (scalebox can not be broken over a page, longtable can do nothing inside such a box) Jan 19, 2019 at 22:16

1 Answer 1

1
p <- xtable(x)
align(p) <- "lp{0.5in}p{1.5in}p{1.5in}p{1in}p{1in}"

print(p, 
  tabular.environment = "longtable", 
  floating = FALSE, 
  file = "/path/file.tex")

This works.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .