-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmarkdown_to_pdf.sh
More file actions
32 lines (26 loc) · 863 Bytes
/
Copy pathmarkdown_to_pdf.sh
File metadata and controls
32 lines (26 loc) · 863 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#!/bin/bash
set -e
set -x
unset TEXMF
# This script uses pandoc to convert markdown to pdf.
if [ $# -lt 1 ]; then
echo "USAGE: ./$0 filename.pandoc [optional]"
exit
fi
#LATEX="pdflatex -shell-escape"
LATEX="lualatex --shell-escape"
filename=$1
outputFile="${filename%.pandoc}.pdf"
texFile=${filename%.pandoc}.tex
# now convert the file to pdf
PANDOC="pandoc ${@:2}" # --filter $HOME/Scripts/pandoc/image_local_copy.hs "
PANDOC="$PANDOC --data-dir=$HOME/Scripts/pandoc --number-sections"
INFMT=markdown+citations+tex_math_dollars+multiline_tables+latex_macros+header_attributes+yaml_metadata_block+table_captions
echo "Converting $filename to $outputFile using pandoc"
latex="true"
if [[ $latex =~ "true" ]]; then
$PANDOC -s -f $INFMT -t latex -o $texFile $filename
$LATEX $texFile
else
$PANDOC -s -f $INFMT -o $outputFile $filename
fi