Skip to content

Feature request: Option to preserve internal LaTeX template or make standalone match direct PDF generation #10725

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

Open
gabiteodoru opened this issue Mar 24, 2025 · 3 comments

Comments

@gabiteodoru
Copy link

gabiteodoru commented Mar 24, 2025

I'm writing this as a feature request as I don't know if the intentional design is that

  1. .md --pandoc--> pdf
    has identical behavior to
  2. .md --pandoc -s --> .tex --xelatex--> pdf

I just run into a case where it is not: For ––〃–– in the .md:

  1. yields ––〃–– (debugged this using both --verbose and .md --pandoc--> .txt, outputs matched)
  2. yields ----〃----

Another example: For Decius' "Title"

  1. yields Decius’$,$ “Title”
  2. yields Decius' ``Title''

In this second example, the plain behavior 1) actually was buggy, as when rendering to pdf, the ending possessive apostrophe and first quote overlapped; just by using method 2) the bug was fixed

The feature request I'm making would be a way to either be able to keep the intermediate .tex file that 1) creates and that gets automatically deleted e.g. --keep-internal-tex, or when creating 2) have an option to use the same template/processing as method 1) e.g. --use-internal-template

@jgm
Copy link
Owner

jgm commented Mar 25, 2025

The pdf-via-latex route disables the smart extension on the pandoc writer, so that unicode quotes are used. https://github.com/jgm/pandoc/blob/main/src/Text/Pandoc/PDF.hs#L123-L127

@jgm
Copy link
Owner

jgm commented Mar 25, 2025

In your first example, this is just the difference between two unicode en-dashes and two latex ligatures for en-dash (--).

Your second example I don't understand. When I use pandoc -t latex-smart on that, I don't get the $,$ and I don't see where that could be coming from.

@gabiteodoru
Copy link
Author

gabiteodoru commented Mar 27, 2025

The pdf-via-latex route disables the smart extension on the pandoc writer,

Thanks for your reply. I did some thorough testing on a simple .md (––〃–– Decius' "Title") with all 4 combinations of --from smart+-markdown and --to smart+-latex.

If I use the 2 step route (--standalone to tex, then pdf), I need to disable both.
If I use the 1 step route (direct to pdf), disabling the markdown smart mode is both a necessary and sufficient condition.

I guess knowing about these smart extensions allows me to fully control everything, so perhaps rather than adding a new option, it would be great if the verbose modes could specify exactly which smart modes are enabled?

Here is my output from the 4 combinations (command goes after output):

pandoc --from markdown-smart --to latex-smart test.md -o test.tex --pdf-engine=xelatex -V mainfont="Palatino Linotype" -V CJKmainfont="Arial Unicode MS" --standalone && xelatex test.tex test.pdf && type test.tex && start test.pdf

––〃–– Decius\textquotesingle{} "Title"

Yields correct display in the PDF.

pandoc --from markdown-smart --to latex+smart test.md -o test.tex --pdf-engine=xelatex -V mainfont="Palatino Linotype" -V CJKmainfont="Arial Unicode MS" --standalone && xelatex test.tex test.pdf && type test.tex && start test.pdf

----〃---- Decius\textquotesingle{} "Title"

Dashes displayed incorrectly

pandoc --from markdown+smart --to latex-smart test.md -o test.tex --pdf-engine=xelatex -V mainfont="Palatino Linotype" -V CJKmainfont="Arial Unicode MS" --standalone && xelatex test.tex test.pdf && type test.tex && start test.pdf

––〃–– Decius’ “Title”

Apostrophe on top of quotes

pandoc --from markdown+smart --to latex+smart test.md -o test.tex --pdf-engine=xelatex -V mainfont="Palatino Linotype" -V CJKmainfont="Arial Unicode MS" --standalone && xelatex test.tex test.pdf && type test.tex && start test.pdf

----〃---- Decius' ``Title''

Dashes displayed incorrectly

I guess I could do the same for the verbose output if you need me to, just more tedious to deal with. Thanks! :)

P.S. Regarding the $ sign -- I haven't tried reproducing that; I was dealing with this text inside a table; but I may also have made a manual fix, as I have multiple versions lying around ... again if you need me to do a thorough test with the table ones as well please let me know. Thanks! :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants