Pre-compilation of tasks so the code is not necessary in exercise packages.

This commit is contained in:
Kremitzl 2021-04-16 16:19:25 +02:00
parent 1257b09303
commit 66e7216173
9 changed files with 88 additions and 29 deletions

View File

@ -2,6 +2,9 @@ SHELL=/bin/bash
default: preview
# Build everything there is.
all: listings tasks preview publication
# Remove builds and LaTeX output.
clean:
@echo Cleaning up temporary files.
@ -13,6 +16,10 @@ clean:
listings: listings/**/*
./compile_listings
# Compile pre-rendered tasks
tasks: exercises/**/*
./compile_tasks
# Compile a preview PDF containing all contents
preview: main.tex
echo "\newcommand\exercisemode{any}" > exercise-mode.tex
@ -77,6 +84,7 @@ publication-zip-with-exercises: publication-dir main.tex
cp --parents main.tex praeamble.tex commands.tex content/* graphics/* listings/**/*{.tex,pdf,bib} temp/
cp --parents exercises/**/* temp/
rm -f temp/exercises/**/*.done.{tex,bib}
rm -f temp/exercises/**/*.rend.tex
find temp/ -name '*.raw.*' -exec bash -c 'sed "s/\.raw\./\./g" <<<{} | xargs mv {}' \;
find temp/ -name '*.tex' -exec sed -i -e 's/\.raw\./\./g' {} \;
cd temp && zip ../public/project-with-exercises * **/* **/**/*

31
compile_tasks Executable file
View File

@ -0,0 +1,31 @@
#!/bin/bash
for D in exercises/*; do
echo "${D}"
if [ -d "${D}" ]; then
# convert tex to pdf
for F in ${D}/*.rend.tex; do
if [ -f "${F}" ]; then
echo "###### Rendering ${F} ######"
pdflatex --output-directory "${D}" --shell-escape "${F}"
fi
done
# crop pdf
for F in ${D}/*.rend.pdf; do
if [ -f "${F}" ]; then
pdfcrop "${F}"
fi
done
# remove temporary files
for F in ${D}/*.{aux,log,out}; do
if [ -f "${F}" ]; then
rm ${F}
fi
done
# move pdf to graphics folder
for F in ${D}/*.pdf; do
if [ -f "${F}" ]; then
mv ${F} graphics/
fi
done
fi
done

View File

@ -1,29 +1,2 @@
\begin{center}
\textbf{Fallbeschleunigung in Deutschland}
$$9,81\,\frac{m}{s^2}$$ \\
~ \\
\textbf {pq-Formel}
$$x_{1,2} = - \frac{p}{2} \pm \sqrt{\left(\frac{p}{2}\right)^2 - q}$$ \\
~ \\
\textbf{Mitternachtsformel}
$$x_{1,2} = \frac{-b \pm \sqrt{b^2 - 4ac}}{2a}$$ \\
~ \\
\textbf{Catalansche Zahlen}
\begin{equation*} C_n = \frac{1}{n+1} {2n \choose n} = \frac{(2n)!}{(n+1)!n!} \end{equation*} \\
~ \\
\textbf{Definition der Fakultät}
$$n! = \prod_{i=1}^{n} i$$ \\
~ \\
\textbf{Menge aller ungeraden natürlichen Zahlen}
$$\{ x \mid x \in \mathds{N}, \mathrm{ungerade}(x) \}$$
~ \\
\textbf{Elimination $\neg\exists x$}
$$\neg\exists x . p(x) \Leftrightarrow \forall x . \neg p(x)$$
\end{center}
% Ersetzt diese Grafik durch die entsprechenden Formeln:
\includegraphics{graphics/math-formulas.rend-crop.pdf}

View File

@ -0,0 +1,47 @@
\documentclass[a4paper, ngerman]{report}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{babel}
\usepackage{eurosym, tipa, textcomp, textgreek, upgreek}
\usepackage{amssymb, amsfonts, amsmath, dsfont}
\usepackage[hidelinks]{hyperref}
\usepackage{cleveref}
\usepackage{graphicx}
\usepackage{longtable, array, tabularx, booktabs, colortbl}
\usepackage{minted}
\begin{document}
\thispagestyle{empty}
\hrule
\begin{center}
\textbf{Fallbeschleunigung in Deutschland}
$$9,81\,\frac{m}{s^2}$$ \\
~ \\
\textbf {pq-Formel}
$$x_{1,2} = - \frac{p}{2} \pm \sqrt{\left(\frac{p}{2}\right)^2 - q}$$ \\
~ \\
\textbf{Mitternachtsformel}
$$x_{1,2} = \frac{-b \pm \sqrt{b^2 - 4ac}}{2a}$$ \\
~ \\
\textbf{Catalansche Zahlen}
\begin{equation*} C_n = \frac{1}{n+1} {2n \choose n} = \frac{(2n)!}{(n+1)!n!} \end{equation*} \\
~ \\
\textbf{Definition der Fakultät}
$$n! = \prod_{i=1}^{n} i$$ \\
~ \\
\textbf{Menge aller ungeraden natürlichen Zahlen}
$$\{ x \mid x \in \mathds{N}, \mathrm{ungerade}(x) \}$$
~ \\
\textbf{Elimination $\neg\exists x$}
$$\neg\exists x . p(x) \Leftrightarrow \forall x . \neg p(x)$$
\end{center}
\hrule
\end{document}

Binary file not shown.

Binary file not shown.