0

I am using dynamically generated table with knitr. Sometimes the tables are small and fit within the text width while other times it is large and one can use the following solution: Automatically adjust LaTeX table width to fit pdf using knitr and Rstudio

Just wondering if there is a way to use \textwidth only when when the table width is larger than the \textwidth? In automatic reporting sometime tables are large and sometime tiny. Using full text width generated awkward huge font table.

Community
  • 1
  • 1
Shambho
  • 3,250
  • 1
  • 24
  • 37
  • There's a `longtable` LaTeX package, so maybe there's one for `widetables`? – IRTFM Feb 18 '15 at 20:40
  • I am not looking for a `widetables` solution. In fact the following solution works fine in that case: http://stackoverflow.com/questions/16507191/automatically-adjust-latex-table-width-to-fit-pdf-using-knitr-and-rstudio/ What I looking for is an option which puts an upper limit on text width. – Shambho Feb 18 '15 at 21:57
  • You can place the `tabular` inside an `adjustbox` environment and set the `max width=\textwidth` key. [`adjustbox`](http://ctan.org/pkg/adjustbox) will test whether scaling is necessary or not. – Werner Feb 19 '15 at 04:37

0 Answers0