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

render('foo.Rmd',beamer_presentation(citation_package = 'natbib')) failing... #1161

Closed
JeffreyRacine opened this issue Oct 19, 2017 · 7 comments · Fixed by #1164
Closed

render('foo.Rmd',beamer_presentation(citation_package = 'natbib')) failing... #1161

JeffreyRacine opened this issue Oct 19, 2017 · 7 comments · Fixed by #1164
Labels
bug an unexpected problem or unintended behavior
Milestone

Comments

@JeffreyRacine
Copy link

JeffreyRacine commented Oct 19, 2017

Greetings, and let me thank you in advance for your incredible work.

RStudio 1.1.383, rmarkdown 1.6.0.9000, R 3.4.2, macOS High Sierra 10.13...

I am having issues with bibtex and beamer and the following reproduces. Running

render('debug.Rmd',beamer_presentation(citation_package = 'none'))

produces a PDF file and all goes well... this uses --output=pdf as in

/usr/local/bin/pandoc +RTS -K512m -RTS debug.utf8.md --to beamer --from markdown+autolink_bare_uris+ascii_identifiers+tex_math_single_backslash --output debug.pdf --highlight-style tango --latex-engine /opt/local/bin/pdflatex

Replacing 'none' with 'biblatex' or 'natbib' (which are two of the three options) fails... it produces a tex file without the requisite headers and fails to generate the PDF... to reproduce this I used the default skeleton beamer file generated in RStudio...

/usr/local/bin/pandoc +RTS -K512m -RTS debug.utf8.md --to beamer --from markdown+autolink_bare_uris+ascii_identifiers+tex_math_single_backslash --output debug.tex --highlight-style tango --latex-engine /opt/local/bin/pdflatex --biblatex
Latexmk: This is Latexmk, John Collins, 19 Jan. 2017, version: 4.52c.
Latexmk: applying rule 'pdflatex'...
Rule 'pdflatex': File changes, etc:
   Non-existent destination files:
      'debug.pdf'
------------
Run number 1 of rule 'pdflatex'
------------
------------
Running '/opt/local/bin/pdflatex  -halt-on-error -interaction=batchmode -recorder  "debug.tex"'
------------
This is pdfTeX, Version 3.14159265-2.6-1.40.18 (TeX Live 2017/MacPorts 2017_2) (preloaded format=pdflatex)
 restricted \write18 enabled.
entering extended mode
=== TeX engine is 'pdfTeX'
Latexmk: Errors, so I did not complete making targets
Collected error summary (may duplicate other messages):
  pdflatex: Command for 'pdflatex' gave return code 1
      Refer to 'debug.log' for details
Latexmk: Use the -f option to force complete processing,
 unless error was exceeding maximum runs of latex/pdflatex.
! LaTeX Error: Missing \begin{document}.

Error: Failed to compile debug.tex. See debug.log for more info.
Execution halted
@JeffreyRacine JeffreyRacine reopened this Oct 19, 2017
@yihui yihui added the bug an unexpected problem or unintended behavior label Oct 19, 2017
@yihui yihui added this to the v1.7 milestone Oct 19, 2017
@yihui
Copy link
Member

yihui commented Oct 19, 2017

Adding the --self-contained argument should fix it, e.g.

output: 
  beamer_presentation: 
    citation_package: natbib
    pandoc_args: "--self-contained"

I'll fix it in the package. Thanks for the report!

@JeffreyRacine
Copy link
Author

Thanks! I am having a similar issue with gitbook... it seems to ignore citation_package: natbib while pdf_book acknowledges it... here is my _output.yml file (I realize this is a bookdown issue but perhaps related?):

bookdown::pdf_book:
  includes:
    in_header: preamble.tex
  latex_engine: xelatex
  citation_package: natbib
  keep_tex: yes
  dev: tikz
  toc_depth: 3
bookdown::gitbook:
  dev: tikz
  citation_package: natbib
  config:
    toc:
      collapse: section
      before: |
        <li><a href="https://socserv.mcmaster.ca/racinej/768/index.html" target="blank"> ECON 768 - Fall 2017 </a></li>
      after: |
        <li><a href="https://bookdown.org/yihui/bookdown/" target="blank"> Written in R Markdown & bookdown</a></li>
    sharing: no
    self.contained: yes
    split_by: none

@yihui
Copy link
Member

yihui commented Oct 19, 2017

citation_package is only an option for LaTeX/PDF output formats; natbib / biblatex are LaTeX packages, and won't work for non-LaTeX output formats.

@JeffreyRacine
Copy link
Author

Thanks.

I realize this is off topic, but the citations in gitbook are formatted in an unwanted way, reporting what I expect to look like Black and White (1979) as A. Black and White (1979)... I have searched high and low for a while now and not found a solution that would render cites in gitbook like natbib in pdf_book....

Thanks!

@yihui
Copy link
Member

yihui commented Oct 19, 2017

I have never tried (and I don't care the citation styles for non-LaTeX output) but --csl should be the way to go for formatting bibliography in non-LaTeX output formats: http://pandoc.org/MANUAL.html#citations

If you have further questions instead of bug reports or feature requests, so please do me a favor to ask on StackOverflow instead. Currently I'm the only person working on Github issues of this repo, so I cannot afford too much time here. Your original issue has been fixed by #1164. Thanks!

@JeffreyRacine
Copy link
Author

Thanks, apologies, and will do. Thanks again for you incredible creative efforts.

@github-actions
Copy link

github-actions bot commented Nov 3, 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 3, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug an unexpected problem or unintended behavior
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants