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

rjournal_article fails with plain pandoc code segment over Shaded undefined #185

Closed
eddelbuettel opened this issue Sep 4, 2018 · 5 comments
Milestone

Comments

@eddelbuettel
Copy link

eddelbuettel commented Sep 4, 2018

The rjournal template used to support plain pandoc blocks. It no longer does.

The following is a mvce log:

edd@rob:/tmp/rmarkdownbug$ Rscript -e 'rmarkdown::draft("mypaper.Rmd", template="rjournal_article", package="rticles", edit=TRUE)'
edd@rob:/tmp/rmarkdownbug$ cd mypaper/
edd@rob:/tmp/rmarkdownbug/mypaper$ ls
mypaper.Rmd  preamble.tex  RJournal.sty  RJreferences.bib  Rlogo.png
edd@rob:/tmp/rmarkdownbug/mypaper$ Rscript -e 'rmarkdown::render("mypaper.Rmd")'
Error: pandoc version 2.2 or higher is required and was not found (see the help page ?rmarkdown::pandoc_available).
Execution halted
edd@rob:/tmp/rmarkdownbug/mypaper$ Rscript -e 'rmarkdown::render("mypaper.Rmd")'


processing file: mypaper.Rmd
  |......................                                           |  33%
  ordinary text without R code

  |...........................................                      |  67%
label: unnamed-chunk-1
  |.................................................................| 100%
  ordinary text without R code


output file: mypaper.knit.md

/home/edd/bin/pandoc +RTS -K512m -RTS mypaper.utf8.md --to latex --from markdown+autolink_bare_uris+ascii_identifiers+tex_math_single_backslash --output mypaper.tex --template /usr/local/lib/R/site-library/r\
ticles/rmarkdown/templates/rjournal_article/resources/template.tex --highlight-style tango --pdf-engine pdflatex --include-in-header preamble.tex
/home/edd/bin/pandoc +RTS -K512m -RTS /tmp/RtmppOeUFb/file5c4b7f41fc3d.md --to markdown --output /tmp/rmarkdownbug/mypaper/RJwrapper.tex --template=/usr/local/lib/R/site-library/rticles/rmarkdown/templates/r\
journal_article/resources/RJwrapper.tex
! LaTeX Error: Environment Shaded undefined.

Error: Failed to compile RJwrapper.tex. See RJwrapper.log for more info.
Execution halted
edd@rob:/tmp/rmarkdownbug/mypaper$

Note that I used edit=TRUE to insert a simple

```sh
a=FOO ls
```

as a mock for a general pandoc code segment.

I tried the solution from #182 in both template.tex and RJwrapper.tex but to no avail.

(pandoc from ~/bin as you enforce pandoc 2.2 or later which my distro does not yet have.)

@eddelbuettel
Copy link
Author

eddelbuettel commented Sep 5, 2018

Took another look on the way in. What appears to be happening is that the

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

in template.tex ends up in the main paper.{Rmd,tex} body -- and that leads to a LaTeX error (of the "can only be used in preamble" when I add the missing defines from pandoc there.

So I think there is a still a bug here.

@eddelbuettel
Copy link
Author

Hm, I just tried with 0.4.1 and it fails there too. Using

```{sh, eval=FALSE}
a=FOO ls
```

works so I have a workaround. Would be nice to have plain pandoc working here too though.

@ivbsoftware
Copy link

ivbsoftware commented Sep 6, 2018

I am having the same issue. I've tried to update preamble.tex adding:

$if(highlighting-macros)$
$highlighting-macros$
$endif$

Those lines end up as a plain text below the abstract in the body of the PDF text. It looks that preamble.tex is not properly placed during the construction of the document.

@yihui yihui closed this as completed in 30ad0a6 Oct 9, 2018
@yihui yihui added this to the v0.6 milestone Oct 9, 2018
@yihui
Copy link
Member

yihui commented Oct 9, 2018

Should be fixed now. Thanks for the report!

@github-actions
Copy link

github-actions bot commented Nov 2, 2020

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 Nov 2, 2020
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

3 participants