Commit 4e652f37 authored by Harry Fuchs's avatar Harry Fuchs

detect changes in default pandoc template file

parent 230ba51d
Pipeline #3631 passed with stage
in 8 minutes and 12 seconds
pandoc --output="latex-default.template" --print-default-template=latex
if diff latex-cached.template latex-default.template >/dev/null ; then
echo "Default template did not change."
else
echo "Default template changed."
exit 1
fi
mv latex-default.template latex-custom.template
python3 inject-in-template.py
cp edit-this-file.tex tmp.tex
python3 preprocessor.py
pandoc -f org -t latex tmp.tex -s -o for-compile.tex --metadata-file meta.yaml --template="latex.template"
pandoc tmp.tex --from="org" --to="latex" --standalone --output="for-compile.tex" --metadata-file="meta.yaml" --template="latex-custom.template"
exitcode=$?
if [[ $exitcode == 0 ]]
then
......
%harry-custom
\usepackage{blkarray}
\usepackage{stmaryrd}
\usepackage{datetime}
\usepackage{cancel}
\usepackage{mathtools}
\usepackage{bbm}
\usepackage{nicefrac}
\usepackage{tikz, tikz-cd}
\newcommand{ \Diff }{ \mathrm{D} }
\newcommand{ \diffd }{ \mathrm d }
\newcommand{ \intd }{ \,\diffd }
\newcommand{ \rang }{ \operatorname{Rang} }
\newcommand{ \const }{ \operatorname{const} }
\newcommand{ \eins }{ \mathbbm{1} }
\newcommand{ \rg }{ \operatorname{rg} }
\newcommand{ \Mat }{ \operatorname{Mat} }
\newcommand{ \Lin }{ \operatorname{span} }
\newcommand{ \id }{ \operatorname{id} }
\newcommand{ \R }{ \mathbb R }
\newcommand{ \N }{ \mathbb N }
\newcommand{ \K }{ \mathbb K }
\newcommand{ \M }{ \mathbb M }
\newcommand{\miso}[4]{ \begin{tikzcd} #1 \arrow[r, "#3"', shift left=-0.25ex] \pgfmatrixnextcell #4 \arrow[l, "#2"', shift left=-0.75ex] \end{tikzcd} }
\newcommand{\quoteunquote}[1]{ \begin{array}{rcl} && \text{} \\ & #1 & \\ \text{} && \end{array} }
%alexeev-custom
\newcommand{ \coloneqq }{ := }
\newcommand{ \mb }{ \mathbb }
\let\subsetAmbiguous\subset
\renewcommand{\subset}{\subseteq}
\newcommand{\norm}[1]{\lVert #1 \rVert}
#TODO Algorithmic efficiency
import re
filename = "latex-custom.template"
with open(filename, 'r') as file:
data = file.read()
copy = data
while True:
data = copy
#print(data, copy)
if data == copy:
break
injectBefore = r'\\begin{document}'
toBeInjected = r'\\input{custom.tex}' + r' \n\n'
data = re.sub(injectBefore, toBeInjected + injectBefore, data, 1)
with open(filename, 'w') as file:
file.write(data)
This diff is collapsed.
......@@ -8,6 +8,5 @@ lang: de
papersize: a4
toc: yes
graphics: yes
tikz: yes
numbersections: yes
...
......@@ -12,12 +12,13 @@ apt-get install --yes python
apt-get install --yes texlive-full
#pandoc outdated in debian testing
TGZ=pandoc-2.9.1-linux-amd64.tar.gz
VERSION=2.9.2.1
TGZ=pandoc-$VERSION-linux-amd64.tar.gz
DEST=.local
mkdir $DEST
export PATH=$PATH:$(pwd)/$DEST/bin
echo "export PATH=$PATH:$(pwd)/$DEST/bin" > install-path-pandoc
wget -c "https://github.com/jgm/pandoc/releases/download/2.9.1/$TGZ"
wget -c "https://github.com/jgm/pandoc/releases/download/$VERSION/$TGZ"
tar xvzf $TGZ --strip-components 1 -C $DEST
ls .local
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment