Created
March 9, 2018 16:26
-
-
Save rsnemmen/92b170a47648fb1daa4db407aeca52bf to your computer and use it in GitHub Desktop.
Shell script that converts a Markdown document with LaTeX math expressions to a nice PDF
This file contains hidden or 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
| #!/bin/sh | |
| # | |
| # Convert Markdown with LaTeX directives to a PDF file. | |
| # | |
| # Requirements: pandoc | |
| # | |
| # Run this inside your document folder: | |
| # md2tex.sh <MARKDOWN FILE> <OUTPUT FILE> | |
| # | |
| # where: | |
| # - <MARKDOWN FILE>: name of markdown document | |
| # - <OUTPUT FILE>: PDF filename | |
| # | |
| # check if there were command-line arguments | |
| if [ $# -eq 0 ]; then | |
| echo "Usage: " | |
| echo " mdtex.sh <MARKDOWN FILE> <OUTPUT FILE> " | |
| exit 1 | |
| fi | |
| pandoc --from=markdown --output=$2 $1 --variable=geometry:"margin=0.5cm, paperheight=500pt, paperwidth=400pt" --highlight-style=espresso --pdf-engine=xelatex | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment