Rapporter / pander

An R Pandoc Writer: Convert arbitrary R objects into markdown
http://rapporter.github.io/pander/
Open Software License 3.0
294 stars 66 forks source link

pander Does Not Render Wide Tables In Landscape Format In PDF Document with Rmd #360

Closed drag05 closed 2 years ago

drag05 commented 2 years ago

This is about PDF output in Rmd: I have a very wide table which pander renders properly with option 'grid' or 'simple' in portrait format however, it spreads over many document pages. I have tried to use the pdflscape and rotate latex packages to rotate this table in landscape format and I am getting the same error every time. The same table rotates just fine with knitr but knitr does not split the table by columns as pander does:

Example:

\newpage \begin{landscape}

pander::cache.on()
pander::pander(wTab, caption = 'Render Throws Error')
pander::pander('\nEND OF TABLE\n')

\end{landscape} \newpage

Renderer error:

_This is XeTeX, Version 3.141592653-2.6-0.999994 (TeX Live 2022) (preloaded format=xelatex) restricted \write18 enabled. entering extended mode I was unable to find any missing LaTeX packages from the error log PTM_v2.0.log. ! Misplaced alignment tab character &. l.111 & nbsp; Modification D...

Error: LaTeX failed to compile PTM_v2.0.tex. See https://yihui.org/tinytex/r/#debugging for debugging tips. See PTMv2.0.log for more info. Execution halted

I have followed the debugging tips from the above link to no avail. Please advise. Thank you!

"R version 4.2.1 (2022-06-23 ucrt)"

daroczig commented 2 years ago

So it works without landscape, but fails with it? Can you posts wTab for a reproducible example?

drag05 commented 2 years ago

@daroczig Yes, it does, without any error or warning - just clean pdf. wTab is proprietary data. Could you direct me to an example where pander works on landscape? Thank you!

daroczig commented 2 years ago

I'm terribly sorry, but I don't have time to experiment with this in general, so please post a reproducible example for the error that I can check. Maybe it's replacing wTab with mtcars or similar.

drag05 commented 2 years ago

@daroczig So, in general it woks, only not with my data? No need to experiment with anything, just point me to a case where this works. Thank you!