diff options
author | Benedikt Peetz <benedikt.peetz@b-peetz.de> | 2024-10-03 11:22:34 +0200 |
---|---|---|
committer | Benedikt Peetz <benedikt.peetz@b-peetz.de> | 2024-10-03 11:22:34 +0200 |
commit | 68ea1c9729189a93bb6dc7603022cd63d5430ea1 (patch) | |
tree | 5daf4c88aee88de37ee5b3af439cd384af8675eb | |
parent | fix(templates/latex/academia): Adjust to new preamble (diff) | |
download | flake-templates-68ea1c9729189a93bb6dc7603022cd63d5430ea1.tar.gz flake-templates-68ea1c9729189a93bb6dc7603022cd63d5430ea1.zip |
chore(build): Re-generate
27 files changed, 394 insertions, 323 deletions
diff --git a/build/latex/academia/%INIT_APPLICATION_NAME.tex b/build/latex/academia/%INIT_APPLICATION_NAME.tex index 5484bc6..50131ad 100644 --- a/build/latex/academia/%INIT_APPLICATION_NAME.tex +++ b/build/latex/academia/%INIT_APPLICATION_NAME.tex @@ -20,25 +20,24 @@ \hypersetup{ pdftitle={\@title}, pdfsubject={}, - pdfauthor={\@authors}, + pdfauthor={\AuthorList}, pdfkeywords={TODO}, - colorlinks, - linkcolor={black}, - citecolor={black}, - urlcolor={blue!80!black} } \makeatother -\includeonly{} +\includeonly { + % lpm::next_chapter_includeonly_marker +} \begin{document} - \onecolumn - \input{content/static/title} - \twocolumn +\onecolumn +\input{content/static/title} +\twocolumn - % NEXT_CHAPTER +% lpm::next_chapter_marker - \clearpage{} - \printbibliography\relax +\clearpage{} +\printbibliography\relax +\printindex \end{document} diff --git a/build/latex/academia/build.sh b/build/latex/academia/build.sh index 1206ee7..c67ad52 100755 --- a/build/latex/academia/build.sh +++ b/build/latex/academia/build.sh @@ -1,14 +1,30 @@ #!/usr/bin/env sh -# if no parameter is given, use 'dst' as destination directory -if [ -z "$1" ]; then - dst=build -else - dst="$1" -fi +file="./%INIT_APPLICATION_NAME.tex" +dst=build + +clear=false + +for arg in "$@"; do + case "$arg" in + "--clear") + clear=true + ;; + --*) + echo "No such option: '$arg'" + exit 2 + ;; + *) + file="$arg" + ;; + esac +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 mkdir --parents "$dst/$dir" done -latexmk -outdir="$dst" -file-line-error -pdflatex -recorder "./%INIT_APPLICATION_NAME.tex" + +test "$clear" = true && rm "$dst/${file%tex}out" + +latexmk -outdir="$dst" -file-line-error -pdflatex -recorder "$file" diff --git a/build/latex/academia/content/static/title.tex b/build/latex/academia/content/static/title.tex index 7398508..16537c9 100644 --- a/build/latex/academia/content/static/title.tex +++ b/build/latex/academia/content/static/title.tex @@ -4,12 +4,10 @@ \tableofcontents \vspace*{\fill} -\makeatletter % TODO: Translate this section (or remove this comment, if your language of choice is English) -Copyright \textcopyright{} \@authors{} \@years{}\\ +Copyright \textcopyright{} \AuthorList{} \YearList{}\\ \ \\ This work is licensed under the terms of the %INIT_SPDX_LICENSE_IDENTIFIER licence. The licence text can be found online at \url{%INIT_LICENSE_URL}. \ -\makeatother \clearpage diff --git a/build/latex/academia/flake.nix b/build/latex/academia/flake.nix index 9a85d5d..6a21c68 100644 --- a/build/latex/academia/flake.nix +++ b/build/latex/academia/flake.nix @@ -98,7 +98,7 @@ ''; installPhase = '' - install -D ./build/main.pdf "$out/%INIT_APPLICATION_NAME.pdf"; + install -D "./build/%INIT_APPLICATION_NAME.pdf" "$out/%INIT_APPLICATION_NAME.pdf"; ''; }; in { diff --git a/build/latex/academia/headers/preamble.tex b/build/latex/academia/headers/preamble.tex index d87943d..110e3a0 100644 --- a/build/latex/academia/headers/preamble.tex +++ b/build/latex/academia/headers/preamble.tex @@ -1,290 +1,2 @@ -% This preamble assumes pdflatex -% derived from: -% https://github.com/gillescastel/lecture-notes/blob/929672a96abc27eaeb6fa58b1d277b3582d28532/group-theory/preamble.tex -% encodings -\usepackage[utf8]{inputenc} % use utf8 encoding -\usepackage[T1]{fontenc} % for 8bit font support -\usepackage{lmodern} % latin modern fonts, should be better than ae, aecompl -% \usepackage{ae,aecompl} % full T1 font support -% \usepackage{textcomp} % support for yen and so on, not needed since latex2e(2020) - -% references -\usepackage[%INIT_BABLE_LANGUAGE]{babel} % For English language support, with reformed orthography! -\usepackage{csquotes} % required by biblatex -% \usepackage{biber} % required by biblatex - -% \usepackage{biblatex-dw} -\usepackage[backend=biber, - style=footnote-dw, - % - pageref=true, - annotation=true, - library=true, - % - % style=numeric, - autocite=superscript, - % FIXME: Keep this here? <2024-03-20> - doi=true, - isbn=true, - loccittracker=true, - opcittracker=true - ]{biblatex} % For bibtex references -\addbibresource{resources/reference.bib} -% \renewcommand{\autocite}[1]{\footcite{#1}\supercite{#1}} -% \bibliography{res/reference} % Set the location of the references - -% dates, time -\usepackage[%INIT_DATE_TIME_LANGUAGE, showdow]{datetime2} % make handling dates easier - -% index -% \usepackage{index} % Helps to create an index TODO compare with other such packages -% \makeindex - -% math -\usepackage{amsmath} % extensive math commands -\usepackage{amsfonts} % more fonts for math (fracture, boldfaced and so on) -\usepackage{mathtools} % extension to amsmath, with more sensible defaults (eq numbers only when referenced) -\usepackage{amssymb} % more symbols, mostly redundant because already loaded by something else -\usepackage{mathrsfs} % support for the RSFS fonts (through \mathscr command) -\usepackage{cancel} % allows to cancel a part in math mode, for example to shorten a term -\usepackage{bm} % bold mode in math, but better than \boldsymbol command from ams. \bm -\usepackage[locale = %INIT_SIUNITX_LANGUAGE]{siunitx} % For easy unit representation -\sisetup{per-mode = fraction} -\usepackage[version=4]{mhchem} % for \ce command - - - -% graphics and floats -\usepackage{float} % makes dealing with floats easier -\usepackage{graphicx} % allows for easy inclusion of graphics -\usepackage[shortlabels]{enumitem} % makes enumerate, itemize and description better -\usepackage{wrapfig} % Wraps text around figures with the \wrapfigure environment -\usepackage[dvipsnames]{xcolor} % colors and color mixing \color{red!30!green!40!blue} -\usepackage{pgfplots} % plots, 2D and 3D -\pgfplotsset{compat=1.18} % use version 1.13 -\usepackage{tikz} % Nice drawn graphics, for library see: https://tex.stackexchange.com/a/42664 -% \usetikzlibrary{intersections, angles, quotes, calc, positioning} -% \usetikzlibrary{arrows.meta} %TODO maybe deprecated? -% \usepackage{tikz-cd} % better commutative diagrams -% \usepackage{subcaption} % like caption package, but for subfigures -% \usepackage{booktabs} % better tables - - -% visuals -\usepackage{fancyhdr} % Text layout and margins, headers so on -\usepackage{microtype} % makes text better to read -\usepackage{multicol} % allows for multi-columns everywhere, with the "multicols" environment -\usepackage{emptypage} % no page numbers and headings on empty pages -% \usepackage[a4paper, left=2cm, right=2cm, top=2cm, bottom=2cm]{geometry} % For nice margins -% \usepackage{xspace} % Adds a space when it thinks it is necessary -\usepackage{blindtext} % blindtext - -% tikz style config -\tikzset{help_lines/.style={step=.5cm,gray!50,very thin}} - -% notes -% \usepackage{todonotes} - -% links -% \usepackage[hidelinks]{hyperref} % Links in the pdf -\usepackage[nospace]{varioref} -\usepackage[pdflang=%INIT_DATE_TIME_LANGUAGE]{hyperref} -% \hypersetup{ -% colorlinks, -% linkcolor={black}, -% citecolor={black}, -% urlcolor={blue!80!black} -% } - - -% \usepackage{stmaryrd} % for \lightning -% \newcommand\contra{\scalebox{1.1}{$\lightning$}} - -% number sets -\newcommand\N{\ensuremath{\mathbb{N}}} -\newcommand\R{\ensuremath{\mathbb{R}}} -\newcommand\Z{\ensuremath{\mathbb{Z}}} -\newcommand\Q{\ensuremath{\mathbb{Q}}} -\newcommand\C{\ensuremath{\mathbb{C}}} -\renewcommand\O{\ensuremath{\emptyset}} % replaces the Ø - -% readable limits -\let\svlim\lim{} -\renewcommand\lim{\svlim\limits} - -% aliases -\let\implies\Rightarrow{} -\let\impliedby\Leftarrow{} -\let\iff\Leftrightarrow{} - -\renewcommand\epsilon{\varepsilon} % I like the textual epsilon more -% \renewcommand\phi{\varphi} - -% horizontal rule -\newcommand\hr{ - \par\noindent\rule[0.5ex]{\linewidth}{0.5pt} - } - -% copyright: -\makeatletter -\DeclareRobustCommand\authors[1]{\gdef\@authors{#1}} -\DeclareRobustCommand\years[1]{\gdef\@years{#1}} -\makeatother - -% theorems -% packages: -\usepackage[framemethod=TikZ]{mdframed} -\mdfsetup{skipabove=1em,skipbelow=0em, innertopmargin=5pt, innerbottommargin=6pt} -\usepackage{amsthm} % math commands for theorems -\usepackage{thmtools} % improved theorems -\usepackage{environ} % for hiding of the solution env - -% styles: -% \renewcommand\qedsymbol{\ensuremath{\text{\textit{O.}}~\epsilon.~\delta.}} -\renewcommand\qedsymbol{\dots} -\theoremstyle{definition} -\declaretheoremstyle[ - headfont=\bfseries\sffamily\color{NavyBlue!80}, - bodyfont=\normalfont, - headpunct={:\\}, - qed=\qedsymbol, - mdframed={ - linewidth=2pt, - rightline=false, topline=false, bottomline=false, - linecolor=NavyBlue, backgroundcolor=NavyBlue!5, - }, - ]{thmexample} -\declaretheoremstyle[ - headfont=\bfseries\sffamily\color{RawSienna!80}, - bodyfont=\normalfont, - headpunct={:\\}, - qed=\qedsymbol, - mdframed={ - linewidth=2pt, - rightline=false, topline=false, bottomline=false, - linecolor=RawSienna, backgroundcolor=RawSienna!5, - }, - ]{thmexercise} -\declaretheoremstyle[ - headfont=\bfseries\sffamily\color{Violet!80}, - bodyfont=\normalfont, - headpunct={:\\}, - notebraces={f\"ur }{}, - qed=\qedsymbol, - mdframed={ - linewidth=2pt, - rightline=false, topline=false, bottomline=false, - linecolor=Violet, backgroundcolor=Violet!5, - }, - ]{thmsolution} -\declaretheoremstyle[ - headfont=\bfseries\sffamily\color{ForestGreen!80}, - bodyfont=\normalfont, - headpunct={:\\}, - qed=\qedsymbol, - mdframed={ - linewidth=2pt, - rightline=false, topline=false, bottomline=false, - linecolor=ForestGreen, backgroundcolor=ForestGreen!5, - }, - ]{thmdef} -\declaretheoremstyle[ - headfont=\bfseries\sffamily\color{RawSienna!70!black}, - bodyfont=\normalfont, - headpunct={:\\}, - qed=\qedsymbol, - mdframed={ - linewidth=2pt, - leftline=false, rightline=true, topline=false, bottomline=false, - linecolor=RawSienna, backgroundcolor=Red!5, - } - ]{thmtheorem} - -\declaretheorem[numbered=yes, style=thmdef, name=Definition]{definition} -\declaretheorem[numbered=no, style=thmexample,name=Beispiel]{eg} -\declaretheorem[numbered=no, style=thmexercise, name=Aufgabe]{ex} -\declaretheorem[numbered=yes, style=thmtheorem, name=Satz]{theorem} -% \declaretheorem[style=thmredbox, name=Proposition]{prop} -% \declaretheorem[style=thmredbox, name=Lemma]{lemma} -% \declaretheorem[style=thmredbox, numbered=no, name=Corollary]{corollary} - -% Solutions -\makeatletter -\@ifclasswith{report}{nosolutions} - {% - \NewEnviron{solution}[1][]{Eine L\"osung mit dem Name ("L\"osung für #1") wurde versteckt.\ \\ \par} - \newcommand\hdsolution[1]{L\"osung versteckt} - }{% - \declaretheorem[numbered=no, style=thmsolution, name=L\"osung]{replacementSolution} - - \NewEnviron{solution}[1][]{ - \vspace{-1em} - \begin{replacementSolution}[#1] - \ - \BODY - \end{replacementSolution} - } - \newcommand\hdsolution[1]{#1} - } -\makeatother - -\DTMnewdatestyle{margindate}{ - \renewcommand*\DTMdisplaydate[4]{ - \MakeLowercase{\DTMshortweekdayname{##4}}\space - \number##3\relax\space - \MakeLowercase{\DTMshortmonthname{##2}}\space - \DTMtwodigits{\DTMtwodigits{##1}} - } - \renewcommand*\DTMDisplaydate[4]{ - \DTMshortweekdayname{##4}\space - ##3\space - \DTMshortmonthname{##2}\space - \DTMtwodigits{\DTMtwodigits{##1}} - } - } - -\newcommand*\margindate[1]{ - \DTMsetdatestyle{margindate} - \marginpar{ - \small\textsf{\mbox{\DTMDate{#1}}} - }\relax - } - -\def\@lesson{}% -\newcommand{\lesson}[3]{ - \if\relax\detokenize{#3}\relax - \def\@lesson{Unterricht: #1}% - \else - % \def\@lesson{Unterricht #1: #3}% - \def\@lesson{#1: #3}% - \fi - \subsection*{\@lesson} - \margindate{#2} - } - -% \pagestyle{fancy} -% \fancyhf{} -% \fancyhead[LE, RO]{} -% \fancyhead[RO, LE]{\@lesson} -% \fancyhead[RE, LO]{} -% \fancyfoot[LE, RO]{\thepage} -% \fancyfoot[C]{\leftmark} - - -% Parameters -% \renewcommand{\sfdefault}{ptm} -% \pagenumbering{arabic} -% \setcounter{page}{2} -% \renewcommand{\thesection}{\Roman{section}} -% \renewcommand{\thesubsection}{\thesection.\Roman{subsection}} -% - -%% Footers and Headers -%\pagestyle{fancy} -%\fancyhf{} -%\renewcommand{\headrulewidth}{2pt} -%\renewcommand{\footrulewidth}{1pt} -%\renewcommand{\baselinestretch}{1.5} -%\fancyhead[L]{{\textbf{\titleset}}} -%\fancyhead[R]{\textbf{\course}} -%\fancyfoot[L]{\thepage} +\input{headers/preamble/mod.tex} +\input{headers/preamble/preamble_local.tex} diff --git a/build/latex/academia/headers/preamble/academia/mod.tex b/build/latex/academia/headers/preamble/academia/mod.tex new file mode 100644 index 0000000..39b9230 --- /dev/null +++ b/build/latex/academia/headers/preamble/academia/mod.tex @@ -0,0 +1,4 @@ +% derived from: +% https://github.com/gillescastel/lecture-notes/blob/929672a96abc27eaeb6fa58b1d277b3582d28532/group-theory/preamble.tex +\input{headers/preamble/academia/theorems/mod.tex} +\input{headers/preamble/academia/visuals.tex} diff --git a/build/latex/academia/headers/preamble/academia/theorems/definitions.tex b/build/latex/academia/headers/preamble/academia/theorems/definitions.tex new file mode 100644 index 0000000..4355b3c --- /dev/null +++ b/build/latex/academia/headers/preamble/academia/theorems/definitions.tex @@ -0,0 +1,90 @@ +\renewcommand\qedsymbol{\ensuremath{\text{\textit{O.}}~\epsilon.~\delta.}} +% \renewcommand\qedsymbol{\dots} + +\theoremstyle{definition} + + +\declaretheoremstyle[ + headfont=\bfseries\sffamily\color{NavyBlue!80}, + bodyfont=\normalfont, + headpunct={:\\}, + qed=\qedsymbol, + mdframed={ + linewidth=2pt, + rightline=false, topline=false, bottomline=false, + linecolor=NavyBlue, backgroundcolor=NavyBlue!5, + }, +]{thmexample} +\declaretheorem[numbered=no, style=thmexample,name=Beispiel]{eg} + +\declaretheoremstyle[ + headfont=\bfseries\sffamily\color{RawSienna!80}, + bodyfont=\normalfont, + headpunct={:\\}, + qed=\qedsymbol, + mdframed={ + linewidth=2pt, + rightline=false, topline=false, bottomline=false, + linecolor=RawSienna, backgroundcolor=RawSienna!5, + }, +]{thmexercise} +\declaretheorem[numbered=no, style=thmexercise, name=Aufgabe]{ex} + + +\declaretheoremstyle[ + headfont=\bfseries\sffamily\color{ForestGreen!80}, + bodyfont=\normalfont, + headpunct={:\\}, + qed=\qedsymbol, + mdframed={ + linewidth=2pt, + rightline=false, topline=false, bottomline=false, + linecolor=ForestGreen, backgroundcolor=ForestGreen!5, + }, +]{thmdef} +\declaretheorem[numbered=yes, style=thmdef, name=Definition]{definition} + +\declaretheoremstyle[ + headfont=\bfseries\sffamily\color{RawSienna!70!black}, + bodyfont=\normalfont, + headpunct={:\\}, + qed=\qedsymbol, + mdframed={ + linewidth=2pt, + leftline=false, rightline=true, topline=false, bottomline=false, + linecolor=RawSienna, backgroundcolor=Red!5, + } +]{thmtheorem} +\declaretheorem[numbered=yes, style=thmtheorem, name=Satz]{theorem} + + +\declaretheoremstyle[ + headfont=\bfseries\sffamily\color{Violet!80}, + bodyfont=\normalfont, + headpunct={:\\}, + notebraces={f\"ur }{}, + qed=\qedsymbol, + mdframed={ + linewidth=2pt, + rightline=false, topline=false, bottomline=false, + linecolor=Violet, backgroundcolor=Violet!5, + }, +]{thmsolution} +\makeatletter +\@ifclasswith{report}{nosolutions} +{% + \NewEnviron{solution}[1][]{Eine L\"osung mit dem Name ("L\"osung für #1") wurde ausgeblendet.\ \\ \par} + \newcommand\hdsolution[1]{L\"osung ausgeblendet} +}{% + \declaretheorem[numbered=no, style=thmsolution, name=L\"osung]{replacementSolution} + + \NewEnviron{solution}[1][]{ + \vspace{-1em} + \begin{replacementSolution}[#1] + \ + \BODY + \end{replacementSolution} + } + \newcommand\hdsolution[1]{#1} +} +\makeatother diff --git a/build/latex/academia/headers/preamble/academia/theorems/mod.tex b/build/latex/academia/headers/preamble/academia/theorems/mod.tex new file mode 100644 index 0000000..8350276 --- /dev/null +++ b/build/latex/academia/headers/preamble/academia/theorems/mod.tex @@ -0,0 +1,2 @@ +\input{headers/preamble/academia/theorems/definitions.tex} +\input{headers/preamble/academia/theorems/packages.tex} diff --git a/build/latex/academia/headers/preamble/academia/theorems/packages.tex b/build/latex/academia/headers/preamble/academia/theorems/packages.tex new file mode 100644 index 0000000..c881ab5 --- /dev/null +++ b/build/latex/academia/headers/preamble/academia/theorems/packages.tex @@ -0,0 +1,6 @@ +\usepackage[framemethod=TikZ]{mdframed} +\mdfsetup{skipabove=1em,skipbelow=0em, innertopmargin=5pt, innerbottommargin=6pt} + +\usepackage{amsthm} % math commands for theorems +\usepackage{thmtools} % improved theorems +\usepackage{environ} % for hiding of the solution env diff --git a/build/latex/academia/headers/preamble/academia/visuals.tex b/build/latex/academia/headers/preamble/academia/visuals.tex new file mode 100644 index 0000000..dada594 --- /dev/null +++ b/build/latex/academia/headers/preamble/academia/visuals.tex @@ -0,0 +1 @@ +\usepackage{fancyhdr} % Text layout and margins, headers so on diff --git a/build/latex/academia/headers/preamble/core/chemistry.tex b/build/latex/academia/headers/preamble/core/chemistry.tex new file mode 100644 index 0000000..94f2592 --- /dev/null +++ b/build/latex/academia/headers/preamble/core/chemistry.tex @@ -0,0 +1,5 @@ +\usepackage[locale = %INIT_SIUNITX_LANGUAGE]{siunitx} % For easy unit representation +\sisetup{per-mode = fraction} + +\usepackage[version=4]{mhchem} % for \ce command +\usepackage{chemfig} diff --git a/build/latex/academia/headers/preamble/core/copyright.tex b/build/latex/academia/headers/preamble/core/copyright.tex new file mode 100644 index 0000000..268b910 --- /dev/null +++ b/build/latex/academia/headers/preamble/core/copyright.tex @@ -0,0 +1,15 @@ +\ExplSyntaxOn +\cs_new_protected:Npn \SetAuthors #1 +{ + \tl_const:Nn \AuthorList {#1} +} +\cs_new_protected:Npn \SetYears #1 +{ + \tl_const:Nn \YearList {#1} +} +\ExplSyntaxOff + +\usepackage[scale=2]{ccicons} % Typeset the cc icons + +% TODO: Add a `\copyright` macro, that generates the copyright text automatically and +% language defined <2024-10-03> diff --git a/build/latex/academia/headers/preamble/core/date_and_time.tex b/build/latex/academia/headers/preamble/core/date_and_time.tex new file mode 100644 index 0000000..32e838d --- /dev/null +++ b/build/latex/academia/headers/preamble/core/date_and_time.tex @@ -0,0 +1 @@ +\usepackage[%INIT_DATE_TIME_LANGUAGE, showdow]{datetime2} % make handling dates easier diff --git a/build/latex/academia/headers/preamble/core/encoding.tex b/build/latex/academia/headers/preamble/core/encoding.tex new file mode 100644 index 0000000..1f48d2a --- /dev/null +++ b/build/latex/academia/headers/preamble/core/encoding.tex @@ -0,0 +1,4 @@ + +\usepackage[utf8]{inputenc} % use utf8 encoding +\usepackage[T1]{fontenc} % for 8bit font support +\usepackage{lmodern} % latin modern fonts, should be better than ae, aecompl diff --git a/build/latex/academia/headers/preamble/core/graphics_and_floats.tex b/build/latex/academia/headers/preamble/core/graphics_and_floats.tex new file mode 100644 index 0000000..b975c5f --- /dev/null +++ b/build/latex/academia/headers/preamble/core/graphics_and_floats.tex @@ -0,0 +1,22 @@ +\usepackage{graphicx} % allows for easy inclusion of graphics +\usepackage{xcolor} % colors and color mixing \color{red!30!green!40!blue} + +\usepackage{tikz} % Nice drawn graphics, for library see: https://tex.stackexchange.com/a/42664 +\usetikzlibrary{calc} + +\usepackage{pgfplots} % plots, 2D and 3D +\pgfplotsset{compat=1.19} % 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? + +% \usepackage{tikz-cd} % better commutative diagrams +% \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 diff --git a/build/latex/academia/headers/preamble/core/index.tex b/build/latex/academia/headers/preamble/core/index.tex new file mode 100644 index 0000000..a52cc20 --- /dev/null +++ b/build/latex/academia/headers/preamble/core/index.tex @@ -0,0 +1,8 @@ +\usepackage{index} % Helps to create an index +\makeindex + +\ifdraft{ + \usepackage{showidx} +} { + \message {Draft packages not loaded, showidx not loaded.} +} diff --git a/build/latex/academia/headers/preamble/core/linting.tex b/build/latex/academia/headers/preamble/core/linting.tex new file mode 100644 index 0000000..a1bbe34 --- /dev/null +++ b/build/latex/academia/headers/preamble/core/linting.tex @@ -0,0 +1 @@ +\usepackage{nag} diff --git a/build/latex/academia/headers/preamble/core/margindate.tex b/build/latex/academia/headers/preamble/core/margindate.tex new file mode 100644 index 0000000..5579f98 --- /dev/null +++ b/build/latex/academia/headers/preamble/core/margindate.tex @@ -0,0 +1,37 @@ +\DTMnewdatestyle{margindate}{ + \renewcommand*\DTMdisplaydate[4]{ + \MakeLowercase{\DTMshortweekdayname{##4}}\space + \number##3\relax\space + \MakeLowercase{\DTMshortmonthname{##2}}\space + \DTMtwodigits{\DTMtwodigits{##1}} + } + \renewcommand*\DTMDisplaydate[4]{ + \DTMshortweekdayname{##4}\space + ##3\space + \DTMshortmonthname{##2}\space + \DTMtwodigits{\DTMtwodigits{##1}} + } +} + +\NewDocumentCommand\MarginContent{m}{ + \marginpar{ + \small\textsf{\mbox{#1}} + }\relax +} + +\NewDocumentCommand\MarginDate{m}{ + { + \DTMsetdatestyle{margindate} + + \MarginContent{\DTMDate{#1}} + } +} + +\NewDocumentCommand\AnnotatedSection{m m}{ + \section{#1} + \MarginContent{#2} +} +\NewDocumentCommand\DatedSection{m m}{ + \section{#1} + \MarginDate{#2} +} diff --git a/build/latex/academia/headers/preamble/core/math.tex b/build/latex/academia/headers/preamble/core/math.tex new file mode 100644 index 0000000..35144df --- /dev/null +++ b/build/latex/academia/headers/preamble/core/math.tex @@ -0,0 +1,25 @@ +\usepackage{amsmath} % extensive math commands +\usepackage{amsfonts} % more fonts for math (fracture, boldfaced and so on) +\usepackage{mathtools} % extension to amsmath, with more sensible defaults (eq numbers only when referenced) +\usepackage{amssymb} % more symbols, mostly redundant because already loaded by something else +\usepackage{mathrsfs} % support for the RSFS fonts (through \mathscr command) +\usepackage{cancel} % allows to cancel a part in math mode, for example to shorten a term +\usepackage{bm} % bold mode in math, but better than \boldsymbol command from ams. \bm + +% number sets +\NewDocumentCommand\N{}{\ensuremath{\mathbb{N}}} +\NewDocumentCommand\R{}{\ensuremath{\mathbb{R}}} +\NewDocumentCommand\Z{}{\ensuremath{\mathbb{Z}}} +\NewDocumentCommand\Q{}{\ensuremath{\mathbb{Q}}} +\NewDocumentCommand\C{}{\ensuremath{\mathbb{C}}} +\NewDocumentCommand\O{}{\ensuremath{\emptyset}} % replaces the Ø + +% readable limits +\let\svlim\lim{} +\renewcommand\lim{\svlim\limits} + +% aliases +\let\implies\Rightarrow{} +\let\impliedby\Leftarrow{} + +\let\epsilon{\varepsilon} % I like the textual epsilon more diff --git a/build/latex/academia/headers/preamble/core/mod.tex b/build/latex/academia/headers/preamble/core/mod.tex new file mode 100644 index 0000000..3a800a1 --- /dev/null +++ b/build/latex/academia/headers/preamble/core/mod.tex @@ -0,0 +1,15 @@ +% Core packages (used in the implementation of this preamble) +\usepackage{ifdraft} + +\input{headers/preamble/core/chemistry.tex} +\input{headers/preamble/core/copyright.tex} +\input{headers/preamble/core/date_and_time.tex} +\input{headers/preamble/core/encoding.tex} +\input{headers/preamble/core/graphics_and_floats.tex} +\input{headers/preamble/core/index.tex} +\input{headers/preamble/core/linting.tex} +\input{headers/preamble/core/margindate.tex} +\input{headers/preamble/core/math.tex} +\input{headers/preamble/core/notes.tex} +\input{headers/preamble/core/references.tex} +\input{headers/preamble/core/visuals.tex} diff --git a/build/latex/academia/headers/preamble/core/notes.tex b/build/latex/academia/headers/preamble/core/notes.tex new file mode 100644 index 0000000..8eab467 --- /dev/null +++ b/build/latex/academia/headers/preamble/core/notes.tex @@ -0,0 +1 @@ +\usepackage[obeyFinal,%INIT_BABLE_LANGUAGE]{todonotes} diff --git a/build/latex/academia/headers/preamble/core/references.tex b/build/latex/academia/headers/preamble/core/references.tex new file mode 100644 index 0000000..69a6ad6 --- /dev/null +++ b/build/latex/academia/headers/preamble/core/references.tex @@ -0,0 +1,37 @@ +\usepackage[%INIT_BABLE_LANGUAGE]{babel} % For language support +\usepackage{csquotes} % required by biblatex + +% \usepackage{biblatex-dw} +\usepackage[backend=biber, + % style=footnote-dw, + % pageref=true, + % annotation=true, + % library=true, + % + style=numeric, + autocite=plain, + doi=true, + isbn=true, + loccittracker=true, + opcittracker=true, + % No idea what it does, but it was recomended to me + defernumbers=true +]{biblatex} % For bibtex references +\addbibresource{ref/references.bib} +% \bibliography{res/reference} % Set the location of the references + +\usepackage[nospace,%INIT_BABLE_LANGUAGE]{varioref} % for \vref +\usepackage[%INIT_BABLE_LANGUAGE, noabbrev, nameinlink]{cleveref} +\usepackage[pdflang=%INIT_DATE_TIME_LANGUAGE]{hyperref} +\hypersetup{ + colorlinks, + linkcolor={black}, + citecolor={black}, + urlcolor={blue!80!black} +} + +\ifdraft{ + \usepackage{showlabels} +} { + \message {Draft packages not loaded, showlabels not loaded.} +} diff --git a/build/latex/academia/headers/preamble/core/visuals.tex b/build/latex/academia/headers/preamble/core/visuals.tex new file mode 100644 index 0000000..96a2fd2 --- /dev/null +++ b/build/latex/academia/headers/preamble/core/visuals.tex @@ -0,0 +1,10 @@ +\usepackage[disable=ifdraft]{microtype} % makes text better to read +\usepackage{emptypage} % no page numbers and headings on empty pages + +\usepackage{blindtext} % blindtext + + +% horizontal rule +\NewDocumentCommand{\hr}{}{ + \par\noindent\rule[0.5ex]{\linewidth}{0.5pt} +} diff --git a/build/latex/academia/headers/preamble/mod.tex b/build/latex/academia/headers/preamble/mod.tex new file mode 100644 index 0000000..91ae2d7 --- /dev/null +++ b/build/latex/academia/headers/preamble/mod.tex @@ -0,0 +1,2 @@ +\input{headers/preamble/academia/mod.tex} +\input{headers/preamble/core/mod.tex} diff --git a/build/latex/academia/lpm.toml b/build/latex/academia/lpm.toml index d72f80f..1821b73 100644 --- a/build/latex/academia/lpm.toml +++ b/build/latex/academia/lpm.toml @@ -5,12 +5,30 @@ section = ''' %! TEX root = ../../../%INIT_APPLICATION_NAME.tex % LTeX: language=%INIT_LANGUAGE -\section{REPLACMENT_SECTION_TITLE} % DATE +\section{lpm::new_section_name} % lpm::current_date (lpm::current_chapter_name::title_case) ''' chapter = ''' %! TEX root = ../../%INIT_APPLICATION_NAME.tex % LTeX: language=%INIT_LANGUAGE -\chapter{REPLACEMENT_CHAPTER} +\chapter{lpm::new_chapter_name} % lpm::current_date +''' + +figure = ''' +% LTeX: language=%INIT_LANGUAGE +\documentclass[varwidth]{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!}; +\end{tikzpicture} + +\end{document} ''' diff --git a/build/latex/letter/build.sh b/build/latex/letter/build.sh index 1206ee7..c67ad52 100755 --- a/build/latex/letter/build.sh +++ b/build/latex/letter/build.sh @@ -1,14 +1,30 @@ #!/usr/bin/env sh -# if no parameter is given, use 'dst' as destination directory -if [ -z "$1" ]; then - dst=build -else - dst="$1" -fi +file="./%INIT_APPLICATION_NAME.tex" +dst=build + +clear=false + +for arg in "$@"; do + case "$arg" in + "--clear") + clear=true + ;; + --*) + echo "No such option: '$arg'" + exit 2 + ;; + *) + file="$arg" + ;; + esac +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 mkdir --parents "$dst/$dir" done -latexmk -outdir="$dst" -file-line-error -pdflatex -recorder "./%INIT_APPLICATION_NAME.tex" + +test "$clear" = true && rm "$dst/${file%tex}out" + +latexmk -outdir="$dst" -file-line-error -pdflatex -recorder "$file" diff --git a/build/latex/letter/flake.nix b/build/latex/letter/flake.nix index 4847a9c..6a21c68 100644 --- a/build/latex/letter/flake.nix +++ b/build/latex/letter/flake.nix @@ -18,6 +18,17 @@ flake-utils.follows = "flake-utils"; }; }; + lpm = { + url = "git+https://codeberg.org/bpeetz/lpm.git"; + inputs = { + nixpkgs.follows = "nixpkgs"; + flake-compat.follows = "flake-compat"; + flake-utils.follows = "flake-utils"; + rust-overlay.follows = "rust-overlay"; + crane.follows = "crane"; + systems.follows = "systems"; + }; + }; # inputs for following systems = { @@ -33,6 +44,19 @@ systems.follows = "systems"; }; }; + crane = { + url = "github:ipetkov/crane"; + inputs = { + nixpkgs.follows = "nixpkgs"; + }; + }; + rust-overlay = { + url = "github:oxalica/rust-overlay"; + inputs = { + nixpkgs.follows = "nixpkgs"; + flake-utils.follows = "flake-utils"; + }; + }; }; outputs = { @@ -40,6 +64,7 @@ nixpkgs, flake-utils, treefmt-nix, + lpm, flake_version_update, ... }: @@ -73,7 +98,7 @@ ''; installPhase = '' - install -D ./build/main.pdf "$out/%INIT_APPLICATION_NAME.pdf"; + install -D "./build/%INIT_APPLICATION_NAME.pdf" "$out/%INIT_APPLICATION_NAME.pdf"; ''; }; in { @@ -91,6 +116,7 @@ cocogitto reuse flake_version_update.packages."${system}".default + lpm.packages."${system}".default texlive zathura |