Skip to content

Instantly share code, notes, and snippets.

@dunn
Last active December 14, 2015 10:29
Show Gist options
  • Save dunn/5072575 to your computer and use it in GitHub Desktop.
Save dunn/5072575 to your computer and use it in GitHub Desktop.
simple markdown-to-PDF wrapper for pandoc
#!/bin/bash
open=0
input=""
shortname=""
if [[ "$1" == "o" || "$1" == "-o" ]]
then
open="1"
input="$2"
shortname=`echo "$2" | sed 's:\(\.[^\.]*\)$::g'`
else
input="$1"
shortname=`echo "$1" | sed 's:\(\.[^\.]*\)$::g'`
fi
# -R allows raw LaTeX
# -N does section numbers
# '> /dev...' hides the bib warnings
pandoc -f markdown -R -N \
--bibliography=/Users/alexd/Dropbox/texmf/bibtex/bib/everything.bib \
-o "$shortname".pdf "$input" \
> /dev/null 2>&1
if [ "$open" == "1" ]
then
open "$shortname".pdf
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment