quarto-dev / quarto-cli

Open-source scientific and technical publishing system built on Pandoc.
https://quarto.org
Other
3.7k stars 301 forks source link

Incorrect Quotes in PDF Bookmark Using Quarto Despite Correct Output with Pandoc #7965

Open TomBener opened 8 months ago

TomBener commented 8 months ago

Bug description

I’ve encountered an issue where the PDF bookmarks generated by Quarto are incorrect, despite Pandoc creating the correct bookmarks when using the same Markdown source file.

Steps to reproduce

The content of my Markdown file test.md is as follows:

# "One" Heading

Some texts here.

# Pandoc's Features

# Quarto's Features

Using Pandoc

I generated a PDF using the following Pandoc command:

pandoc --pdf-engine=xelatex test.md -o test.pdf

This command produced a PDF file with the correct bookmarks, where the quotes in the headings were consistent with the main body.

CleanShot 2023-12-19 at 17 20 05@2x

Using Quarto

When I rendered the PDF using Quarto with this command:

quarto render test.md --to pdf

The resulting PDF had incorrect bookmarks that the quotes in the headings were inconsistent with the main body.

CleanShot 2023-12-19 at 17 19 31@2x

Expected behavior

I expect the PDF generated by Quarto to have the same correct bookmarks as the one generated with Pandoc. There is a related issue https://github.com/jgm/pandoc/issues/5812.

Your environment

Quarto check output

Quarto 1.4.528 [✓] Checking versions of quarto binary dependencies... Pandoc version 3.1.9: OK Dart Sass version 1.69.5: OK Deno version 1.37.2: OK [✓] Checking versions of quarto dependencies......OK [✓] Checking Quarto installation......OK Version: 1.4.528 Path: /Applications/quarto/bin

[✓] Checking tools....................OK TinyTeX: (not installed) Chromium: (not installed)

[✓] Checking LaTeX....................OK Using: Installation From Path Path: /Library/TeX/texbin Version: 2023

[✓] Checking basic markdown render....OK

[✓] Checking Python 3 installation....OK Version: 3.10.10 Path: /Users/username/.pyenv/versions/3.10.10/bin/python3 Jupyter: 5.5.0 Kernels: python3

[✓] Checking Jupyter engine render....OK

[✓] Checking R installation...........OK Version: 4.3.2 Path: /opt/homebrew/Cellar/r/4.3.2/lib/R LibPaths:

[✓] Checking Knitr engine render......OK

cderv commented 8 months ago

Thanks for connection the issues. I believe the difference (as explained in the linked issue https://github.com/jgm/pandoc/issues/5812#issuecomment-1687467727) is that when Pandoc does render to PDF, they deactivate the -smart extension.

I believe this all comes from this issue in hyperref

I don't think there is a good solution. There are some workaround in this thread (https://tex.stackexchange.com/questions/592335/wrong-double-quotes-in-pdf-bookmarks)

We could do the same as Pandoc and deactivate -smart extensions before PDF rendering but maybe some other content may be impacted.

Not sure what else could be done at the Quarto until the hyperref issue is fixed

And currently, disabling latex-smart for pdf rendering is not possible I think... (tracked in https://github.com/quarto-dev/quarto-cli/issues/7966)

TomBener commented 8 months ago

@cderv Thanks for your solution. This indeed an annoying problem. Despite there are potential problems when smart extension is disabled, Pandoc does disable it by default. Does Quarto currently have an option to disable smart extension for rendering PDF like Pandoc? If not, I think it is a good idea to add such an option.

cderv commented 8 months ago

Does Quarto currently have an option to disable smart extension for rendering PDF like Pandoc? If not, I think it is a good idea to add such an option.

As I mentioned in my last comment, I don't think Quarto has it yet