aboutsummaryrefslogtreecommitdiffstats
path: root/build/latex/academia
diff options
context:
space:
mode:
Diffstat (limited to 'build/latex/academia')
-rw-r--r--build/latex/academia/%INIT_APPLICATION_NAME.tex9
-rwxr-xr-xbuild/latex/academia/build.sh27
-rw-r--r--build/latex/academia/flake.nix5
-rw-r--r--build/latex/academia/headers/preamble/core/graphics_and_floats.tex8
-rw-r--r--build/latex/academia/headers/preamble/core/index.tex2
-rw-r--r--build/latex/academia/headers/preamble/core/references.tex2
-rw-r--r--build/latex/academia/init2
-rw-r--r--build/latex/academia/lpm.toml10
8 files changed, 43 insertions, 22 deletions
diff --git a/build/latex/academia/%INIT_APPLICATION_NAME.tex b/build/latex/academia/%INIT_APPLICATION_NAME.tex
index a5fe645..72db095 100644
--- a/build/latex/academia/%INIT_APPLICATION_NAME.tex
+++ b/build/latex/academia/%INIT_APPLICATION_NAME.tex
@@ -1,7 +1,10 @@
% LTeX: language=%INIT_LANGUAGE
-%\documentclass[a4paper, 12pt, nosolutions]{report}
-% \documentclass[a4paper, 12pt, onecolumn]{report}
-\documentclass[a4paper, 12pt, twocolumn]{scrartcl}
+\documentclass[
+ a4paper, 12pt, twocolumn,
+ % nosolutions,
+ draft,
+ % final,
+]{report}
\input{headers/preamble.tex}
\input{headers/preamble_local.tex}
diff --git a/build/latex/academia/build.sh b/build/latex/academia/build.sh
index c67ad52..1ff2b6e 100755
--- a/build/latex/academia/build.sh
+++ b/build/latex/academia/build.sh
@@ -1,6 +1,8 @@
#!/usr/bin/env sh
-file="./%INIT_APPLICATION_NAME.tex"
+root="$(git rev-parse --show-toplevel)"
+
+file="$root/%INIT_APPLICATION_NAME.tex"
dst=build
clear=false
@@ -21,10 +23,31 @@ for arg in "$@"; do
done
# find all directories which are not the destination dir or inside it
-find . -type d -not -name "$dst" -not -path "./$dst/*" -printf '%P\n' | while IFS= read -r dir; do
+find "$root" -type d -not -name "$dst" -not -path "./$dst/*" -printf '%P\n' | while IFS= read -r dir; do
mkdir --parents "$dst/$dir"
done
test "$clear" = true && rm "$dst/${file%tex}out"
+fd . "$root/figures" --type file --extension tex | while read -r figure; do
+ figure_name_full="$(basename "$figure")"
+ figure_name="${figure_name_full%.tex}"
+
+ figure_hash="$(sha256sum "$figure")"
+ figure_cache_hash="$(
+ [ -e "$dst/figures/$figure_name/$figure_name.sha256sum_hash" ] &&
+ cat "$dst/figures/$figure_name/$figure_name.sha256sum_hash"
+ )"
+
+ echo "Compiling figure: '$figure_name'.."
+ mkdir --parents "$dst/figures/$figure_name"
+
+ if [ "$figure_hash" = "$figure_cache_hash" ]; then
+ echo " -> Didn't change, not re-compiling."
+ else
+ echo "$figure_hash" >"$dst/figures/$figure_name/$figure_name.sha256sum_hash"
+ pdflatex -output-directory="$dst" -file-line-error -jobname="figures/$figure_name/$figure_name" "$figure"
+ fi
+done
+
latexmk -outdir="$dst" -file-line-error -pdflatex -recorder "$file"
diff --git a/build/latex/academia/flake.nix b/build/latex/academia/flake.nix
index 6a21c68..bfdf673 100644
--- a/build/latex/academia/flake.nix
+++ b/build/latex/academia/flake.nix
@@ -46,15 +46,12 @@
};
crane = {
url = "github:ipetkov/crane";
- inputs = {
- nixpkgs.follows = "nixpkgs";
- };
+ inputs = {};
};
rust-overlay = {
url = "github:oxalica/rust-overlay";
inputs = {
nixpkgs.follows = "nixpkgs";
- flake-utils.follows = "flake-utils";
};
};
};
diff --git a/build/latex/academia/headers/preamble/core/graphics_and_floats.tex b/build/latex/academia/headers/preamble/core/graphics_and_floats.tex
index c0784c9..c71fc2a 100644
--- a/build/latex/academia/headers/preamble/core/graphics_and_floats.tex
+++ b/build/latex/academia/headers/preamble/core/graphics_and_floats.tex
@@ -7,9 +7,6 @@
\usepackage{pgfplots} % plots, 2D and 3D
\pgfplotsset{compat=1.18} % Set a compatibility level, to be able to use the new versions
-\usetikzlibrary{external}
-\tikzexternalize[prefix=figures/, mode=list and make]
-
% \usetikzlibrary{intersections, angles, quotes, calc, positioning}
% \usetikzlibrary{arrows.meta} %TODO maybe deprecated?
@@ -17,6 +14,9 @@
% \usepackage{subcaption} % like caption package, but for subfigures
% \usepackage{booktabs} % better tables
-
\usepackage{float} % Allows placing floats here (H) and creating new floats `\newfloat`
\usepackage{wrapfig} % Wraps text around figures with the \begin{wrapfigure} environment
+
+\NewDocumentCommand{\IncludeTikz}{m}{
+ \includegraphics{build/figures/#1/#1}
+}
diff --git a/build/latex/academia/headers/preamble/core/index.tex b/build/latex/academia/headers/preamble/core/index.tex
index a52cc20..3efbfc4 100644
--- a/build/latex/academia/headers/preamble/core/index.tex
+++ b/build/latex/academia/headers/preamble/core/index.tex
@@ -4,5 +4,5 @@
\ifdraft{
\usepackage{showidx}
} {
- \message {Draft packages not loaded, showidx not loaded.}
+ \message {Draft option not enabled, 'showidx' not loaded.}
}
diff --git a/build/latex/academia/headers/preamble/core/references.tex b/build/latex/academia/headers/preamble/core/references.tex
index e42b22f..179d903 100644
--- a/build/latex/academia/headers/preamble/core/references.tex
+++ b/build/latex/academia/headers/preamble/core/references.tex
@@ -33,5 +33,5 @@
\ifdraft{
\usepackage{showlabels}
} {
- \message {Draft packages not loaded, 'showlabels' not loaded.}
+ \message {Draft option not enabled, 'showlabels' not loaded.}
}
diff --git a/build/latex/academia/init b/build/latex/academia/init
index 9ee0462..e8f72c8 100644
--- a/build/latex/academia/init
+++ b/build/latex/academia/init
@@ -182,6 +182,8 @@ reuse="$(nix build nixpkgs#reuse.out --no-link --print-out-paths)/bin/reuse"
git add .
+cp "$replacement_file" ".git/init_variables_$(date --iso-8601=date)"
+
git diff --name-only --cached |
xargs -I {} "$reuse" annotate \
--copyright "$AUTHOR_NAME <$AUTHOR_EMAIL>" \
diff --git a/build/latex/academia/lpm.toml b/build/latex/academia/lpm.toml
index 1821b73..28702c9 100644
--- a/build/latex/academia/lpm.toml
+++ b/build/latex/academia/lpm.toml
@@ -17,18 +17,14 @@ chapter = '''
figure = '''
% LTeX: language=%INIT_LANGUAGE
-\documentclass[varwidth]{standalone}
+\documentclass{standalone}
\input{../headers/preamble.tex}
\input{../headers/preamble_local.tex}
-\usepackage{tikz}
-
\begin{document} % lpm::current_date (lpm::new_figure_name)
-
-\begin{tizkpicture}
- \node at (0,0) {Hello world!};
+\begin{tikzpicture}
+ \draw node[left] {ping?} (0,0) -- (3,0) node[right] {Pong!} ;
\end{tikzpicture}
-
\end{document}
'''