aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLoek Le Blansch <loek@pipeframe.xyz>2024-09-14 11:10:00 +0200
committerLoek Le Blansch <loek@pipeframe.xyz>2024-09-14 11:10:00 +0200
commit4d085ec22a6d8560913f61096a83ebda4bbaa740 (patch)
treee5a4e0d290762ffa782e9cde90148dd05a976bc1
parentfea8645802845447a4e03bd40bc481b1bed48f75 (diff)
clean up LaTeX build system
-rw-r--r--.gitignore2
-rw-r--r--example.tex10
-rw-r--r--img/.gitignore2
-rw-r--r--img/example.puml6
-rw-r--r--latexmkrc61
-rw-r--r--makefile17
-rw-r--r--projdoc.cls4
7 files changed, 39 insertions, 63 deletions
diff --git a/.gitignore b/.gitignore
index efae07a..dfaa9e7 100644
--- a/.gitignore
+++ b/.gitignore
@@ -29,8 +29,6 @@
# output files
*.pdf
-!img/*.pdf
-img/*.puml.pdf
# generated files
time.tex
diff --git a/example.tex b/example.tex
index ce45f6f..4ae4d95 100644
--- a/example.tex
+++ b/example.tex
@@ -35,7 +35,7 @@ These don't show up in the table of contents by default
\Cref{fig:example-a} definitely shows something. Referencing multiple things at once
is neatly handled by cleveref:
-\cref{fig:example-a,fig:example-b,fig:example-c,tab:gate-xor}.
+\cref{fig:example-a,fig:example-b,fig:example-puml,tab:gate-xor}.
\begin{figure}
\centering
@@ -46,15 +46,17 @@ is neatly handled by cleveref:
\begin{figure}
\begin{subfigure}{0.45\textwidth}%
+ \centering
\fitimg{\includegraphics{example-image-b}}
\caption{Example image B}
\label{fig:example-b}
\end{subfigure}%
\hfill
\begin{subfigure}{0.45\textwidth}%
- \fitimg{\includegraphics{example-image-c}}
- \caption{Example image C}
- \label{fig:example-c}
+ \centering
+ \includepumldiag{img/example.puml}
+ \caption{Example PlantUML diagram}
+ \label{fig:example-puml}
\end{subfigure}%
\caption{Subfigures}
\end{figure}
diff --git a/img/.gitignore b/img/.gitignore
new file mode 100644
index 0000000..60a51f5
--- /dev/null
+++ b/img/.gitignore
@@ -0,0 +1,2 @@
+!*.pdf
+*.eps
diff --git a/img/example.puml b/img/example.puml
new file mode 100644
index 0000000..942dce2
--- /dev/null
+++ b/img/example.puml
@@ -0,0 +1,6 @@
+@startuml
+!include theme.ipuml
+
+Bob -> Alice : hello
+
+@enduml
diff --git a/latexmkrc b/latexmkrc
index 66ed0d1..293cf09 100644
--- a/latexmkrc
+++ b/latexmkrc
@@ -1,49 +1,32 @@
-$pdflatex = "xelatex %O %S";
+# https://nl.mirrors.cicku.me/ctan/support/latexmk/latexmk.pdf
+
+$pdflatex = "xelatex --interaction=nonstopmode %O %S";
$pdf_mode = 1;
$dvi_mode = 0;
$postscript_mode = 0;
+$clean_ext .= ' %R.ist %R.xdy bbl run.xml';
+@default_files = (
+ 'example',
+ 'plan',
+ 'research',
+ 'timerep',
+);
-# https://tex.stackexchange.com/questions/400325/latexmkrc-for-bib2gls
-add_cus_dep('glo', 'gls', 0, 'run_makeglossaries');
-add_cus_dep('acn', 'acr', 0, 'run_makeglossaries');
-add_cus_dep('aux', 'glstex', 0, 'run_bib2gls');
+push @file_not_found, '^Package .* No file `([^\\\']*)\\\'';
+push @generated_exts, 'glo', 'gls', 'glg';
-sub run_makeglossaries {
- if ( $silent ) {
- system "makeglossaries -q '$_[0]'";
- } else {
- system "makeglossaries '$_[0]'";
- };
+add_cus_dep('aux', 'glstex', 0, 'bib2gls');
+sub bib2gls {
+ return system "bib2gls '$_[0]'";
}
-sub run_bib2gls {
- if ( $silent ) {
- my $ret = system "bib2gls --silent --group '$_[0]'";
- } else {
- my $ret = system "bib2gls --group '$_[0]'";
- };
- my ($base, $path) = fileparse( $_[0] );
- if ($path && -e "$base.glstex") {
- rename "$base.glstex", "$path$base.glstex";
- }
- # Analyze log file.
- local *LOG;
- $LOG = "$_[0].glg";
- if (!$ret && -e $LOG) {
- open LOG, "<$LOG";
- while (<LOG>) {
- if (/^Reading (.*\.bib)\s$/) {
- rdb_ensure_file( $rule, $1 );
- }
- }
- close LOG;
- }
- return $ret;
+add_cus_dep('puml', 'eps', 0, 'plantuml');
+sub plantuml {
+ return system "plantuml -teps '$_[0].puml'";
}
-push @file_not_found, '^Package .* No file `([^\\\']*)\\\'';
-push @generated_exts, 'glo', 'gls', 'glg';
-push @generated_exts, 'acn', 'acr', 'alg';
-$clean_ext .= ' %R.ist %R.xdy';
-$clean_ext .= ' bbl run.xml';
+add_cus_dep('txt', 'tex', 0, 'time2tex');
+sub time2tex {
+ return system "./time2tex.py '$_[0].txt' > '$_[0].tex'";
+}
diff --git a/makefile b/makefile
deleted file mode 100644
index 15eae95..0000000
--- a/makefile
+++ /dev/null
@@ -1,17 +0,0 @@
-all: plan.pdf
-all: research.pdf
-
-LATEXMKFLAGS += -cd
-LATEXMKFLAGS += -interaction=nonstopmode
-%.pdf: %.tex
- -latexmk $(LATEXMKFLAGS) $<
-
-%.puml.pdf: %.puml
- plantuml -tpdf $<
- mv $*.pdf $@
-
-%.tex: %.txt
- ./time2tex.py $< > $@
-
-timerep.pdf: time.tex
-
diff --git a/projdoc.cls b/projdoc.cls
index c0257ca..0d27a1f 100644
--- a/projdoc.cls
+++ b/projdoc.cls
@@ -58,6 +58,7 @@
\RequirePackage{subcaption}
\RequirePackage{multicol}
\RequirePackage{comparison} % ./comparison.sty
+\RequirePackage{xstring}
% font style
\setmainfont{TeX Gyre Schola}
@@ -297,7 +298,8 @@
% adjust scale for puml diagrams
\newcommand{\includepumldiag}[1]{%
- \fitimg{\includegraphics[scale=0.6]{#1}}%
+ \StrSubstitute{#1}{.puml}{.eps}[\filename]%
+ \fitimg{\includegraphics[scale=0.6]{\filename}}%
}
% prevent page break between two paragraphs