Skip to content

Instantly share code, notes, and snippets.

@bougui505
Created February 25, 2014 13:44
Show Gist options
  • Save bougui505/9208962 to your computer and use it in GitHub Desktop.
Save bougui505/9208962 to your computer and use it in GitHub Desktop.
Get header from tex file maintexfile and inlude tex file includefile and test the compilation with latexmk
#!/usr/bin/env sh
maintexfile=$1
includefile=$2
rootfilename=$(echo $includefile | cut -d. -f1)
(grep -B9999 'begin{document}' $maintexfile && echo " " && echo "\include{$rootfilename}" && echo "\\end{document}") > header.tex
latexmk -pdf -pvc header.tex
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment