Windows | Linux
A vscode tool that converts advanced Markdown with diagrams, code execution, and custom macros into publication-ready LaTeX PDFs.
- Prerequisites
- Installation
- VS Code Setup
- Usage
- Changing Default Values
- Changing the University Logo
- Updating markdown-latex-pdf-builder
- Uninstallation
- Tested Environments
Before starting, make sure you have the following:
Download and install it from python.org. Preferably, above version 3.10.
Check installation:
python --version; python -m pip --versionDownload from code.visualstudio.com.
Check installation:
code --versionInstall the Command Runner extension for VS Code.
Download and install Node.js from nodejs.org.
Check installation:
node --version; npm --versionNote
If you're having trouble running npm --version, you may need to change the execution policy. Run this command:
Set-ExecutionPolicy -Scope CurrentUser -ExecutionPolicy RemoteSignedOpen PowerShell (Terminal on Windows 11) and run these commands:
Caution
Do not run as Administrator
Install TinyTeX to your user AppData folder:
wget "https://github.com/rstudio/tinytex-releases/releases/download/daily/TinyTeX-1.zip" -OutFile "$env:TEMP\TinyTeX.zip"
Expand-Archive -Force -Path "$env:TEMP\TinyTeX.zip" -DestinationPath $env:APPDATA
Remove-Item "$env:TEMP\TinyTeX.zip"
$env:PATH += ";$env:APPDATA\TinyTeX\bin\windows"
tlmgr path add
tlmgr option repository ctan
tlmgr postaction install script xetex
Install required LaTeX packages using tlmgr:
tlmgr update --self
tlmgr install adjustbox colortbl csvsimple datetime emoji endnotes fancyhdr fmtcount footmisc grfext hyphenat ifplatform lineno listings lua-ul markdown minted paralist pdfcol soul tcolorbox tikzfill titlesec titling tocloft todonotes ulem upquote xstring
Note
-
If you encounter "The term 'tlmgr' is not recognized" errors, try running the following command to get the correct path:
"$env:APPDATA\TinyTeX\bin\windows\" -
Then manually add the output path to your system PATH variable.
-
Restart your terminal
Install the Pygments syntax highlighter for code blocks:
python -m pip install PygmentsDownload markdown-latex-pdf-builder to your user AppData folder:
wget https://github.com/abdxdev/markdown-latex-pdf-builder/archive/refs/heads/main.zip -OutFile "$env:TEMP\main.zip"
Expand-Archive -Force -Path "$env:TEMP\main.zip" -DestinationPath "$env:APPDATA\markdown-latex-pdf-builder"
Remove-Item "$env:TEMP\main.zip"
Copy-Item "$env:APPDATA\markdown-latex-pdf-builder\markdown-latex-pdf-builder-main\default.json" "$env:APPDATA\markdown-latex-pdf-builder\default.json"
Install Mermaid CLI globally using npm:
npm install -g @mermaid-js/mermaid-cliInstall required Python packages for plotting inside python execution blocks:
python -m pip install numpy matplotlibRun this command to test markdown-latex-pdf-builder with the comprehensive guide example. If everything is set up correctly, a PDF document should be generated and opened automatically.
python "$env:APPDATA\markdown-latex-pdf-builder\markdown-latex-pdf-builder-main\script.py" "$env:APPDATA\markdown-latex-pdf-builder\markdown-latex-pdf-builder-main\test\COMPREHENSIVE-GUIDE.md" --show-
Open VS Code and press
Ctrl + Shift + P. -
Search for Preferences: Open User Settings (JSON) and open it.
-
Add this to the bottom of your
settings.jsonfile just before the closing}: -
Save the file.
- Open any folder in VS Code.
- Create a new Markdown file (for example,
report.md). - Add your content. Check out our comprehensive guide for advanced features and examples.
- Press
Ctrl + Shift + Rand select markdown-latex-pdf-builder: Build Document. (Extension: Command Runner must be installed. Follow prerequisites if you haven't done so.) - After a few moments, the PDF will be generated along with a
.jsonmetadata file. Edit this file to change document settings like title, university, and date. (To permanently change default values, see the next section.) - Re-run the build command from step 4 to generate the updated PDF.
Note
You may delete the build folder (_build_report in this case) after the PDF is finalized.
You can edit the default settings for document generation by modifying the default.json file.
Run this command to open it in VS Code:
code "$env:APPDATA\markdown-latex-pdf-builder\default.json"The next time you generate a document, it will use the updated defaults.
To replace the default logo, open the script directory:
explorer $env:APPDATA\markdown-latex-pdf-builder\markdown-latex-pdf-builder-main\Replace the existing uni-logo.pdf file with your logo file (use the same name).
To update markdown-latex-pdf-builder, run these commands in PowerShell:
Remove-Item "$env:APPDATA\markdown-latex-pdf-builder\markdown-latex-pdf-builder-main" -Recurse -Force
wget https://github.com/abdxdev/markdown-latex-pdf-builder/archive/refs/heads/main.zip -OutFile "$env:TEMP\main.zip"
Expand-Archive -Path "$env:TEMP\main.zip" -DestinationPath "$env:APPDATA\markdown-latex-pdf-builder"
Remove-Item "$env:TEMP\main.zip"
Install latex packages from step 2 of the installation section.
tlmgr path remove
Remove-Item "$env:APPDATA\TinyTeX" -Recurse -Force
Note
Microsoft Edge may lock certain files related to the uninstallation process if it is running in the background.
To avoid issues, open Task Manager, locate "Microsoft Edge" under the "Processes" tab, and select "End Task" before proceeding.
Remove-Item "$env:APPDATA\markdown-latex-pdf-builder" -Recurse -ForceThis tool was tested on:
- Windows 11.
- Command runner v0.0.124
- Python 3.13.3
- TinyTeX 0.57
- tlmgr 76773

