Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
bakaburg1 opened this issue Mar 2, 2022 · 9 comments
Open

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

bakaburg1 opened this issue Mar 2, 2022 · 9 comments

Comments

@bakaburg1
Copy link

Hello, as I reported in rstudio/rmarkdown#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
Copy link
Collaborator

cderv commented Mar 3, 2022

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:

  • We could do like for mdpi_article and add the line as comment in tex file
    % The following line should be uncommented if the LaTeX file is uploaded to arXiv.org
    %\pdfoutput=1

    this would mean author would need to uncomment in the tex file beofre submission to ArXiV
  • We could add a YAML field so that author can add the line from a YAML flag, which would trigger a if in the template.
  • If the engine relationship is correct, we could to this automatically for latex_engine = pdflatex by activating the Pandoc variable to trigger the if inclusion in the template.

Do you have some preference as a user on this ?

Thanks

@bakaburg1
Copy link
Author

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
Copy link
Collaborator

cderv commented Mar 3, 2022

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

  • Add latex_engine argument to the function arxiv_article defaulting to pdflatex (as rmarkdown::pdf_document()).
  • Check this value in arxiv_article and if latex_engine == "pdflatex" then use rmarkdown::pandoc_variable_arg() to set a variable to true, named for example pdfoutput. This would be passed as an argument to Pandoc using pandoc_args in the R function pdf_document_format. See example in ajs_article() code
  • In the template add something like
$if(pdfoutput)$\pdfoutput=1$endif$
```
a the top of the template. 

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

Hope it helps. 

@bakaburg1
Copy link
Author

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

@bakaburg1
Copy link
Author

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
Copy link
Collaborator

cderv commented Mar 3, 2022

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
Copy link
Author

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
Copy link
Collaborator

cderv commented Mar 3, 2022

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
Copy link
Author

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants