rstudio / rticles

LaTeX Journal Article Templates for R Markdown
https://pkgs.rstudio.com/rticles/
1.47k stars 518 forks source link

Copernicus Journal article - markdown file processing hangs #331

Closed RLumSK closed 3 years ago

RLumSK commented 3 years ago

Problem in brief

When trying to build the PDF using the Copernicus Journal template, the markdown process hangs and never completes. A process running in the back at a 100 % is pdftex, no error message is shown. Other templates I have tested The R Journal and the Elsevier work though. The problem might be related to pdftex itself and not directly to rticles, see details below.

How to reproduce

Prerequisites (more details in the background)

Example

RStudio >> File >> New File >> R Markdown >> [From Template] >> [Select Copernicus Journal Article] >> [OK] >> [Hit the Knit button]

A reduced markdown example using the Copernicus template and showing the problem reads:

---
title: Template for preparing your manuscript submission to Copernicus journals using RMarkdown
journal: "`r rticles::copernicus_journal_abbreviations(journal_name = 'communication')`"
bibliography: sample.bib
running:
  title: R Markdown Template for Copernicus
  author: Nรผst et al.
output:
  rticles::copernicus_article: default
  bookdown::pdf_book:
    base_format: rticles::copernicus_article # for using bookdown features like \@ref()
---

Read [@Feynman1963118]

Background information

I bumped into that problem out of a sudden, while trying to rebuild a manuscript I am currently working on. I could not recall that I had changed something that might explain the behavior. After a couple of hours of digging and testing, I narrowed down the issue. Here the bullet points:

Finally, I am not sure whether this is a real rticles problem (or tinytex). Nevertheless, I decided to post it here because I encountered the bug when I used the Copernicus template from rticles with rticles. So if other people bump into the same problem, it is likely that they will start from here.

Unfortunately, the bug is not easy to fathom because no error message is shown. But perhaps my report helps to get to the bottom of it.

Session output

R Under development (unstable) (2020-10-12 r79333)
Platform: x86_64-apple-darwin17.0 (64-bit)
Running under: macOS Catalina 10.15.7, RStudio 1.4.904

Locale: en_GB.UTF-8 / en_GB.UTF-8 / en_GB.UTF-8 / C / en_GB.UTF-8 / en_GB.UTF-8

Package version:
  base64enc_0.1.3 digest_0.6.25   evaluate_0.14   glue_1.4.2     
  graphics_4.1.0  grDevices_4.1.0 highr_0.8       htmltools_0.5.0
  jsonlite_1.7.1  knitr_1.30      magrittr_1.5    markdown_1.1   
  methods_4.1.0   mime_0.9        rlang_0.4.8     rmarkdown_2.4  
  rticles_0.16    stats_4.1.0     stringi_1.5.3   stringr_1.4.0  
  tinytex_0.26    tools_4.1.0     utils_4.1.0     xfun_0.18      
  yaml_2.2.1    

By filing an issue to this repo, I promise that

I understand that my issue may be closed if I don't fulfil my promises.

cderv commented 3 years ago

Thanks for the detailed report! I can reproduce this. I don't really what happening. Ping @nuest here as template contributor.

Finally, I am not sure whether this is a real rticles problem (or tinytex).

I don't think this is rticles and tinytex is just installing TeX Live infrastructure. To get to the bottom of it, one should try to see if the Copernicus template has been updated : https://publications.copernicus.org/for_authors/manuscript_preparation.html

Maybe you already tried ?

nuest commented 3 years ago

Unfortunately, I cannot reproduce the problem on my system (see below). I am only using tinytex.

TBH, the error messages to me do not look like there is any problem with the template, but as you point out, some problem with TexLive 2020 on Mac. Sorry, can't be of much help there, but happy to look at log files and see if something jumps out.

> sessionInfo()
R version 4.0.3 (2020-10-10)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 20.04 LTS

Matrix products: default
BLAS:   /usr/lib/x86_64-linux-gnu/openblas-pthread/libblas.so.3
LAPACK: /usr/lib/x86_64-linux-gnu/openblas-pthread/liblapack.so.3

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C               LC_TIME=de_DE.UTF-8        LC_COLLATE=en_US.UTF-8    
 [5] LC_MONETARY=de_DE.UTF-8    LC_MESSAGES=en_US.UTF-8    LC_PAPER=de_DE.UTF-8       LC_NAME=C                 
 [9] LC_ADDRESS=C               LC_TELEPHONE=C             LC_MEASUREMENT=de_DE.UTF-8 LC_IDENTIFICATION=C       

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

other attached packages:
[1] tinytex_0.26.3 rticles_0.16  

loaded via a namespace (and not attached):
 [1] compiler_4.0.3  bookdown_0.20   htmltools_0.5.0 tools_4.0.3     yaml_2.2.1      rmarkdown_2.4   knitr_1.30     
 [8] xfun_0.18       digest_0.6.25   rlang_0.4.8     evaluate_0.14
cderv commented 3 years ago

I am only using tinytex.

Did you upgrade before trying ? Can you share the versions you are using ?

> tinytex::tlmgr("--version")
tlmgr --version
tlmgr revision 56566 (2020-10-06 05:40:54 +0200)
tlmgr using installation: C:/Users/chris/AppData/Roaming/TinyTeX
TeX Live (https://tug.org/texlive) version 2020
and package versions ```r > tinytex::tlmgr('info --list --only-installed --data "name,cat-version"') tlmgr info --list --only-installed --data "name,cat-version" ae,1.4 amscls,2.20.6 amsfonts,3.04 amsmath, atbegshi,1.19 atveryend,1.11 auxhook,1.6 babel,3.50 babel-english,3.3r bibtex,0.99d bibtex.win32, bigintcalc,1.5 bitset,1.3 booktabs,1.61803398 caption, cleveref,0.21.4 cm, comment,3.8 dehyph, dvipdfmx, dvipdfmx.win32, dvips, dvips.win32, ec,1.0 epstopdf-pkg,2.11 etex, etexcmds,1.7 etoolbox,2.5k euenc,0.1h fancyvrb,3.6 filehook,0.8a float,1.3d fontawesome,4.6.3.2 fontawesome5,5.13.0 fontspec,2.7i framed,0.96 geometry,5.9 gettitlestring,1.6 glyphlist, graphics, graphics-cfg, graphics-def, grfext,1.3 grffile,2.1 helvetic, hycolor,1.10 hyperref,7.00e hyph-utf8, hyphen-base, iftex,1.0d inconsolata,1.121 infwarerr,1.5 intcalc,1.3 knuth-lib, kpathsea, kpathsea.win32, kvdefinekeys,1.6 kvoptions,3.14 kvsetkeys,1.18 l3backend, l3kernel, l3packages, lastpage,1.2m latex,2020-10-01-PL1 latex-amsmath-dev,2020-10-01 pre-release 2 latex-bin, latex-bin.win32, latex-fonts, latex-tools-dev,2020-10-01 pre-release 5 latexconfig, latexmk,4.70b latexmk.win32, letltxmacro,1.6 lineno,4.41 listings,1.8d lm,2.004 lm-math,1.959 ltxcmds,1.25 lua-alt-getopt,0.7.0 luahbtex, luahbtex.win32, lualatex-math,1.9 lualibs,2.72 luaotfload,3.15 luaotfload.win32, luatex, luatex.win32, mdwtools,1.05.4 metafont,2.7182818 metafont.win32, mfware, mfware.win32, microtype,2.7d modes,4.2 multirow,2.5 natbib,8.31b oberdiek, pdfescape,1.15 pdftex, pdftex.win32, pdftexcmds,0.33 plain,3.141592653 psnfss,9.3 refcount,3.6 rerunfilecheck,1.9 scheme-infraonly, soul,2.4 stringenc,1.12 symbol, tex,3.14159265 tex-ini-files, tex.win32, texlive-scripts, texlive-scripts.win32, texlive.infra, texlive.infra.win32, thmtools,72 threeparttable, times, tipa,1.3 tlgs.win32, tlperl.win32, tlpsv.win32, tools, ulem, unicode-data,1.13 unicode-math,0.8q uniquecounter,1.4 url,3.4 urlbst,0.8 urlbst.win32, xcolor,2.12 xetex, xetex.win32, xetexconfig, xkeyval,2.7a xstring,1.83 xunicode,0.981 zapfding, ```
RLumSK commented 3 years ago

Wow, thank you, @cderv, and @nuest for the quick replies. Regarding the question

Maybe you already tried?

Indeed, at least I tried a couple of rticles versions from the CRAN archive, in particular the one before the last update of the Copernicus template. To be certain, before answering here, I downloaded the latest version as suggested by @cderv: Either way, the same result.

Still, I admit that I do not fully understand what tinytex (the R package) does in the back with TinyTeX (the LaTeX distribution). Because the last time the Copernicus template worked for me was somewhat the end of August, then I came back to my manuscript yesterday (the reported problem). I did not update TeXLive in between, but certainly tinytex (the R package). The version working for me reads (because I used tinytex::uninstall_tinytex() and switched back to TeXLive 2019):

> tinytex::tlmgr("--version")
tlmgr --version
tlmgr revision 52931 (2019-11-27 00:04:18 +0100)
tlmgr using installation: /usr/local/texlive/2019
TeX Live (http://tug.org/texlive) version 2019

Furthermore:

  1. As @nuest suggested, I double-check the system logs whether something shows up. I did not find anything, pdftex runs and runs but does not throw a message.
  2. I also tried to understand what changed in pdftex between the last versions. To me, it does not appear to be suspicious, but maybe you see something: https://www.tug.org/applications/pdftex/NEWS

Perhaps, as @nuest wrote, it is an odd Mac-only problem. I just hoped that there might be something we could modify in the Copernicus template because it does not appear to be a general problem with TeXLive 2020 on macOS (I might be wrong).

Anyway, if nothing can be done for the moment, perhaps we just keep an eye on it because I believe I will not be the last user with this particular problem (even it is not a real rticles or tinytex issue).

cderv commented 3 years ago

I reproduced it on Windows so it is not only MacOs. pdflatex hang on the system with no message printed.

I do not fully understand what tinytex

tinytex is an R package that does mainly two things:

You can ready more on the distribution here: https://yihui.org/tinytex/ and the R package here: https://yihui.org/tinytex/r/

Regarding TeX Live,

TinyTeX is a lightweight, cross-platform, portable, and easy-to-maintain LaTeX distribution based on TeX Live.

So if something wrong with a TeX Live update, it will be also the case with TinyTeX.

Is copernicus bound to be used with pdflatex engine ? Or lualatex or xelatex could be considered ?

The version working for me reads (because I used tinytex::uninstall_tinytex() and switched back to TeXLive 2019):

This may also comes from a TeX package and not tlmgr itself.

RLumSK commented 3 years ago

I guess this issue bothered me more than I thought, so I dug deeper. The problem can be narrowed down to the following line:

https://github.com/rstudio/rticles/blob/b0bbbc0a31c59952f4eab92e3df114cdc1aeed5b/inst/rmarkdown/templates/copernicus/skeleton/copernicus.cls#L1726

If I remove the line, the problem goes away, and everything works again with TeXLive 2020.

Having said this: The problem seems to be related purely to LaTeX (I guess this was already clear) and the Copernicus template ( copernicus.cls). Whether this is some bug in the CLS-file or an effect caused by an intentional modification or another bug within TeXLive 2020 or any package in it ... I cannot tell.

@nuest Perhaps you can get in touch with Copernicus? I guess the responsible person there would understand better what really happens and whether it needs to be reported as a bug to somebody else, or Copernicus has to modify their CLS-file? (I would have done it myself, but I did not want to interfere with you as maintainer of the Copernicus template).

Additional information: I also found something reported recently in the TeXLive mailing list. I carefully read through it and concluded that this might be just a coincidence, but perhaps I have overlooked something.

cderv commented 3 years ago

@RLumSK there is a contact in the Copernicus Journal page for Manuscript preparation: https://publications.copernicus.org/for_authors/manuscript_preparation.html Maybe you could contact her and explain the issue ?

RLumSK commented 3 years ago

@cderv As written, I did not want to interfere with @nuest as template maintainer. But sure, as you suggested, I dropped an email at Copernicus and I will let you know the outcome.

cderv commented 3 years ago

Oh ok. I just assumed @nuest wouldn't mind ๐Ÿ˜„ Hope I assumed well... ๐Ÿ™„ And thank you for your help ! Waiting for some news then !

RLumSK commented 3 years ago

I already received a very quick and super friendly response from Copernicus, I may (partly) quote here:

We are already aware of this problem and we already try to solve this issue by adjusting our .cls file. This LaTeX update released in October 2020 contains changes in the kernel and that makes it more complicated. Please try to add this line to your TeX file before the other content starts: \RequirePackage[2020/02/02]{latexrelease}

I tried that and it works. Means, I could just modify the template by adding the line until we have a better copernicus.cls available. But since there is, regardless of it, already another, newer version of the Copernicus template available we should also update both a the same time.

Do you want me to create a PR or should we leave that to @nuest?

In the case we leave it to @nuest: The line \RequirePackage[2020/02/02]{latexrelease} needs to be added before the line \documentclass[gc, manuscript]{copernicus}

cderv commented 3 years ago

That is awesome! So this is the same kind of issue than #329 for the jss.cls class.

Do you want me to create a PR ?

You can definitly open a PR, and there can be several contributor to a template.

As explained in the README, rticles format are mainly community contributed and we (as maintener of the package) can't keep track of all the details for all the templates, so we rely on the community to help on specific issues regarding template. We keep track of whom contributed for the purpose of pingging the right user if an issue arise on a specific template. And that is what we did with @nuest here ๐Ÿ˜„

It is indeed better to have several people, so feel free to send a PR for updating the template and we will add you as contributor too. @nuest would help us review the PR as he knows the template.

Thanks a lot @RLumSK !

RLumSK commented 3 years ago

Ok, sure, give me a few moments I will create a PR also with the updated template.

cderv commented 3 years ago

Thanks @RLumSK for investigating and providing the fix!

nuest commented 3 years ago

@RLumSK Thanks for resolving this issue - it's great to have someone else help out with this template! Sorry I was late for the PR review, but all seems very much in order.

RLumSK commented 3 years ago

@nuest Actually, thank you for all your work! I used this template already a lot and found that it is incredibly well prepared and documented. Besides, I just stepped in because I needed to have the template running up again for myself. But I will keep an eye on it also in the future. Having said that, Copernicus promised me a notification as soon as the new template with a real fix for the LaTeX issue becomes available; means we might have another update very soon.

cderv commented 3 years ago

Having said that, Copernicus promised me a notification as soon as the new template with a real fix for the LaTeX issue becomes available; means we might have another update very soon.

Awesome ! Keep us udpated then. And thank you !!

RLumSK commented 3 years ago

Today at 06:50 h I received a new CLS-file for testing via email. It looks good (also for TeXLive 2019) and works again without the fix provided the last time. I suggest that we wait for the official release on the Copernicus website though (should happen very soon).

RLumSK commented 3 years ago

The new template version was released today by Copernicus. @nuest perhaps you want to double-check(?). It basically includes only a new CLS-file. I removed the intermediate fix from the TEX-file.

github-actions[bot] commented 3 years ago

This old thread has been automatically locked. If you think you have found something related to this, please open a new issue by following the issue guide (https://yihui.org/issue/), and link to this old issue if necessary.