diff options
-rw-r--r-- | .gitignore | 2 | ||||
-rw-r--r-- | example.tex | 10 | ||||
-rw-r--r-- | img/.gitignore | 2 | ||||
-rw-r--r-- | img/example.puml | 6 | ||||
-rw-r--r-- | latexmkrc | 61 | ||||
-rw-r--r-- | makefile | 17 | ||||
-rw-r--r-- | projdoc.cls | 4 |
7 files changed, 39 insertions, 63 deletions
@@ -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 @@ -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 |