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

pandoc-crossref will fail if these commented out #273

Closed
sunt05 opened this issue Jan 31, 2020 · 11 comments
Closed

pandoc-crossref will fail if these commented out #273

sunt05 opened this issue Jan 31, 2020 · 11 comments

Comments

@sunt05
Copy link

sunt05 commented Jan 31, 2020

Just discovered your great work!
HUGE THANKS!!!

One issue identified if using pandoc with pandoc-crossref:

%$for(header-includes)$
%$header-includes$
%$endfor$

If these lines are commented out, then the headers by pandoc-crossref won't be correctly inserted.

@yihui
Copy link
Member

yihui commented Feb 4, 2020

There is a comment on the previous line:

% The "Technical instructions for LaTex" by Copernicus require _not_ to insert any additional packages.
%$for(header-includes)$
%$header-includes$
%$endfor$

Cc the template author @nuest (#172). I'm not the expert here.

@nuest
Copy link
Contributor

nuest commented Apr 22, 2020

Copernicus discourages adding any additional packages, see https://publications.copernicus.org/for_authors/manuscript_preparation.html

image

IIRC correctly that is why is disabled that option for authors, however, I was not aware that the pandoc-crossref filter would be impacted by that.

@sunt05 Can you please provide a reproducible example so I can take a closer look? Thanks!

@cderv
Copy link
Collaborator

cderv commented Aug 17, 2020

@sunt05 friendly ping here 😄
Can you provide a reproducible example for @nuest ?

@sunt05
Copy link
Author

sunt05 commented Aug 18, 2020

Thanks @cderv for the reminder! 😅
Sorry about the delay: as it's been a while since I tested the templated, I needed a bit longer to re-pick this up.

Now please test the template with files in this repo:
https://github.com/sunt05/test-r-template

issue

if the above mentioned lines are commented out as instructed by Copernicus, the following issue would appear:

Error producing PDF.
! You can't use `\spacefactor' in vertical mode.
\@->\spacefactor 
                 \@m {}
l.77 \@

@cderv
Copy link
Collaborator

cderv commented Aug 18, 2020

It seems you are not using rticles and rmarkdown R 📦 to render your document. Is it just for the example or are you always using template this way ?

I believe the tex template are best used with those 2 packages package: rmarkdown::render() function and rticles::copernicus_article() format .

@sunt05
Copy link
Author

sunt05 commented Aug 18, 2020

It seems you are not using rticles and rmarkdown R 📦 to render your document. Is it just for the example or are you always using template this way ?

I'm always using it this way: i.e., with pandoc, as I found the templates could be easily adapted for broader applicability with more generic markdown-based tools, e.g., pandoc

I believe the tex template are best used with those 2 packages package: rmarkdown::render() function and rticles::copernicus_article() format .

Sorry that if this issue looks off-topic: please feel free to close it.

@cderv
Copy link
Collaborator

cderv commented Aug 18, 2020

I'm always using it this way: i.e., with pandoc, as I found the templates could be easily adapted for broader applicability with more generic markdown-based tools, e.g., pandoc

You may already know but rmarkdown also use pandoc for conversion.

I believe the issue you get if from converting directly using the template. I did not identify why yet but I don't get the same tex file after pandoc conversion from the command line or using rmarkdown::render. That means some things is happening when using Rmarkdown that you need to reproduce using pandoc;

@sunt05
Copy link
Author

sunt05 commented Aug 18, 2020

I believe the issue you get if from converting directly using the template. I did not identify why yet but I don't get the same tex file after pandoc conversion from the command line ...

Did you use the following line to reproduce the error?

pandoc -f markdown+tex_math_single_backslash -o Manuscript.pdf --pdf-engine=pdflatex --template=template.tex --filter=pandoc-crossref test.md

Please note the template.tex file is a modified version, which can successfully produce a PDF.

I just update the repo with more description to reproduce the error as mentioned above:

pandoc -f markdown+tex_math_single_backslash -o Manuscript.pdf --pdf-engine=pdflatex --template=template_orig.tex --filter=pandoc-crossref test.md

Sorry about any confusion I might have brought up.

@cderv
Copy link
Collaborator

cderv commented Aug 18, 2020

I can reproduce using your command. But I cannot reproduce if I use rmarkdown and rticles directly.
and I believe this comes from pandoc-crossref that you are using.

pandoc-crossref is doing some stuff with the header-includes part, see https://github.com/lierdakil/pandoc-crossref/blob/master/lib/Text/Pandoc/CrossRef/Util/ModifyMeta.hs

So I don't think it likes this template that have this part commented. This is a compatibility issue with pandoc-crossref I believe.

Best thing to do here is to use your own template I think

@sunt05
Copy link
Author

sunt05 commented Aug 18, 2020

Thanks for the discussion and help! @cderv

I'll use the templates more wisely with pandoc-crossref 😃

@sunt05 sunt05 closed this as completed Aug 18, 2020
@github-actions
Copy link

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.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 15, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants