yonicd/texPreview

Error messaging with landscape .tex

curtisKJ opened this issue · 8 comments

Problem:

  • I can have a Latex table be knitted appropriately. However, when trying to write out the .tex table to disk I get compiling errors from texPreview.

Screen Shot 2020-03-27 at 8 27 03 AM

  • The latex is written out just fine.

Code:

chrt1comb %>% 
  rename(`$t_{lag}$ (h)` = tlag,
         `$C_{max}$ (ug/L)` = cmax,
         `$AUC_{last}$ (h*ug/L)` = auclast,
         `$AUC_{0-inf}$ (h*mg/L)` = aucinf.obs,
         `$\\lambda_{z}$` = lambda.z,
         `$t_{1/2}$ (h)` = half.life,
         `$CL/F$ (L/h)` = CL,
         `$Vz/F$ (L)` = Vz,
         `$AUC_{0-inf}$ Ext. ($\\%$)` = aucpext.obs) %>%
  kableExtra::kable(caption = 
                      'Dose 1.0: Summary',
                    label = 'tab5',format='latex',escape=F) %>%
  kableExtra::kable_styling(latex_options = c("scale_down")) %>%
  column_spec(1, bold = T) %>%
  pack_rows(group_label = "Summaries", 
            start_row = 3, 
            end_row = 11, 
            latex_gap_space = "2em") %>%
  kable_footnote(stem = 'CHRT1SUM') %>%
    landscape() %>%
  texPreview::tex_preview(stem = 'CHRT1SUM',
                          usrPackages = build_usepackage(pkg = 'lscape'))

this reproduces the error

system.file('examples/toy/toy.tex',package = 'texPreview')%>%
  texPreview::as.kable()%>%
  kableExtra::landscape()%>%
  texPreview::tex_preview(
    usrPackages = texPreview::build_usepackage('lscape')
  )
 Error in tex_preview.default(obj, tex_lines, stem, overwrite, keep_pdf,  : 
   
! Dimension too large.
\sa@placebox ...global \pdfpagewidth =\wd \sa@box 
 \global \pdfpageheight =\h...
l.18 \end{document}
 
!  ==> Fatal error occurred, no output PDF file produced! 

this solves the issue

system.file('examples/toy/toy.tex',package = 'texPreview')%>%
  texPreview::as.kable()%>%
  kableExtra::landscape()%>%
  texPreview::tex_preview(
    usrPackages = texPreview::build_usepackage(c('lscape','geometry'))
  )
image

image

I will add geometry to the tex template of the package to keep this from happening again.

Hmmm, this didn't resolve the issue for me.

what is the dimension of the dataframe?

Whoops, forgot to vectorize.....it works. Sorry.

np. so i can close?

Yes, sir. Thanks again.