Last active
September 23, 2024 16:00
-
-
Save keuv-grvl/12f386624061672637997790fc2d0472 to your computer and use it in GitHub Desktop.
Convert Markdown to PDF within Sublime Text using Pandoc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"cmd": ["pandoc --latex-engine=xelatex --filter=pandoc-citeproc -o '$file_base_name.pdf' '$file_name'"], | |
"selector": "text.html.markdown", | |
"shell": true | |
} |
I'm using pandoc version 1.19.2.4 , the updated snippet of @keuv-grvl should modify the argument name from --pdf-engine to --latex-engine.
As of today, the usage of latex-engine is no longer possible for pandoc v2.19.2 (windows tested) see my console output :
PS > pandoc --latex-engine=xelatex -o 'README.pdf' 'README.md'
--latex-engine has been removed. Use --pdf-engine instead.
Try pandoc.exe --help for more information.
PS > pandoc -v
pandoc.exe 2.19.2
Compiled with pandoc-types 1.22.2.1, texmath 0.12.5.2, skylighting 0.13,
citeproc 0.8.0.1, ipynb 0.2, hslua 2.2.1
Scripting engine: Lua 5.4
User data directory: C:\Users\%USER%\AppData\Roaming\pandoc
Copyright (C) 2006-2022 John MacFarlane. Web: https://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.
PS > $PSVersionTable
Name Value
---- -----
PSVersion 7.2.7
PSEdition Core
GitCommitId 7.2.7
OS Microsoft Windows 10.0.19043
Platform Win32NT
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
I'm using pandoc v2.9.2.1 on Linux Mint (21.3) and by changing --latex-engine=xelatex
to --pdf-engine=pdflatex
things were back in working order:
{
"cmd": ["pandoc --pdf-engine=pdflatex --filter=pandoc-citeproc -o '$file_base_name.pdf' '$file_name'"],
"selector": "text.html.markdown",
"shell": true
}
There are several pdf engines you can use, including xelatex as used above: https://pandoc.org/MANUAL.html#option--pdf-engine
I actually had problems with previous solutions but this worked for me:
{ "cmd": ["pandoc --pdf-engine=pdflatex --citeproc -o '$file_base_name.pdf' '$file_name'"], "selector": "text.html.markdown", "shell": true }
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I think also that the
--filter=pandoc-citeproc
bit is no longer required in my version of pandoc (2.15) it worked without it.However, I needed to add lmodern latex sty package by simply doing
sudo apt-get install lmodern
Thanks for the gist!