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

Pandoc error with `pander` and pandoc `2.0` #320

Open muschellij2 opened 6 years ago

muschellij2 commented 6 years ago
pandoc: PandocLuaException "[string \"local fig_caption = true...\"]:456: bad argument #2 to 'format' (number has no integer representation)"
Error: pandoc document conversion failed with error 1

Example Rmd where this occurs:

break_pandoc.zip

I have pander * 0.6.1 2017-08-06 CRAN (R 3.4.1) and I get the following error:

library(pander)
res = unzip("break_pandoc.zip", files = "break_pandoc.Rmd")
#> Warning in unzip("break_pandoc.zip", files = "break_pandoc.Rmd"): error 1
#> in extracting from zip file
rmarkdown::render("break_pandoc.Rmd")
#> processing file: break_pandoc.Rmd
#> output file: break_pandoc.knit.md
#> /usr/local/bin/pandoc +RTS -K512m -RTS break_pandoc.utf8.md --to html --from markdown+autolink_bare_uris+ascii_identifiers+tex_math_single_backslash --output break_pandoc.html --email-obfuscation none --self-contained --variable transition=0.4 --template /Library/Frameworks/R.framework/Versions/3.4/Resources/library/rmarkdown/rmd/ioslides/default.html --include-in-header /var/folders/1s/wrtqcpxn685_zk570bnx9_rr0000gr/T//RtmpjAJmrG/rmarkdown-str113de752a3f1d.html --mathjax --variable 'mathjax-url:https://mathjax.rstudio.com/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML' 
#> /usr/local/bin/pandoc +RTS -K512m -RTS break_pandoc.utf8.md --to ioslides_presentation.lua --from markdown+autolink_bare_uris+ascii_identifiers+tex_math_single_backslash --output /var/folders/1s/wrtqcpxn685_zk570bnx9_rr0000gr/T//RtmpjAJmrG/ioslides-output113de2895c503.html --slide-level 2
#> Error: pandoc document conversion failed with error 1

Session Information

devtools::session_info()
#> Session info -------------------------------------------------------------
#>  setting  value                       
#>  version  R version 3.4.3 (2017-11-30)
#>  system   x86_64, darwin15.6.0        
#>  ui       X11                         
#>  language (EN)                        
#>  collate  en_US.UTF-8                 
#>  tz       America/New_York            
#>  date     2018-03-05
#> Packages -----------------------------------------------------------------
#>  package   * version date       source        
#>  backports   1.1.2   2017-12-13 CRAN (R 3.4.3)
#>  base      * 3.4.3   2017-12-07 local         
#>  compiler    3.4.3   2017-12-07 local         
#>  datasets  * 3.4.3   2017-12-07 local         
#>  devtools    1.13.5  2018-02-18 CRAN (R 3.4.3)
#>  digest      0.6.15  2018-01-28 CRAN (R 3.4.3)
#>  evaluate    0.10.1  2017-06-24 cran (@0.10.1)
#>  graphics  * 3.4.3   2017-12-07 local         
#>  grDevices * 3.4.3   2017-12-07 local         
#>  htmltools   0.3.6   2017-04-28 CRAN (R 3.4.0)
#>  knitr       1.18    2017-12-27 CRAN (R 3.4.3)
#>  magrittr    1.5     2014-11-22 CRAN (R 3.4.0)
#>  memoise     1.1.0   2017-04-21 CRAN (R 3.4.0)
#>  methods   * 3.4.3   2017-12-07 local         
#>  pander    * 0.6.1   2017-08-06 CRAN (R 3.4.1)
#>  Rcpp        0.12.15 2018-01-20 CRAN (R 3.4.3)
#>  rmarkdown   1.8     2017-11-17 CRAN (R 3.4.2)
#>  rprojroot   1.2     2017-01-16 CRAN (R 3.4.0)
#>  stats     * 3.4.3   2017-12-07 local         
#>  stringi     1.1.6   2017-11-17 CRAN (R 3.4.2)
#>  stringr     1.3.0   2018-02-19 cran (@1.3.0) 
#>  tools       3.4.3   2017-12-07 local         
#>  utils     * 3.4.3   2017-12-07 local         
#>  withr       2.1.1   2017-12-19 CRAN (R 3.4.3)
#>  yaml        2.1.16  2017-12-12 cran (@2.1.16)
MacBook-Pro-6$ pandoc --version
pandoc 2.1.2
Compiled with pandoc-types 1.17.3.1, texmath 0.10.1.1, skylighting 0.6
Copyright (C) 2006-2018 John MacFarlane
Web:  http://pandoc.org
This is free software; see the source for copying conditions.
There is no warranty, not even for merchantability or fitness
for a particular purpose.
daroczig commented 6 years ago

Are you sure it's a pander issue? Eg pander is generating some markdown failling pandoc? Checking the below:

root@56d2b523ff38:/tmp$ /usr/bin/pandoc -v
pandoc 2.1.1
Compiled with pandoc-types 1.17.3, texmath 0.10.1, skylighting 0.6
Default user data directory: /root/.pandoc
Copyright (C) 2006-2018 John MacFarlane
Web:  http://pandoc.org
This is free software; see the source for copying conditions.
There is no warranty, not even for merchantability or fitness
for a particular purpose.

root@56d2b523ff38:/tmp$ /usr/bin/pandoc -t html

---------------------
 V1     V2      V3   
----- ------- -------
 hey   DICOM   NIfTI 
---------------------

<table style="width:31%;">
<colgroup>
<col style="width: 8%" />
<col style="width: 11%" />
<col style="width: 11%" />
</colgroup>
<thead>
<tr class="header">
<th style="text-align: center;">V1</th>
<th style="text-align: center;">V2</th>
<th style="text-align: center;">V3</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td style="text-align: center;">hey</td>
<td style="text-align: center;">DICOM</td>
<td style="text-align: center;">NIfTI</td>
</tr>
</tbody>
</table>
muschellij2 commented 6 years ago

It may not be a pander issue exactly, but using knitr::kable doesn't throw the error. Have you tried using rmarkdown::render and not pandoc? It may be the combination of the render and pander that's causing an issue.

John

On Tue, Mar 6, 2018 at 5:17 AM, Gergely Daróczi notifications@github.com wrote:

Are you sure it's a pander issue? Eg pander is generating some markdown failling pandoc? Checking the below:

root@56d2b523ff38:/tmp$ /usr/bin/pandoc -v pandoc 2.1.1 Compiled with pandoc-types 1.17.3, texmath 0.10.1, skylighting 0.6 Default user data directory: /root/.pandoc Copyright (C) 2006-2018 John MacFarlane Web: http://pandoc.org This is free software; see the source for copying conditions. There is no warranty, not even for merchantability or fitness for a particular purpose.

root@56d2b523ff38:/tmp$ /usr/bin/pandoc -t html


V1 V2 V3


hey DICOM NIfTI

V1 V2 V3
hey DICOM NIfTI

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/Rapporter/pander/issues/320#issuecomment-370733185, or mute the thread https://github.com/notifications/unsubscribe-auth/ABBnroyjFlAmxg1U4hl9Xg9ztPrIePeUks5tbmJIgaJpZM4Scm4f .

afranks86 commented 5 years ago

I have the same error trying to render the following markdown table:

"Code Rendered math
$x$ $x$
$\theta$ $\theta$
$x_i^2$ $x_i^2$
$\frac{1}{n}\sum_{i=1}^n x_i$ $\frac{1}{n} \sum_{i=1}^n x_i$
$\frac{1}{n}\sum_{i=1}^n (x_i-\bar x)^2$ $\frac{1}{n} \sum_{i=1}^n \bar (x_i - x)^2$"

It seems to have to do with the length of the last cell in the last line, as if I shorten it, I don't get the error.