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

Provide latex_extension option when compling PDF #687

Closed
hongyuanjia opened this issue Mar 11, 2019 · 4 comments
Closed

Provide latex_extension option when compling PDF #687

hongyuanjia opened this issue Mar 11, 2019 · 4 comments
Milestone

Comments

@hongyuanjia
Copy link

hongyuanjia commented Mar 11, 2019

In bookdown, basically, I want to preserve Chinese quotation marks in the PDF output. This is related to https://stackoverflow.com/questions/52052231/how-to-write-chinese-quotes-in-bookdown

The reason why adding md_extensions: -smart did not work is that in pandoc, smart extension is enabled for latex by default, no matter latex is the input or output.

pandoc --version
# pandoc 2.6
# Compiled with pandoc-types 1.17.5.4, texmath 0.11.2, skylighting 0.7.6
# Default user data directory: /home/hongyuanjia/.pandoc
# Copyright (C) 2006-2019 John MacFarlane
# Web:  http://pandoc.org
# This is free software; see the source for copying conditions.
# There is no warranty, not even for merchantability or fitness
# for a particular purpose.

pandoc --list-extensions=latex | grep "smart"
# +smart

So the only way to achieve this is to disable the smart extension both for markdown and latex.

echo "“”" | pandoc -f markdown-smart -t latex
# ``''

echo "“”" | pandoc -f markdown-smart -t latex-smart
# “”

However, in bookdown, the PDF is compiled using pandoc with only "-t latex", and there is no such latex_extension option to modify latex extension in pandoc.

@hongyuanjia hongyuanjia changed the title Provide latex_extension options when compling PDF Provide latex_extension option when compling PDF Mar 11, 2019
@yihui
Copy link
Member

yihui commented May 9, 2019

Please try the dev version of rmarkdown (remotes::install_github('rstudio/rmarkdown')), in which I have added an argument output_extensions. Example usage:

output:
  bookdown::pdf_book:
    md_extensions: -smart
    output_extensions: -smart

@yihui yihui added this to the v0.10 milestone May 9, 2019
@hongyuanjia
Copy link
Author

Thanks, @yihui. I can confirm that this has been fixed using the development version of rmarkdown.

@yihui
Copy link
Member

yihui commented May 9, 2019

Perfect. Thanks for letting me know!

yihui added a commit to apreshill/rmarkdown that referenced this issue Jun 26, 2019
…pdf_document() to enable/disable Pandoc output extensions
@github-actions
Copy link

github-actions bot commented Nov 6, 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 6, 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

2 participants