From cb257af1e0731223a86cbf3f54affef0c0cfbb94 Mon Sep 17 00:00:00 2001 From: Kristian Fiskerstrand Date: Mon, 2 Apr 2018 15:32:16 +0200 Subject: init --- CreateDocument.sh | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100755 CreateDocument.sh (limited to 'CreateDocument.sh') diff --git a/CreateDocument.sh b/CreateDocument.sh new file mode 100755 index 0000000..2f4ee32 --- /dev/null +++ b/CreateDocument.sh @@ -0,0 +1,35 @@ +#!/bin/bash +CONFIG_BIBTEX=false +CONFIG_MAINFILE="main" +CONFIG_CLEANUP=true +CONFIG_CREATEDIFF=false +CONFIG_CREATE_GITVERSION=true + +if [[ ${CONFIG_CREATE_GITVERSION} = "true" ]]; then + git describe --tags | sed -e 's/_/ /g' > docversion.tmp || die +fi + +# Need to loop this to get proper references. If using bibtex this needs to +# be part of the processing as well +for i in $(seq 1 3); do + if [[ ${CONFIG_BIBTEX} = "true" && ${i} == "3" ]]; then + bibtex ${CONFIG_MAINFILE} + fi; + pdflatex ${CONFIG_MAINFILE} +done; + +if [[ ${CONFIG_CREATEDIFF} = "true" ]]; then + latexdiff ${CONFIG_MAINFILE}.tex.old ${CONFIG_MAINFILE}.tex > diff.tex + pdflatex diff.tex + pdflatex diff.tex +fi + +# Clean up +if [[ ${CONFIG_CLEANUP} = "true" ]]; then + for x in bbl aux blg log out dvi toc; do + rm -rf ${CONFIG_MAINFILE}.${x} + done; + if [[ ${CONFIG_CREATE_GITVERSION} = "true" ]]; then + rm -f docversion.tmp + fi +fi; -- cgit v1.2.3-65-gdbad