crsh / papaja

papaja (Preparing APA Journal Articles) is an R package that provides document formats to produce complete APA manuscripts from RMarkdown-files (PDF and Word documents) and helper functions that facilitate reporting statistics, tables, and plots.
https://frederikaust.com/papaja_man/
Other
654 stars 133 forks source link

pandoc: error running filter #225

Closed sfve closed 2 years ago

sfve commented 6 years ago

Hi,

I wanted to run the apa draft with nothing being changed yet but I get an error message and R won't knit the file.

pandoc: Error running filter /Library/Frameworks/R.framework/Versions/3.2/Resources/library/papaja/rmd/ampersand_filter.sh fd:5: hClose: resource vanished (Broken pipe) Error: pandoc document conversion failed with error 83 Execution halted

I saw that for another person changing the language settings helped but here it doesn't seem to do the trick.

sessionInfo() R version 3.2.4 (2016-03-10) Platform: x86_64-apple-darwin13.4.0 (64-bit) Running under: OS X 10.11.6 (El Capitan)

locale: [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

attached base packages: [1] stats graphics grDevices utils datasets methods base

loaded via a namespace (and not attached): [1] backports_1.1.2 magrittr_1.5 rprojroot_1.3-2 htmltools_0.3.6 tools_3.2.4
[6] yaml_2.1.16 Rcpp_0.12.14 stringi_1.1.6 rmarkdown_1.8 papaja_0.1.0.9709 [11] knitr_1.18 stringr_1.2.0 digest_0.6.13 evaluate_0.10.1

Do you know what the issue could be? Would love to work with it!

crsh commented 6 years ago

Hi Sarah, sorry for the inconvenience. When you say you tried to knit the "apa draft", do you mean the unedited template (File > New file > R Markdown)?

Also, could you try using the latest development version (devtools::install_github("crsh/papaja@devel")) to see if that resolves the problem?

irnewman commented 6 years ago

I am having the exact same issue. My Rmarkdown file would knit properly until the most recent update papaja_0.1.0.9837. I now get the error message:

pandoc.exe: Error running filter _papaja_ampersand_filter.bat fd:3: hClose: resource vanished (Broken pipe) Error: pandoc document conversion failed with error 83 Execution halted

sessionInfo() R version 3.5.0 (2018-04-23) Platform: x86_64-w64-mingw32/x64 (64-bit) Running under: Windows >= 8 x64 (build 9200)

Also, if I create a new papaja APA article file from the template and try to knit it without any changes:

pandoc.exe: Error running filter _papaja_ampersand_filter.bat terminateProcess: permission denied (Permission denied) Error: pandoc document conversion failed with error 83 Execution halted

Adding "replace_ampersands: no" to the YAML makes it knit, but then the ampersands in the text (not in citations) are not replaced with "and".

crsh commented 6 years ago

Ah, sorry about that. This was a bug, I think, I introduced just before the release. I think this should now be fixed. Could you try the development version (devtools::install_github("crsh/papaja@devel"))? If this fixes the issue, I'll release it to the master later today.

irnewman commented 6 years ago

No apology necessary! I'm very happy with the papaja package and just wanted to figure out this minor problem.

Yes, the development version has fixed this issue for me. Thanks a lot.

crsh commented 6 years ago

Great, thanks for checking. I have now also released the fix on the master branch.

sfve commented 6 years ago

Hi, I'm so sorry, I was on holidays and then completely forgot to answer. Thanks for dealing with this issue though! For me it doesn't fix the problem. As you said, I just tried to use the unedited APA draft. Changing this -> replace_ampersands: no made it knit as well. I tried the new version now but it doesn't seem to fix the issue for me. Do I need to take care of something else when downloading the new version? Thanks for your help!

crsh commented 6 years ago

Hi, not a problem. Hmm, I don't think you need to do anything else... What version of RStudio are you using? Could you report the output of devtools::session_info()?

sfve commented 6 years ago

I also thought that it might be due to my rather old R and RStudio version?!

Session info ----------------------------------------------------------------------------------------------
 setting  value                       
 version  R version 3.2.4 (2016-03-10)
 system   x86_64, darwin13.4.0        
 ui       RStudio (1.0.143)           
 language (EN)                        
 collate  en_US.UTF-8                 
 tz       Europe/Berlin               
 date     2018-08-13                  

Packages --------------------------------------------------------------------------------------------------
 package   * version    date       source                      
 backports   1.1.2      2017-12-13 cran (@1.1.2)               
 devtools    1.12.0     2016-06-24 CRAN (R 3.2.5)              
 digest      0.6.13     2017-12-14 cran (@0.6.13)              
 evaluate    0.10.1     2017-06-24 cran (@0.10.1)              
 htmltools   0.3.6      2017-04-28 cran (@0.3.6)               
 knitr       1.18       2017-12-27 cran (@1.18)                
 lattice     0.20-34    2016-09-06 CRAN (R 3.2.5)              
 lme4        1.1-15     2017-12-21 cran (@1.1-15)              
 magrittr    1.5        2014-11-22 CRAN (R 3.2.0)              
 MASS        7.3-45     2015-11-10 CRAN (R 3.2.4)              
 Matrix      1.2-8      2017-01-20 CRAN (R 3.2.5)              
 memoise     1.0.0      2016-01-29 CRAN (R 3.2.3)              
 minqa       1.2.4      2014-10-09 CRAN (R 3.2.0)              
 nlme        3.1-131    2017-02-06 CRAN (R 3.2.5)              
 nloptr      1.0.4      2014-08-04 CRAN (R 3.2.0)              
 papaja      0.1.0.9842 2018-08-13 Github (crsh/papaja@29e6cb0)
 Rcpp        0.12.14    2017-11-23 CRAN (R 3.2.5)              
 rmarkdown   1.8        2017-11-17 cran (@1.8)                 
 rprojroot   1.3-2      2018-01-03 cran (@1.3-2)               
 stringi     1.1.6      2017-11-17 cran (@1.1.6)               
 stringr     1.2.0      2017-02-18 CRAN (R 3.2.5)              
 withr       1.0.2      2016-06-20 CRAN (R 3.2.5)              
 yaml        2.1.16     2017-12-12 cran (@2.1.16) 
crsh commented 6 years ago

Could you try updating the rmarkdown package and your version of RStudio? It's recommended to use RStudio 1.1.453 or later and rmarkdown 1.10.

sfve commented 6 years ago

I updated both and the error still appears. I also tried it on my Windows computer at work and there it's all great and looks fine. Could it be a problem with my mac? It still runs on El Capitan (I'm afraid of updating running systems as you can see).

crsh commented 6 years ago

Hmm, I don't think this should be due to the operating system... I think I'll need a little more diagnostics to understand what's going on. I'll try to put together a debugging version of the filter. I'll get on that as soon as I find some time. I don't think I'll get around to it this week.

HenrikEckermann commented 5 years ago

Hi Frederik,

Last I used papaja in the summer and could knit my documents. Now I am using rprojects since a while and finally wanted to knit the article but get the following error:

Error running filter /Library/Frameworks/R.framework/Versions/3.5/Resources/library/papaja/rmd/ampersand_filter.R:
Error in $: endOfInput
Error: pandoc document conversion failed with error 83
Execution halted

I use Mac OS Mojave and your newest dev. I tried (within the project) to just knit your template by creating new Rmd file but I get the same error. This is sessionInfo:

R version 3.5.1 (2018-07-02)
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Running under: macOS  10.14.2

Matrix products: default
BLAS: /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/3.5/Resources/lib/libRlapack.dylib

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] papaja_0.1.0.9842 rmarkdown_1.11   

loaded via a namespace (and not attached):
 [1] Rcpp_1.0.0        rstudioapi_0.8    knitr_1.21        magrittr_1.5     
 [5] usethis_1.4.0     devtools_2.0.1    pkgload_1.0.2     R6_2.3.0         
 [9] rlang_0.3.0.1     tools_3.5.1       pkgbuild_1.0.2    packrat_0.5.0    
[13] xfun_0.4          sessioninfo_1.1.1 cli_1.0.1         withr_2.1.2      
[17] remotes_2.0.2     htmltools_0.3.6   yaml_2.2.0        assertthat_0.2.0 
[21] digest_0.6.18     rprojroot_1.3-2   crayon_1.3.4      processx_3.2.1   
[25] callr_3.1.1       fs_1.2.6          ps_1.3.0          curl_3.2         
[29] testthat_2.0.1    glue_1.3.0        memoise_1.1.0     evaluate_0.12    
[33] compiler_3.5.1    desc_1.2.0        backports_1.1.3   prettyunits_1.0.2
HenrikEckermann commented 5 years ago

Hi Frederik,

it is very well possible that the issue arised because of issues with my zotero library. I encountered similar issues outside the use of papaja, which I solved by editing the library. Also knitting the template now works. For now assume the issue is locally here. If I find it out exactly, I will inform you here...

crsh commented 5 years ago

Hi Henrik, sorry for the delay, I'm currently on parental leave. Thanks for following up on this, this sounds interesting. Could you provide details what kind of editing you did to the library to fix this? Hunting this one down might be helpful to others.

HenrikEckermann commented 5 years ago

Hi Frederik,

congratulations ;-)

I found that I had false entries in my .bib file. This was a bug introduced by Zotero. After I deleted the false entries within Zotero the problem was resolved. Of course I needed to update the .bib file after modifying in Zotero...

crsh commented 5 years ago

Interesting! Any chance you could post one of those faulty entries here for inspection and debugging purposes?

crsh commented 5 years ago

Also, if this is related to an exported reference, it's unlikely to be the same issue as reported by @sfve. If I understood correctly she was having issues even with the plain APA6 skeleton.

HenrikEckermann commented 5 years ago

I am sorry but I deleted them all. I also do not know what caused these entries. If that happens again I will report it here!

HenrikEckermann commented 5 years ago

Hi Frederik,

unfortunately ran into the error again. I installed stable dev version, restarted R and used new RMD file--> from template-->apa6th(papaja). Then just knitted and it get first the error regarding the r-references. Then I knit again and I get:

Error running filter /Library/Frameworks/R.framework/Versions/3.5/Resources/library/papaja/rmd/ampersand_filter.R:
Error in $: endOfInput
Error: pandoc document conversion failed with error 83
Execution halted

Here is my system info:

R version 3.5.3 (2019-03-11)
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Running under: macOS Mojave 10.14.4

Matrix products: default
BLAS: /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/3.5/Resources/lib/libRlapack.dylib

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

loaded via a namespace (and not attached):
 [1] compiler_3.5.3    htmltools_0.3.6   tools_3.5.3       yaml_2.2.0        Rcpp_1.0.1        rmarkdown_1.12    papaja_0.1.0.9842 knitr_1.22       
 [9] xfun_0.6          digest_0.6.18     evaluate_0.13
crsh commented 5 years ago

Thanks for the report. The current solution I'm using appears to be less than ideal. I'm planning to reimplement the ampersand filter that is giving you the trouble as a Lua-filter (as per #262), which I hope to be more robust and faster. I'll let you know as soon as I make progress on this. In the meantime, I hope you can live with the work around to set replace_ampersands: no in the YAML front matter.

crsh commented 5 years ago

Hi @HenrikEckermann (cc @sfve), I just pushed a commit to the development branch that implements a first attempt at the Lua-filter (devtools::install_github("crsh/papaja@devel")). Could you give it a try and let me know if that makes a difference?

HenrikEckermann commented 5 years ago

Hi @crsh,

yes it works for me. I skimmed the resulting pdf and it looked good. Didn't look in detail but runs now without any error. Thanks !

crsh commented 5 years ago

Excellent, thank you!

HenrikEckermann commented 5 years ago

Hi Frederik,

EDIT::: NEVER MIND. It worked using double escape when using latex like this:

papaja::apa_table(list(
    "\\textit{28 days}" = shannon_table_list$data[[1]],
    "\\textit{75 days}" = shannon_table_list$data[[2]],
    "\\textit{105 days}" = shannon_table_list$data[[3]],
    "\\textit{6 years} = shannon_table_list$data[[4]]),
    caption = "(ref:glm2table)",
    escape = FALSE
)

OLD POST:

I try to print a table where the headers are either bold or italic.

Notice also that I tried Latex directly (I first tried Markdown). E.g.

papaja::apa_table(list(
    "*28 days*" = shannon_table_list$data[[1]],
    "*75 days*" = shannon_table_list$data[[2]],
    "*105 days*" = shannon_table_list$data[[3]],
    "*6 years*" = shannon_table_list$data[[4]]),
    caption = "(ref:glm2table)",
    escape = FALSE
)
papaja::apa_table(list(
    "*28 days*" = shannon_table_list$data[[1]],
    "*75 days*" = shannon_table_list$data[[2]],
    "*105 days*" = shannon_table_list$data[[3]],
    "*6 years*" = shannon_table_list$data[[4]]),
    caption = "(ref:glm2table)",
    escape = TRUE
)

Both give the same output. Is that because of the new filter? I think that did work in the past.

crsh commented 5 years ago

Thank you for the update and for posting your solution, Henrik. The Markdown formatting unfortunately doen't work because apa_table, by default, outputs LaTeX code in PDF documents and pandoc doesn't parse anything within LaTeX environments.

diegotrindade commented 4 years ago

Hi @crsh, after updating RStudio, pandoc and papaja, I'm facing a similar error.

Error running filter C:/R-3.6.2/library/papaja/rmd/docx_fixes.lua:
[string "--[[..."]:227: Constructor for Emph failed: [string "--[[..."]:258: attempt to index a nil value (local 'x')

stack traceback:
    [C]: in function 'error'
..."]:227: in field 'Emph'
    C:/R-3.6.2/library/papaja/rmd/docx_fixes.lua:14: in function 'Image'
Error: pandoc document conversion failed with error 83

It is occurring only when I use child documents.

> sessionInfo()
R version 3.6.2 (2019-12-12)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 16299)

Matrix products: default

locale:
[1] LC_COLLATE=Estonian_Estonia.1257  LC_CTYPE=Estonian_Estonia.1257    LC_MONETARY=Estonian_Estonia.1257
[4] LC_NUMERIC=C                      LC_TIME=Estonian_Estonia.1257    

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

loaded via a namespace (and not attached):
 [1] compiler_3.6.2    bookdown_0.17     htmltools_0.4.0   tools_3.6.2       yaml_2.2.1        Rcpp_1.0.3        rmarkdown_2.1    
 [8] papaja_0.1.0.9942 knitr_1.27        xfun_0.12         digest_0.6.23     rlang_0.4.4       evaluate_0.14  

PS: replace_ampersands: no did not work.

crsh commented 4 years ago

Hi Diego, is it possible your document includes a figure without a caption? If so, try adding a figure caption. I'll try to fix this as soon as possible.

diegotrindade commented 4 years ago

Hi Frederick,

Sorry for the delay. Unfortunately, including a fig. caption did not work for me. However, I got a new error:

Error in x[i] <- sprintf("<a href=\"%s#%s\"", filenames[which.max(lines[lines <=  : 
  replacement has length zero
Calls: <Anonymous> ... <Anonymous> -> split_chapters -> restore_links -> lapply -> FUN
Please delete _main.Rmd after you finish debugging the error.
Execution halted

I tried to update bookdown and remove second-level headings as proposed here, it did not work though.

diegotrindade commented 4 years ago

Hi Frederick!

Sorry.. actually after deleting some _bookdown* folders, the fig.cap idea did work for me!

Thanks a lot.

Adeline-Lacroix commented 4 years ago

HI Frederick,

I'm having a similar error: Error running filter /Users/AdelineL/Library/R/3.6/library/papaja/lua/parse_metadata.lua: Error while trying to get a filter's return value from lua stack. Could not get Pandoc value: Could not get Meta value: Could not read value of key-value pair: Could not get MetaValue: Could not read list: Could not get Inline value: Unknown inline type: Para Erreur : pandoc document conversion failed with error 83

An I could not knit two of my document (just after having update papaja; it perfectly worked before). However, I have another document, with a similar YALM and it works. So, i suppose something is going wrong in the document but I don't know what... Could you help me?

Edit: interestingly, when I knit to a word document, there is no problem. The problem happen only with the pdf document

crsh commented 4 years ago

Thanks for reaching out. Could you post your YAML front matter or send it to me?

Adeline-Lacroix commented 4 years ago

Thanks for your answer.

Here is the YALM of the document which does not knit to pdf (but knit to word):

---
title             : "Title"
shorttitle        : "Shortitle"
author: 
  - name          : MyName
    affiliation   : 1
    corresponding : yes    # Define only one corresponding author
    address       : Myadress
    email         : Myemail
authornote: |

abstract: |
keywords          : "keywords"
wordcount         : "X"
figsintext: true
class: doc
link-citations: true
bibliography: [biblio.bib]
fontsize: 11pt
linestretch: 1.25
nocite: | 
  @R-base, @R-knitr, @R-rmarkdown, @R-tidyverse, @R-papaja
csl               : "apa.csl"
documentclass     : "apa7"
output:
  papaja::apa6_pdf:
    toc: false
    toc_depth: 3
    highlight: tango # css/github.css
    number_sections: false
    latex_engine: xelatex
header-includes:
  - \usepackage{float}
  - \floatplacement{figure}{H}
  - \usepackage{color}
editor_options: 
  chunk_output_type: console
---

Here is the one which does knit to pdf:

---
title             : "Title"
shorttitle        : "ShortTitle"
author: 
  - name          : Myname
    affiliation   : 1
    corresponding : yes    # Define only one corresponding author
    address       : Myadress
    email         : Myemail
#keywords          : "keywords"
#wordcount         : "X"
figsintext: true
class: doc
link-citations: true
bibliography: [biblio.bib]
fontsize: 11pt
linestretch: 1.25
nocite: | 
  @R-base, @R-knitr, @R-rmarkdown, @R-tidyverse, @R-papaja
output:
  papaja::apa6_pdf:
    toc: true
    toc_depth: 3
    highlight: tango # css/github.css
    number_sections: true
    latex_engine: xelatex
header-includes:
  - \usepackage{float}
  - \floatplacement{figure}{H}
editor_options: 
  chunk_output_type: console`
---
SessionInfo():

`R version 3.6.1 (2019-07-05)
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Running under: macOS Catalina 10.15.5

Matrix products: default
BLAS:   /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/3.6/Resources/lib/libRlapack.dylib

locale:
[1] fr_FR.UTF-8/fr_FR.UTF-8/fr_FR.UTF-8/C/fr_FR.UTF-8/fr_FR.UTF-8

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

loaded via a namespace (and not attached):
  [1] nlme_3.1-148         matrixStats_0.56.0   xts_0.12-0           threejs_0.3.3       
  [5] rstan_2.19.3         tools_3.6.1          backports_1.1.9      R6_2.4.1            
  [9] DT_0.13              colorspace_1.4-1     tidyselect_1.1.0     gridExtra_2.3       
 [13] prettyunits_1.1.1    processx_3.4.2       Brobdingnag_1.2-6    emmeans_1.4.7       
 [17] compiler_3.6.1       cli_2.0.2            shinyjs_1.1          sandwich_2.5-1      
 [21] colourpicker_1.0     scales_1.1.1         dygraphs_1.1.1.6     brms_2.13.0         
 [25] mvtnorm_1.1-1        ggridges_0.5.2       callr_3.4.3          stringr_1.4.0       
 [29] digest_0.6.25        StanHeaders_2.21.0-5 rmarkdown_2.3        base64enc_0.1-3     
 [33] pkgconfig_2.0.3      htmltools_0.5.0      fastmap_1.0.1        htmlwidgets_1.5.1   
 [37] rlang_0.4.7          rstudioapi_0.11      shiny_1.4.0.2        generics_0.0.2      
 [41] zoo_1.8-8            crosstalk_1.1.0.1    gtools_3.8.2         dplyr_1.0.2         
 [45] inline_0.3.15        magrittr_1.5         loo_2.2.0            bayesplot_1.7.2     
 [49] Matrix_1.2-18        Rcpp_1.0.4.6         munsell_0.5.0        fansi_0.4.1         
 [53] abind_1.4-5          lifecycle_0.2.0      stringi_1.4.6        multcomp_1.4-13     
 [57] yaml_2.2.1           MASS_7.3-51.6        pkgbuild_1.0.8       plyr_1.8.6          
 [61] grid_3.6.1           parallel_3.6.1       promises_1.1.1       crayon_1.3.4        
 [65] miniUI_0.1.1.1       lattice_0.20-41      splines_3.6.1        knitr_1.29          
 [69] ps_1.3.3             pillar_1.4.6         igraph_1.2.5         markdown_1.1        
 [73] estimability_1.3     shinystan_2.5.0      reshape2_1.4.4       codetools_0.2-16    
 [77] stats4_3.6.1         rstantools_2.0.0     glue_1.4.2           evaluate_0.14       
 [81] effsize_0.8.0        RcppParallel_5.0.1   vctrs_0.3.4          httpuv_1.5.4        
 [85] papaja_0.1.0.9997    gtable_0.3.0         purrr_0.3.4          assertthat_0.2.1    
 [89] ggplot2_3.3.2        xfun_0.16            mime_0.9             xtable_1.8-4        
 [93] coda_0.19-3          later_1.1.0.1        rsconnect_0.8.16     survival_3.2-3      
 [97] tibble_3.0.3         shinythemes_1.1.2    TH.data_1.0-10       ellipsis_0.3.1      
[101] bridgesampling_1.0-0`

(I m sorry, I don't know why but can't manage to have the code looks like code...)

crsh commented 4 years ago

Thanks. Does it work when you remove the empty authornote and abstract fields?

Adeline-Lacroix commented 4 years ago

thank you! It works indeed! Sorry for having disturbing you with that and thank you very much for your help !

crsh commented 4 years ago

Great, I'll leave this issue open as a reminder to improve the robustness of the Lua-filter that causes this problem for empty fields.

DominiqueMakowski commented 3 years ago

Hi @crsh, just for the record, we had the same error:

Error running filter C:/Users/Dom/Documents/R/win-library/3.6/papaja/lua/parse_metadata.lua:
Error while trying to get a filter's return value from lua stack.
Could not get Pandoc value: Could not get Meta value: Could not read value of key-value pair: Could not get MetaValue: Could not read list: Could not get Inline value: Unknown inline type: Para
Error: pandoc document conversion failed with error 83
Execution halted

Which got solved only once we deleted (removed completely) the "authornote" field. Even with an empty authornote: "" it didn't work


edit: unfortunately I cannot update from devel for some weird reasons (related to tinylabels?) I've battled and updated all the dependencies to no avail ^^ here's the log just in case you have an idea of what's going on

> remotes::install_github("crsh/papaja@devel")
Downloading GitHub repo crsh/papaja@devel
√  checking for file 'C:\Users\Dom\AppData\Local\Temp\RtmpABdK9g\remotes4a6041e8551b\crsh-papaja-ef14546/DESCRIPTION' ...
-  preparing 'papaja': (1.4s)
√  checking DESCRIPTION meta-information ... 
-  checking for LF line-endings in source and make files and shell scripts (395ms)
-  checking for empty or unneeded directories
-  building 'papaja_0.1.0.9997.tar.gz'

Installing package into ‘C:/Users/Dom/Documents/R/win-library/3.6’
(as ‘lib’ is unspecified)
* installing *source* package 'papaja' ...
** using staged installation
** R
** inst
** byte-compile and prepare package for lazy loading
Error: (converted from warning) package 'tinylabels' was built under R version 3.6.3
Execution halted
ERROR: lazy loading failed for package 'papaja'
* removing 'C:/Users/Dom/Documents/R/win-library/3.6/papaja'
* restoring previous 'C:/Users/Dom/Documents/R/win-library/3.6/papaja'
Error: Failed to install 'papaja' from GitHub:
  (converted from warning) installation of package ‘C:/Users/Dom/AppData/Local/Temp/RtmpABdK9g/file4a604cd84e9/papaja_0.1.0.9997.tar.gz’ had non-zero exit status
> 
crsh commented 3 years ago

Thanks for the feedback. With the continued lockdown here I'm having trouble allocating time to these half-solved issues. But it's on my radar and I'll try to address this as soon as I can.

CLRafaelR commented 3 years ago

The same problem as reported in the previous comment occurs when I use a 'line-break notation' as shown below:

authornote: |
  | Department of Long long title, Graduate School of Long and Long, The University of Looong
  | ID: 10-9283-4765

The error disappears when I remove the authornote field as @crsh suggested, but it's great if we can include the line break in the key of authornote.

crsh commented 3 years ago

@AdeLac74 @DominiqueMakowski @CLRafaelR

Sorry for the long wait. I finally found some time to look into this and wrestle with the Lua-filter. I think the latest changes on the devel branch should resolve your issues. If you are still interested I would be interested to know if this indeed resolves the issues you were having.

CLRafaelR commented 2 years ago

@crsh

Sorry for my late reply. I confirmed that now papaja produces a PDF file as desired when authornote field contains line-break symbols |. So, the problem I mentioned here is now resolved.

Also, I confirmed that the problem I previously posted on SO has been resolved and that now shorttitle field can contain non-ascii, CJK characters.

I greatly appreciate your work!!

crsh commented 2 years ago

Excellent, thanks for the feedback! 🙏

scottwalters commented 2 years ago

It looks like there are a few different things going on in here so maybe I should move to a new ticket. I found this searching for "Could not get Inline value: Unknown inline type: Para"" which seems to have matched https://github.com/crsh/papaja/issues/225#issuecomment-688673377 in here.

> sessionInfo()
R version 4.1.1 (2021-08-10)
Platform: x86_64-unknown-openbsd7.0 (64-bit)
Running under: OpenBSD fluffy.slowass.net 7.0 GENERIC.MP#14 amd64

Matrix products: default
BLAS:   /usr/local/lib/R/lib/libRblas.so.38.0
LAPACK: /usr/local/lib/R/lib/libRlapack.so.38.0

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

loaded via a namespace (and not attached):
[1] compiler_4.1.1 tools_4.1.1    tcltk_4.1.1  

Just updated to the latest dev version:

> devtools::install_github("crsh/papaja@devel")
Skipping install of 'papaja' from a github remote, the SHA1 (16f71b15) has not changed since last install.
  Use `force = TRUE` to force installation
> devtools::install_github("crsh/papaja@devel", force=T)
Downloading GitHub repo crsh/papaja@devel
These packages have more recent versions available.
It is recommended to update all of them.
Which would you like to update?

 1: All
 2: CRAN packages only 
 3: None
 4: withr     (2.4.2        -> 2.4.3       ) [CRAN]
 5: glue      (1.5.0        -> 1.5.1       ) [CRAN]
 6: digest    (0.6.28       -> 0.6.29      ) [CRAN]
 7: cpp11     (0.4.1        -> 0.4.2       ) [CRAN]
 8: stringi   (1.7.5        -> 1.7.6       ) [CRAN]
 9: backports (1.3.0        -> 1.4.0       ) [CRAN]
10: broom     (4516a8054... -> 9627d6153...) [GitHub]

Enter one or more numbers, or an empty line to skip updates: 1
...
â  building âpapaja_0.1.0.9997.tar.gzâ

* installing *source* package âpapajaâ ...
** using staged installation
** R
** inst
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
*** copying figures
** building package indices
** installing vignettes
** testing if installed package can be loaded from temporary location
** testing if installed package can be loaded from final location
** testing if installed package keeps a record of temporary installation path
* DONE (papaja)
>
Save workspace image? [y/n/c]: n

Like AdeLac74, I'm able to knit the document for docx but not pdf.

output            : papaja::apa6_pdf

Gives:

> rmarkdown::render("cs1104_paper.Rmd")

processing file: cs1104_paper.Rmd
  |..............                                                        |  20%
  ordinary text without R code

  |............................                                          |  40%
label: setup (with options) 
List of 1
 $ include: logi FALSE

Loading required package: tinylabels
  |..........................................                            |  60%
  ordinary text without R code

  |........................................................              |  80%
label: analysis-preferences
  |......................................................................| 100%
  ordinary text without R code

output file: cs1104_paper.knit.md

/usr/local/bin/pandoc +RTS -K512m -RTS cs1104_paper.knit.md --to latex --from markdown+autolink_bare_uris+tex_math_single_backslash+raw_attribute --output cs1104_paper.tex --lua-filter /usr/local/lib/R/library/bookdown/rmarkdown/lua/custom-environment.lua --lua-filter /usr/local/lib/R/library/rmarkdown/rmarkdown/lua/pagebreak.lua --lua-filter /usr/local/lib/R/library/rmarkdown/rmarkdown/lua/latex-div.lua --self-contained --highlight-style tango --pdf-engine pdflatex --include-in-header /usr/local/lib/R/library/papaja/rmarkdown/templates/apa6/resources/apa6_header_includes.tex --variable graphics --wrap preserve --csl /usr/local/lib/R/library/papaja/rmd/apa6.csl --citeproc --lua-filter /usr/local/lib/R/library/rmdfiltr/replace_ampersands.lua --lua-filter /usr/local/lib/R/library/rmdfiltr/wordcount.lua --lua-filter /usr/local/lib/R/library/papaja/lua/parse_metadata.lua --variable 'classoption:man' --variable 'lang:en-EN' --variable 'subparagraph:yes' --variable 'block-headings:no' --include-in-header /tmp/RtmpWhRlTJ/includes_53555a8ad34e.tex 
2904 words in text body
156 words in reference section
Error running filter /usr/local/lib/R/library/papaja/lua/parse_metadata.lua:
Error while trying to get a filter's return value from Lua stack.
PandocLuaError "Could not get Pandoc value: Could not get Meta value: Could not read value of key-value pair: Could not get MetaValue: Could not read list: Could not get Inline value: Unknown inline type: Para"
Error: pandoc document conversion failed with error 83
Execution halted

Running this without Rstudio, by the way. All other modules should be up to date as of about a month ago.

YAML part:

---
title             : "Speculative "
shorttitle        : "xxx"

author:
  - name          : "Scott Walters"
    affiliation   : "1"
    corresponding : no
    address       : ""
    email         : ""

affiliation:
  - id            : "1"
    institution   : "student"

authornote: "0006"

abstract: |
    foo

floatsintext      : no
figurelist        : no
tablelist         : no
footnotelist      : no
linenumbers       : yes
mask              : no
draft             : no

documentclass     : "apa6"
classoption       : "man"
output            : papaja::apa6_pdf 

---

That's a simplified test case. With apa6_docx, it seems to work fine.

I had it set to generate docx and ripped a lot out of the YAML before trying pdf. I'm sure I could retrace my steps and figure out what exact thing I did to make it not work. Maybe I accidentally made a stress test. Maybe that's all super wrong.

No inconvenience. Appreciate your work. Submitted in case it helpful as another example. Ideally I could flop between docx and pdf without concern but maybe there is a good reason I can't. Cheers.

crsh commented 2 years ago

Hi Scott, thanks for reaching out. I'm afraid I can't reproduce the issue using the YAML front matter you provide. It renders fine to PDF and DOCX for me. Are you using a recent RStudio version?

scottwalters commented 2 years ago

Hi Frederik,

Nope, I've been running this directly from R:

rmarkdown::render("cs1104_paper.Rmd")

It looks like the OpenBSD re-packaged R studio is based on rstudio-1.3.959 from https://openports.se/math/rstudio, which is definitely not current. Not sure if that matters still when run from the command line. All other modules are freshly updated, I think:

packages.txt

Let me see if I can build the latest R studio. Thanks for your reply.

crsh commented 2 years ago

Hi Scott, ultimately RStudio is irrelevant here, so don't spend any time on building it if you don't usually work with RStudio. The question really is if you are using a recent version of pandoc.

no-response[bot] commented 2 years ago

This issue has been automatically closed because there has been no response to our request for more information from the original author. With only the information that is currently in the issue, we don't have enough information to take action. Please reach out if you have or find the answers we need so that we can investigate further.

crsh commented 2 years ago

Sorry, reopening. Not sure why the bot is going nuts here.

no-response[bot] commented 2 years ago

This issue has been automatically closed because there has been no response to our request for more information from the original author. With only the information that is currently in the issue, we don't have enough information to take action. Please reach out if you have or find the answers we need so that we can investigate further.

alicemason commented 2 years ago

Hi - I'm having the same issue. I have several papers written using papaja and they were compiling fine. I had to reinstall everything on my computer and since that I am getting this error. The versions I've installed are newer than my previous ones but it seems from this thread that pandoc has been updated?