rstudio / rticles

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

Arxiv submission may need \pdfoutput=1 in the preamble #469

Open bakaburg1 opened 2 years ago

bakaburg1 commented 2 years ago

Hello, as I reported in https://github.com/rstudio/rmarkdown/issues/2315, Arxiv sometimes fails to recognize a submitted document as a PDFLaTeX, consequently not showing the material in the final output; for example this happens if no images are linked in the .tex file. To force recognition by the arxiv system one has to add \pdfoutput=1 in the first 5 lines of the .tex file preamble (see https://arxiv.org/help/submit_tex).

The rticles::arxiv_article() template does not provide such option.

I suggest either adding \pdfoutput=1 at the beginning of the template or, if you think there could be reasons to use such options, conditioning the option to a flag in the YAML.

I can take care of it once agreed on the implementation.

cderv commented 2 years ago

Thanks for opening the issue here.

From the link you shared:

arXiv fully supports and automatically recognizes PDFLaTeX. You can ensure pdflatex processing by setting the flag \pdfoutput=1 within the first 5 lines of the preamble of the main .tex file. You should not need any other special flag.

I understand this should be added only when pdfLaTeX is used. What if another engine is used like xelatex or lualatex ? If this line is present, could it be problematic.

If this is conditional to pdflatex, we need to not include it all the time so:

Do you have some preference as a user on this ?

Thanks

bakaburg1 commented 2 years ago

Hi! definitely I would avoid option 1, since it's the less user friendly: people would either need to touch the package material, or do it on the generated .tex every time they create it.

Regarding the other two options I am not sure: from what I understand from the arxiv submission guidelines, if one file is submitted as pdflatex, also the other ones need to be submitted the same way:

TeX-based supplemental material should be included in the main document root directory, and will be compiled into the final output pdf. Both files must use the same TeX-engine (either both latex, both pdflatex, or both plain tex).

Also, arxiv automatically adds \pdfoutput=1 if non-vectorial figures are included into a .tex file.

So I guess users need to add \pdfoutput=1 manually in case a specific file has no pictures while the others do.

If you can foresee situations in which a user would want the pdflatex engine but not \pdfoutput=1, then option 2 could be preferable, otherwise option 3 is the best since it's transparent for users and would provide a default that works on arxiv without side effects (that I know of).

My only issue with option 3 is that I don't know how to setup pandoc template conditionals that check for a specific value, only if a value is present or not. But I guess you can help me with this right away.

cderv commented 2 years ago

Thanks.

Do you know if this would be harmful to add \pdfoutput=1 if the latex engine used is xelatex or lualatex ? If not then we could add the line uncommented in the template.

If we go with option 3 only for latex_engine = "pdflatex, I would do

This should be enough to add the value conditionally to latex_engine.

Hope it helps.

bakaburg1 commented 2 years ago

ok, in the meatime I'll ask the arxiv team whether it's safe to leave \pdfoutput=1 on by default.

bakaburg1 commented 2 years ago

Dear Cristophe,

after speaking with the Arxiv team I am in doubt whether to continue with this edit or not. Arxiv has somehow complex rules about how to decide which engine to use with each file.

The problem of unrendered files arises only when submitting multiple files, like the main manuscript plus supplementary materials, with the first being recognized as pdflatex while the rest are not. But the suppl. files usually are not generated through rticles::arxiv_article(), so the change would not affect them. Users will still need to add \pdfoutput=1 manually to these files.

So I'm starting to think that the proposed change would not really solve the problem.

cderv commented 2 years ago

Thanks for reaching out to them.

What are the supplementary material exactly ? It is other material or should be produced by rticles but currently are not ?

We could still add the line in the template with the comment like mdpi_article() so that it is there just in case.

Based on your experience, we should definitely document this in arxiv_article() help page IMO don't you think ?

bakaburg1 commented 2 years ago

In my view, the suppl. material is not necessarily generated by rticles::arxiv_article(). They are usually pdf documents with contents like extra tables and figures, extended explanations of methodology or results, and so on.

Thinking about it, we can definitely add the line to the template. But again I foresee the problem mostly arising in secondary .tex documents. Maybe it really made sense discussing this option in R markdown... (joking, don't hate me).

Anyway, whatever we do, it's definitely useful to add a disclaimer in the rticles::arxiv_article() help page stating that if arxiv parses the main .tex produced by rticles::arxiv_article() as pdflatex, they need to add \pdfoutput=1 to those which are not (arxiv shows the engine used for each file), otherwise they won't be rendered.

cderv commented 2 years ago

Maybe it really made sense discussing this option in R markdown... (joking, don't hate me).

If you think we should do something there, I am happy to reopen the other issue. I am not quite sure what should be done exactly. How are the supplementary material related to rmarkdown ? is it other document rendered with the default template in pdf_document ?

it's definitely useful to add a disclaimer in the rticles::arxiv_article()

Would you be ok to make a PR about that. I think it would be easier for you do document this with the correct wording. :)

bakaburg1 commented 2 years ago

By Arxiv guidelines, one can either submit either latex, HTML or even PDF but only if not generated from a latex file. In my case I generate the suppl material as .tex files using rmarkdown with pdf_document, setting the keep_tex as true.

I'll do the PR, I am creating a new template for another journal anyway!

davisjam commented 2 weeks ago

Just spent 90 minutes debugging something like this when submitting from Overleaf to arXiv. Adding \pdfoutput=1 to my main.tex file fixed. Haven't seen this before.