├── .gitattributes
├── .github
└── workflows
│ └── main.yml
├── .gitignore
├── .latexmkrc
├── LICENSE
├── README.md
├── anc
└── ancillary.md
├── chapters
├── Appendix.tex
├── Design.tex
├── Features.tex
├── Introduction.tex
├── Notation.tex
├── QuickSummary.tex
├── Summary.tex
├── Tips.tex
└── Usage.tex
├── figures
├── Inkscape
│ ├── add-watermark
│ ├── inkscape-export-to-latex
│ ├── parallel-plate-capacitor.pdf
│ ├── parallel-plate-capacitor.pdf_tex
│ ├── parallel-plate-capacitor.svg
│ ├── template.svg
│ └── watermark-template.ps
├── TeXtured-logo-dark-mode.svg
└── TeXtured-logo-light-mode.svg
├── frontmatter
├── declaration.tex
├── dedication.tex
├── img
│ └── MFF-logo.pdf
├── information.tex
└── title.tex
├── preamble
├── bibliography.bib
├── data.tex
├── debug
│ ├── commands.tex
│ ├── line-numbers.tex
│ └── silence.tex
├── environments
│ ├── init.tex
│ ├── remark-like.tex
│ ├── theorem-like.tex
│ └── todo-like.tex
├── general
│ ├── colors.tex
│ ├── floats.tex
│ ├── hyperref.tex
│ └── typesetting.tex
├── hacks
│ ├── custom-reference-boxes.tex
│ ├── fix-hyperref.tex
│ ├── fix-qed.tex
│ └── floatrow-parskip.tex
├── layout
│ ├── geometry.tex
│ ├── headers.tex
│ ├── numbering.tex
│ ├── titles.tex
│ └── toc.tex
├── main.tex
├── math
│ ├── fonts.tex
│ ├── macros.tex
│ ├── packages.tex
│ └── spacing.tex
├── misc
│ ├── inkscape.tex
│ ├── macros.tex
│ ├── packages-macros.tex
│ └── tikz.tex
├── pdfA-compliance
│ ├── LaTeX-find-glyph-name
│ │ ├── .latexmkrc
│ │ └── LaTeX-find-glyph-name.tex
│ └── glyphtounicode.tex
├── references
│ ├── backref.tex
│ ├── biblatex-extra-fields.dbx
│ ├── biblatex.tex
│ ├── cite.tex
│ ├── doi-eprint-url.tex
│ ├── fields.tex
│ └── style.tex
├── toggles.tex
└── user
│ ├── macros.tex
│ ├── main.tex
│ └── math.tex
└── thesis.tex
/.gitattributes:
--------------------------------------------------------------------------------
1 | # Store large files in LFS (Large File Storage)
2 | figures/large/* filter=lfs diff=lfs merge=lfs -text
3 |
4 | # If you decide to store the generated PDF in repository,
5 | # it is preferred to use LFS (Large File Storage)
6 | /*.pdf filter=lfs diff=lfs merge=lfs -text
7 |
--------------------------------------------------------------------------------
/.github/workflows/main.yml:
--------------------------------------------------------------------------------
1 | name: CI
2 |
3 | on:
4 | push:
5 | branches: [ master ]
6 | pull_request:
7 | branches: [ master ]
8 | workflow_dispatch:
9 |
10 | jobs:
11 | ## thanks to https://github.com/exaexa/better-mff-thesis
12 | ## and https://github.com/mff-cuni-cz/cuni-thesis-validator
13 | build:
14 | name: Build PDF and upload as an artifact
15 | runs-on: ubuntu-latest
16 | steps:
17 | - name: Set up Git repository
18 | uses: actions/checkout@v4
19 | with:
20 | lfs: true
21 | - name: Compile LaTeX document
22 | uses: xu-cheng/latex-action@v3
23 | with:
24 | root_file: thesis.tex
25 | texlive_version: latest # must be `2024` or later (`latest` chosen by default)
26 | extra_system_packages: coreutils icu inkscape # `coreutils` for `mktemp`, `icu` for `uconv`
27 | - name: Upload the artifact
28 | uses: actions/upload-artifact@v4
29 | with:
30 | name: Thesis
31 | path: |
32 | README.md
33 | thesis.pdf
34 | verify:
35 | name: Verify PDF/A
36 | runs-on: ubuntu-latest
37 | needs: build
38 | container: { image: ghcr.io/jdujava/cuni-thesis-validator }
39 | steps:
40 | - name: Get the PDF file from the artifact
41 | uses: actions/download-artifact@v4
42 | - name: Verify the PDF file with VeraPDF
43 | run: verify Thesis/*.pdf | tee /dev/stderr | grep -qE 'nonCompliant="0" failedJobs="0"'
44 |
45 | ## inspired by https://github.com/Pseudomanifold/latex-mimosis
46 | deploy:
47 | name: Deploy latest build of PDF and README.md to gh-pages branch
48 | if: github.event_name == 'push' # only deploy on push
49 | runs-on: ubuntu-latest
50 | needs: build
51 | permissions:
52 | contents: write
53 | steps:
54 | - name: Get the PDF and README.md from the artifact
55 | uses: actions/download-artifact@v4
56 | - name: Commit and push the PDF and README.md to `gh-pages` branch
57 | run: |
58 | cd Thesis
59 | git init -b temp
60 | git config user.name github-actions[bot]
61 | git config user.email 41898282+github-actions[bot]@users.noreply.github.com
62 | git remote add origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/$GITHUB_REPOSITORY
63 | git add .
64 | git commit -m "[CI] Update to latest PDF and README.md"
65 | git push --force origin temp:gh-pages
66 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | ## LaTeX auxiliary files:
2 | .aux
3 | *.synctex.gz
4 | *.synctex.gz(busy)
5 |
6 | ## Since the main PDF file is automatically generated with GitHub Actions
7 | ## and pushed to `gh-pages` branch, is is generally advised to ignore it
8 | ## (which makes the repository smaller and faster to clone)
9 | /*.pdf
10 |
11 | ## LanguageTool
12 | .ltex
13 |
14 | ## ignore "old" PDF files
15 | *_old.pdf
16 |
--------------------------------------------------------------------------------
/.latexmkrc:
--------------------------------------------------------------------------------
1 | ## This file contains instructions and configurations for the `latexmk` program
2 |
3 | ## Choose TeX engine for PDF generation
4 | $pdf_mode = 1; # use pdfTeX
5 | # $pdf_mode = 4; # use LuaTeX
6 |
7 | ### Additional flags for the TeX engine
8 | ## --shell-escape: enable external/system commands (e.g. Inkscape)
9 | ## --file-line-error: writes out the concrete file line in which the error occurred
10 | ## --halt-on-error: stop processing at the first error
11 | ## %O and %S will forward Options and the Source file, respectively, given to latexmk.
12 | set_tex_cmds("--shell-escape --file-line-error --halt-on-error %O %S");
13 |
14 | ## Change default `biber` call to help catch errors faster/clearer. See
15 | ## https://www.semipol.de/posts/2018/06/latex-best-practices-lessons-learned-from-writing-a-phd-thesis/
16 | $biber = "biber --validate-datamodel %O %S";
17 |
18 | ## Show used CPU time. Looks like: https://tex.stackexchange.com/a/312224/120853
19 | $show_time = 1;
20 |
21 | ## Extra extensions of files to remove in a clean-up (`latexmk -c`)
22 | $clean_ext = 'synctex.gz synctex.gz(busy)';
23 | ## Delete .bbl file in a clean-up if the bibliography file exists
24 | $bibtex_use = 1.5;
25 |
26 | ## Write all auxiliary files in a separate directory
27 | $aux_dir = '.aux';
28 |
29 | ## The aux directory structure has to match the source directory structure
30 | ## in order to compile the `tex` files without problems, since pdfLaTeX
31 | ## does not create the directories on its own.
32 | ## https://tex.stackexchange.com/questions/323820/i-cant-write-on-file-foo-aux
33 | ## NOTE: the following handles only one level of subdirectories
34 | print `find . -maxdepth 2 -type f -name "*.tex" | # find all tex files up to 2 levels deep
35 | sed -nE 's|\\./(.*)/.*|\\1|p' | sort -u | # extract directory names
36 | xargs -I {} mkdir -pv "$aux_dir"/{} # create corresponding directories in aux_dir`;
37 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | Creative Commons Legal Code
2 |
3 | CC0 1.0 Universal
4 |
5 | CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT PROVIDE
6 | LEGAL SERVICES. DISTRIBUTION OF THIS DOCUMENT DOES NOT CREATE AN
7 | ATTORNEY-CLIENT RELATIONSHIP. CREATIVE COMMONS PROVIDES THIS
8 | INFORMATION ON AN "AS-IS" BASIS. CREATIVE COMMONS MAKES NO WARRANTIES
9 | REGARDING THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS
10 | PROVIDED HEREUNDER, AND DISCLAIMS LIABILITY FOR DAMAGES RESULTING FROM
11 | THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS PROVIDED
12 | HEREUNDER.
13 |
14 | Statement of Purpose
15 |
16 | The laws of most jurisdictions throughout the world automatically confer
17 | exclusive Copyright and Related Rights (defined below) upon the creator
18 | and subsequent owner(s) (each and all, an "owner") of an original work of
19 | authorship and/or a database (each, a "Work").
20 |
21 | Certain owners wish to permanently relinquish those rights to a Work for
22 | the purpose of contributing to a commons of creative, cultural and
23 | scientific works ("Commons") that the public can reliably and without fear
24 | of later claims of infringement build upon, modify, incorporate in other
25 | works, reuse and redistribute as freely as possible in any form whatsoever
26 | and for any purposes, including without limitation commercial purposes.
27 | These owners may contribute to the Commons to promote the ideal of a free
28 | culture and the further production of creative, cultural and scientific
29 | works, or to gain reputation or greater distribution for their Work in
30 | part through the use and efforts of others.
31 |
32 | For these and/or other purposes and motivations, and without any
33 | expectation of additional consideration or compensation, the person
34 | associating CC0 with a Work (the "Affirmer"), to the extent that he or she
35 | is an owner of Copyright and Related Rights in the Work, voluntarily
36 | elects to apply CC0 to the Work and publicly distribute the Work under its
37 | terms, with knowledge of his or her Copyright and Related Rights in the
38 | Work and the meaning and intended legal effect of CC0 on those rights.
39 |
40 | 1. Copyright and Related Rights. A Work made available under CC0 may be
41 | protected by copyright and related or neighboring rights ("Copyright and
42 | Related Rights"). Copyright and Related Rights include, but are not
43 | limited to, the following:
44 |
45 | i. the right to reproduce, adapt, distribute, perform, display,
46 | communicate, and translate a Work;
47 | ii. moral rights retained by the original author(s) and/or performer(s);
48 | iii. publicity and privacy rights pertaining to a person's image or
49 | likeness depicted in a Work;
50 | iv. rights protecting against unfair competition in regards to a Work,
51 | subject to the limitations in paragraph 4(a), below;
52 | v. rights protecting the extraction, dissemination, use and reuse of data
53 | in a Work;
54 | vi. database rights (such as those arising under Directive 96/9/EC of the
55 | European Parliament and of the Council of 11 March 1996 on the legal
56 | protection of databases, and under any national implementation
57 | thereof, including any amended or successor version of such
58 | directive); and
59 | vii. other similar, equivalent or corresponding rights throughout the
60 | world based on applicable law or treaty, and any national
61 | implementations thereof.
62 |
63 | 2. Waiver. To the greatest extent permitted by, but not in contravention
64 | of, applicable law, Affirmer hereby overtly, fully, permanently,
65 | irrevocably and unconditionally waives, abandons, and surrenders all of
66 | Affirmer's Copyright and Related Rights and associated claims and causes
67 | of action, whether now known or unknown (including existing as well as
68 | future claims and causes of action), in the Work (i) in all territories
69 | worldwide, (ii) for the maximum duration provided by applicable law or
70 | treaty (including future time extensions), (iii) in any current or future
71 | medium and for any number of copies, and (iv) for any purpose whatsoever,
72 | including without limitation commercial, advertising or promotional
73 | purposes (the "Waiver"). Affirmer makes the Waiver for the benefit of each
74 | member of the public at large and to the detriment of Affirmer's heirs and
75 | successors, fully intending that such Waiver shall not be subject to
76 | revocation, rescission, cancellation, termination, or any other legal or
77 | equitable action to disrupt the quiet enjoyment of the Work by the public
78 | as contemplated by Affirmer's express Statement of Purpose.
79 |
80 | 3. Public License Fallback. Should any part of the Waiver for any reason
81 | be judged legally invalid or ineffective under applicable law, then the
82 | Waiver shall be preserved to the maximum extent permitted taking into
83 | account Affirmer's express Statement of Purpose. In addition, to the
84 | extent the Waiver is so judged Affirmer hereby grants to each affected
85 | person a royalty-free, non transferable, non sublicensable, non exclusive,
86 | irrevocable and unconditional license to exercise Affirmer's Copyright and
87 | Related Rights in the Work (i) in all territories worldwide, (ii) for the
88 | maximum duration provided by applicable law or treaty (including future
89 | time extensions), (iii) in any current or future medium and for any number
90 | of copies, and (iv) for any purpose whatsoever, including without
91 | limitation commercial, advertising or promotional purposes (the
92 | "License"). The License shall be deemed effective as of the date CC0 was
93 | applied by Affirmer to the Work. Should any part of the License for any
94 | reason be judged legally invalid or ineffective under applicable law, such
95 | partial invalidity or ineffectiveness shall not invalidate the remainder
96 | of the License, and in such case Affirmer hereby affirms that he or she
97 | will not (i) exercise any of his or her remaining Copyright and Related
98 | Rights in the Work or (ii) assert any associated claims and causes of
99 | action with respect to the Work, in either case contrary to Affirmer's
100 | express Statement of Purpose.
101 |
102 | 4. Limitations and Disclaimers.
103 |
104 | a. No trademark or patent rights held by Affirmer are waived, abandoned,
105 | surrendered, licensed or otherwise affected by this document.
106 | b. Affirmer offers the Work as-is and makes no representations or
107 | warranties of any kind concerning the Work, express, implied,
108 | statutory or otherwise, including without limitation warranties of
109 | title, merchantability, fitness for a particular purpose, non
110 | infringement, or the absence of latent or other defects, accuracy, or
111 | the present or absence of errors, whether or not discoverable, all to
112 | the greatest extent permissible under applicable law.
113 | c. Affirmer disclaims responsibility for clearing rights of other persons
114 | that may apply to the Work or any use thereof, including without
115 | limitation any person's Copyright and Related Rights in the Work.
116 | Further, Affirmer disclaims responsibility for obtaining any necessary
117 | consents, permissions or other rights required for any use of the
118 | Work.
119 | d. Affirmer understands and acknowledges that Creative Commons is not a
120 | party to this document and has no duty or obligation with respect to
121 | this CC0 or use of the Work.
122 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | [](https://jdujava.github.io/TeXtured/thesis.pdf)
8 | [](https://github.com/jdujava/TeXtured/releases)
9 | [](#-license)
10 | [](https://jdujava.github.io/TeXtured/thesis.pdf)
11 | [](https://github.com/jdujava/TeXtured/stargazers)
12 |
13 |
14 |
15 | Do you care in the slightest about what your readers think about your document,
16 | and by proxy about you and your competence level? If yes, then a classy,
17 | typographically professional layout and structured, clear, and revealing content
18 | can only help. This template tries to aid you in both of these endeavors.
19 |
20 | Here’s what the **TeXtured** Template offers:
21 | - ✨ **typographically elegant layout** with various features to make your document stand out
22 | - 🧙 **clean code structure** with plenty of comments to help you easily customize the template to your needs
23 | - 🔗 **seamless GitHub integration** (via GitHub Actions) to streamline version control and collaboration
24 | - 📄 **PDF/A compliance** and *front matter* supporting theses at [MFF](https://www.mff.cuni.cz/en) 🎓
25 |
26 | To learn more about the design principles behind `TeXtured` and its capabilities, look at the
27 | [ ](https://jdujava.github.io/TeXtured/thesis.pdf).
28 | It showcases the features of `TeXtured` template and provides a guide on how to use them.
29 |
30 | > [!NOTE]
31 | > Please note that the documentation is still a work-in-progress 🚧,
32 | > with more guides and explanations to come.
33 |
34 | > [!TIP]
35 | > If you find something interesting or useful, but adopting the whole template
36 | > is simply too much, feel free to just copy and use relevant parts of the code.
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 | ## 🏗️ Building
45 |
46 | Be sure to have all the dependencies installed — at least the `LaTeX` build tools, see below — and run
47 | ```sh
48 | latexmk thesis
49 | ```
50 | in the root directory of the repository to build the document.
51 |
52 | > [!TIP]
53 | > If you prefer to use 🍃 `Overleaf`, you can find the `TeXtured` template
54 | > [ ](https://www.overleaf.com/latex/templates/textured/zwtzzwgddbsh)
55 | > there as well.
56 |
57 |
58 | ## 📦 Software Dependencies
59 |
60 | LaTeX build tools:
61 | - `latexmk` - LaTeX build tool
62 | - `pdflatex`/`lualatex` - LaTeX engine (you can choose one in `.latexmkrc`)
63 | - `biber` - bibliography processing tool for `biblatex`
64 |
65 | > [!WARNING]
66 | > To properly build the documenet, the template requires `TeX Live` 2024 or later (otherwise, some packages may not be available, or you may encounter some bugs).
67 | > Using the latest version of `TeX Live` is highly recommended, which is used in the Github Actions workflow to build
68 | > [ ](https://jdujava.github.io/TeXtured/thesis.pdf).
69 |
70 | > [!NOTE]
71 | > Some scripts assume `linux` environment. These include:
72 | > - generation of directory structure for `aux_dir` (dependencies are `sed`, `xargs`)
73 | > - vector figure generation (together with watermark)
74 | > + need to enable `--shell-escape` in `.latexmkrc`
75 | > + `inkscape` - vector graphics (and SVG to PDF conversion)
76 | > + `perl` - disabling `/Interpolation` in PDFs generated by `inkscape`
77 | > + `sed`, `uconv` - substituting placeholders in PDF watermark
78 | > + `ghostscript` - injecting `postscript` watermark into PDF
79 |
80 | Version control (optional):
81 | - `git` - the preferred version control system
82 | - `git-lfs` - [Git Large File Storage](https://git-lfs.github.com/) - for storing PDFs, figures, etc.
83 |
84 |
85 | ## 📜 License
86 |
87 | Exceptions:
88 | - The MFF CUNI logo `MFF-logo.pdf` is property of the corresponding faculty, see [MFF Visual Identity](https://www.mff.cuni.cz/en/faculty/visual-identity).
89 | - Figure `parallel-plate-capacitor.svg` (with corresponding files) is property of Jonáš Dujava.
90 |
91 | [ ](https://creativecommons.org/publicdomain/zero/1.0/)
92 | All other files are marked with
93 | [ ](https://creativecommons.org/publicdomain/zero/1.0/).
94 |
95 | Even though you are free to use the source code of `TeXtured` any way you like, attribution/acknowledgement is welcome.
96 |
--------------------------------------------------------------------------------
/anc/ancillary.md:
--------------------------------------------------------------------------------
1 | # Ancillary files
2 |
3 | You can put ancillary files (usually source code) in this directory, and arXiv will display them.
4 |
--------------------------------------------------------------------------------
/chapters/Appendix.tex:
--------------------------------------------------------------------------------
1 | \chapter{Example of Appendix Chapter} \label{appendix:example}
2 |
3 | \begin{example}[Figure Caption Tweaking]
4 | Now we will show off some figures with tweaked position/extent of the captions.
5 | \Cref{fig:parallel-plate-capacitor} has a side-caption, while \Cref{fig:tighter_caption} has a caption that spans just the width of the figure.
6 | This utilizes the \package{floatrow} package and is inspired by the ITT \LaTeX{} template \autocite{ITTtemplate}.
7 | \end{example}
8 |
9 | \begin{figure}[!ht]
10 | \exportInkscapeSVG{parallel-plate-capacitor}% export already here, such that we can use it in the caption
11 | \fcapside[\FBwidth]{%
12 | \caption[Example of a figure with a side-caption.]{
13 | Example of a figure with a side-caption.
14 |
15 | It displays the two-dimensional electric field near one end of a parallel plate capacitor.
16 | \vspace{1ex}
17 |
18 | \textbf{\textsf{Legend:}}\\[0.4ex]
19 | \begin{tblr}{stretch=0.8, column{1} = {rightsep=2pt, cmd=\raisebox{-0.31ex}}}
20 | \adjincludegraphics[width=0.6\textwidth, Clip={0.87\width} {0.483\height} {0.0\height} {0.483\height}]{parallel-plate-capacitor} & equipotentials \\
21 | \adjincludegraphics[width=0.6\textwidth, Clip={0.35\width} {0.068\height} {0.52\width} {0.898\height}]{parallel-plate-capacitor} & field lines \\
22 | \adjincludegraphics[width=0.6\textwidth, Clip={0.20\width} {0.313\height} {0.67\width} {0.653\height}]{parallel-plate-capacitor} & capacitor plate \\
23 | \end{tblr}%
24 | }%
25 | \label{fig:parallel-plate-capacitor}%
26 | \floatfoot{You can also optionally use a footnote\\ for the figure caption.}%
27 | }{\includeInkscapeSVG[0.6\textwidth]{parallel-plate-capacitor}}%
28 | \end{figure}
29 | \begin{figure}[!ht]
30 | \ffigbox[\FBwidth]{%
31 | \caption{Example of a figure with a caption spanning just the width of the figure.}%
32 | \label{fig:tighter_caption}%
33 | }{\includegraphics[width=0.6\textwidth]{example-image-a}}
34 | \end{figure}
35 |
36 | \clearpage
37 | \begin{example}[Multi-Paragraph Figure Caption with Verbatim Text]
38 | It is possible to have multi-paragraph captions for figures.
39 | One must remember to provide a short description as \macro{\caption[This is a Short Description]{...}}, or else \LaTeX{} will complain.
40 |
41 | See \Cref{fig:multi-paragraph_verbatim_figure} for an example, demonstrating also a workaround for typesetting verbatim text in contexts where \enquote{fragile} commands are not allowed.
42 | \end{example}
43 | \begin{figure}[!ht]
44 | \includegraphics[width=0.6\textwidth]{example-image-b}
45 | \caption[Necessary to provide short description.]{
46 | Example of a figure with a multi-paragraph caption.
47 |
48 | Notice the spacing between the paragraphs.
49 | It was customized using the \fakemacro{parskip} key in \fakemacro{\captionsetup} provided by the \package{caption} package.
50 |
51 | To typeset verbatim text in the caption, use the \fakemacro{\fakeverb{...}} command instead of the usual \fakemacro{\verb|...|}, which is not allowed in captions.
52 | }%
53 | \label{fig:multi-paragraph_verbatim_figure}%
54 | \end{figure}
55 |
56 | \section{Appendix Section}%
57 | \label{sec:Appendix Section}
58 |
59 | Note the numbering of various environments in the appendix.
60 |
61 | \begin{definition}[Math in the Description --- \(\sin(\alpha)\approx\alpha\)]
62 | This is an example definition in an Appendix.
63 | Note the automatic switch to the alternative sans math font in the Definition description.
64 | \end{definition}
65 |
66 | \begin{remark}
67 | The page header reflects that this is an appendix page.
68 | \end{remark}
69 |
70 | \begin{example}[Equation Numbering and Referencing]
71 | As was mentioned already in \Cref{sec:Document Structure}, equations share numbering with \emph{structure environments}.
72 | For example, the equation
73 | \begin{equation} \label{eq:appendix_equation}
74 | \phi^{*}\bm{g}' \overset{!}{=} \Omega^{2}\bm{g} \equiv \E*^{2\omega}\bm{g}
75 | \end{equation}
76 | is numbered as \eqref{eq:appendix_equation} in the appendix.
77 |
78 | We can reference this equation using \custommacro{\Cref} as \Cref{eq:appendix_equation}.
79 | Starred variant \custommacro{\Cref*} results in \Cref*{eq:appendix_equation}.
80 | If you desire less verbose output, you can use \macro{\eqref}, which gives \eqref{eq:appendix_equation}.
81 | \end{example}
82 |
--------------------------------------------------------------------------------
/chapters/Design.tex:
--------------------------------------------------------------------------------
1 | \chapter{Design Principles} \label{ch:Design}
2 |
3 | It is not like I stated the \emph{Principles} at the beginning and then tried to follow them.
4 | They emerged more naturally.
5 | So the causal structure is more like
6 | \[
7 | \raisebox{-0.15ex}{\parbox[c]{6em}{\centering made some design choices}}
8 | \mspace{12mu} \text{and} \mspace{10mu}
9 | \parbox[c]{7em}{\centering implemented certain features}
10 | \quad\longleadsto{}\quad
11 | \parbox[c]{10em}{\centering recognized \\\textcolor{gray}{at first subconscious} overarching principles}~.
12 | \]
13 | Anyway, here they are.
14 | \begin{definition}[Design Principles] \label{def:Design Principles}
15 | The main design \emph{Principles} are:
16 | \begin{itemize}
17 | \item \textbf{Elegance} --- Aim for a classy, typographically elegant layout.
18 | \item \textbf{Structure} --- Create a smart, easy-to-reference, and skimmable structure.
19 | \item \textbf{Clarity} --- Eliminate distractions and strive for clear explanations. \qedhere
20 | \end{itemize}
21 | \end{definition}
22 | \begin{remark}[Common Goal, Alternative Definition via Antiprinciples]
23 | There is also an alternative point of view.
24 | The common goal of \Nref*{def:Design Principles} is to minimize the following \emph{Antiprinciples}:
25 | \begin{itemize}
26 | \item We should be concise, and that means fewer pages, the better.
27 | Long blocks of text without noticeable space between paragraphs are preferred (the reader should go on a walk to have some breathing spacetime).
28 | \item Avoid creating distinct anchor points for important concepts, since an attentive reader should be able to extract them from blocks of text.
29 | \item Do not waste time referencing earlier discussions and reflecting on them from the current context and point of view, as the reader is anyway making such connections all the time. \qedhere
30 | \end{itemize}
31 | \end{remark}
32 |
33 | Each of these principles is somehow reflected in the design choices and features included (or omitted) in \TeXtured{}, see \Cref{ch:Features} for more details.
34 |
35 | \begin{remark}[Disclaimer]
36 | The following is at places highly opinionated, and not applicable to all scenarios and use-cases.
37 | I tried to describe my reasons for specific design choices, with which you can certainly disagree.
38 | I hope that at least it can provoke more people \emph{(especially you!)} to contemplate about document creation, ideally resulting in production of documents with overall better quality.
39 | \end{remark}
40 |
--------------------------------------------------------------------------------
/chapters/Features.tex:
--------------------------------------------------------------------------------
1 | \chapter{Features of \TeXtured{}} \label{ch:Features}
2 |
3 | In the following sections, we will describe the features of \TeXtured{} template, implemented by utilizing various \LaTeX{} packages and custom macros.
4 |
5 | \begin{remark}[Packages and Macros]
6 | We will refer to various \LaTeX{} packages and macros using the following styles:
7 | \begin{itemize}
8 | \item \package{package} --- a package (together with a link to its \textsf{CTAN} page),
9 | \item \macro{\macro} --- a command/macro, either built-in or provided by a package,
10 | \item \custommacro{\custommacro} --- a custom macro defined in the \TeXtured{} template. \qedhere*
11 | \end{itemize}
12 | \end{remark}
13 |
14 | \section{Code Organization}%
15 | \label{sec:Code Organization}
16 |
17 | To avoid large and hard to navigate preamble files, the code is organized into multiple directories/files in the \path{preamble/} directory, each focusing on a particular function/feature, see \Cref{fig:preamble-file-structure}.
18 | \begin{figure}[!ht]
19 | \fcapside[\FBwidth]{%
20 | \captionsetup{parskip = .5\baselineskip plus 1pt}%
21 | \caption[Structure of Preamble Directory]{%
22 | Structure of the \path{preamble/} directory.
23 |
24 | It is critical that the \path{preamble/pdfA-compliance/glyphtounicode.tex} file ensuring the PDF/A compliance is sourced before \fakemacro{\documentclass}.
25 |
26 | The \path{preamble/toggles.tex} files defines various toggles, which should be appropriately set right after.
27 | Finally, the rest of \grayenclose{preamble} files are then loaded through the \path{preamble/main.tex} file.
28 |
29 | When possible, add your own tweaks and macros to the \path{preamble/user/} directory reserved for this purpose.
30 | This way, you can easily update to newer versions of \TeXtured{} (hopefully) without conflicts.
31 | }%
32 | \label{fig:preamble-file-structure}%
33 | }{%
34 | \begin{tikzpicture}[dirtree]
35 | \node[directory] {preamble/}
36 | child { node {bibliography.bib}}
37 | child { node {data.tex}}
38 | child { node {toggles.tex}}
39 | child { node {main.tex}}
40 | child { node[directory] {debug/...}
41 | % child { node {commands.tex}}
42 | % child { node {line-numbers.tex}}
43 | }
44 | % child [missing] {} child [missing] {}
45 | child { node[directory] {environments/...}
46 | % child { node {init.tex}}
47 | % child { node {remark-like.tex}}
48 | % child { node {theorem-like.tex}}
49 | % child { node {todo-like.tex}}
50 | }
51 | % child [missing] {} child [missing] {} child [missing] {} child [missing] {}
52 | child { node[directory] {general/...}
53 | % child { node {colors.tex}}
54 | % child { node {floats.tex}}
55 | % child { node {hyperref.tex}}
56 | % child { node {typesetting.tex}}
57 | }
58 | % child [missing] {} child [missing] {} child [missing] {} child [missing] {}
59 | child { node[directory] {hacks/...}
60 | % child { node {custom-reference-boxes.tex}}
61 | % child { node {fix-qed.tex}}
62 | % child { node {floatrow-parskip.tex}}
63 | }
64 | % child [missing] {} child [missing] {}
65 | child { node[directory] {layout/...}
66 | % child { node {geometry.tex}}
67 | % child { node {headers.tex}}
68 | % child { node {numbering.tex}}
69 | % child { node {titles.tex}}
70 | % child { node {toc.tex}}
71 | }
72 | % child [missing] {} child [missing] {} child [missing] {} child [missing] {} child [missing] {}
73 | child { node[directory] {math/...}
74 | % child { node {fonts.tex}}
75 | % child { node {macros.tex}}
76 | % child { node {packages.tex}}
77 | % child { node {spacing.tex}}
78 | }
79 | % child [missing] {} child [missing] {} child [missing] {} child [missing] {}
80 | child { node[directory] {misc/...}
81 | % child { node {inkscape.tex}}
82 | % child { node {macros.tex}}
83 | % child { node {tikz.tex}}
84 | }
85 | % child [missing] {} child [missing] {} child [missing] {}
86 | child { node[directory] {pdfA-compliance/...}
87 | % child { node {glyphtounicode.tex}}
88 | % child { node[directory] {LaTeX-find-glyph-name/}
89 | % child { node {LaTeX-find-glyph-name.tex}}
90 | % }
91 | }
92 | % child [missing] {} child [missing] {} child [missing] {}
93 | child { node[directory] {references/...}
94 | % child { node {backref.tex}}
95 | % child { node {biblatex-extra-fields.dbx}}
96 | % child { node {biblatex.tex}}
97 | % child { node {cite.tex}}
98 | % child { node {doi-eprint-url.tex}}
99 | % child { node {fields.tex}}
100 | % child { node {style.tex}}
101 | }
102 | % child [missing] {} child [missing] {} child [missing] {} child [missing] {} child [missing] {} child [missing] {} child [missing] {}
103 | child { node[directory] {user/...}
104 | % child { node {macros.tex}}
105 | % child { node {math.tex}}
106 | }
107 | % child [missing] {} child [missing] {}
108 | ;
109 | \end{tikzpicture}%
110 | }
111 | \end{figure}
112 |
113 | \begin{remark}[Pointers to Directories/Files]
114 | If you want to tweak some aspect of the template --- or learn how a given feature is implemented --- pointers to the relevant directories/files are provided next to the subsequent section/subsection titles to help you navigate the code.
115 | \end{remark}
116 |
117 | \begin{remark}[Custom User Macros]
118 | Store your own macros in the \path{preamble/user/} directory, which is reserved precisely for this purpose.
119 | Then, if you would like to update to a newer version of \TeXtured{}, you will be having easier time --- less mixing of your code with the template code will result in fewer conflicts you must resolve manually.
120 | \end{remark}
121 |
122 | \begin{remark}[Auxiliary Files]
123 | To avoid cluttering the directories with \emph{auxiliary files} generated during the compilation, it is recommended to use the \macro{aux_dir} setting in the \path{.latexmkrc} file (enabled by default, the \macro{aux_dir} being \path{.aux/}).
124 | All auxiliary files are then stored in a separate directory, leaving the rest tidy.
125 | \end{remark}
126 |
127 | \begin{remark}[Suggestion: One Sentence Per Line]
128 | It is a good practice to follow \enquote{one sentence per line} rule (or something similar), since it improves diffs for versioning systems like \texttt{git}.
129 | Tools like \texttt{latexindent} can help.
130 | \begin{Note}
131 | My config for \texttt{latexindent} mostly works, but some corner cases can surface.
132 | Will share someday.
133 | \end{Note}
134 | If multiple sentences are on the same line, changing just one word results in the whole line being marked as changed, making it harder to see how much the text was actually changed in a given commit.
135 | \end{remark}
136 |
137 |
138 |
139 | \section{Page Layout and Style}%
140 | \label{sec:Page Layout}
141 | \dirTeXtured{preamble/layout/}
142 |
143 | We will first describe the page layout and style, which includes page dimensions, headers and footers, page numbering, and heading style.
144 |
145 | \subsection{Page Dimensions, Printing Layout}%
146 | \label{sub:Page Dimensions}
147 | \fileTeXtured{preamble/layout/geometry.tex}
148 |
149 | Using \package{geometry} package --- set up the page layout (supported single/double-sided printing).
150 | Apply \macro{\flushbottom} --- try to make text body on all pages have the same height.
151 |
152 | \subsection{Page Headers and Footers}%
153 | \label{sub:Headers Footers}
154 | \fileTeXtured{preamble/layout/headers.tex}
155 |
156 | Using \package{fancyhdr} package --- page headers and footers --- consistent style also for initial page of a chapter (not totally different style with numbering in the bottom center \ldots).
157 |
158 | \subsection{Page Numbering}%
159 | \label{sub:Page Numbering}
160 | \fileTeXtured{preamble/layout/numbering.tex}
161 |
162 | Placing custom \custommacro{\frontmatter}, \custommacro{\mainmatter}, and \custommacro{\backmatter} macros at appropriate places in \path{thesis.tex}, \emph{Roman numbering} is set up for \emph{front matter}, that is until the start of first numbered chapter, and then \emph{Arabic numbering} for the rest of the document.
163 |
164 |
165 | \subsection{Heading Style}%
166 | \label{sub:Heading Style}
167 | \fileTeXtured{preamble/layout/titles.tex}
168 |
169 | Pretty chapter heading style --- big calligraphic number/letter behind the title.
170 |
171 |
172 | \section{Sane Typographical Defaults}%
173 | \label{sec:Sane Typographical Defaults}
174 | \dirTeXtured{preamble/general/}
175 |
176 | Now we will concern ourselves with more intricate and detailed typography, more at level of paragraphs, sentences, words, and even letters.
177 |
178 | \subsection{Paragraphs}%
179 | \label{sub:Paragraphs}
180 | \fileTeXtured{preamble/general/typesetting.tex}
181 |
182 | No paragraph indentation, proper space between paragraphs --- \package{parskip}.
183 |
184 | \subsection{Floats, Captions}%
185 | \label{sub:Floats_Captions}
186 | \fileTeXtured{preamble/general/floats.tex}
187 |
188 | Caption styling includes a slight hang, \macro{\footnotesize} font, and a bold sans label.
189 | See \Cref{appendix:example} for a showcase of the different caption types.
190 |
191 |
192 | \subsection{Font and Related Stuff}%
193 | \label{sub:Font}
194 | \fileTeXtured{preamble/general/typesetting.tex}
195 |
196 | The default choice are \emph{Latin Modern} fonts --- a classic really.
197 | Various families and shapes are typically used for different purposes:
198 | \begin{itemize}
199 | \item \emph{Serif} family for the main text
200 | \item \emph{Slanted} shape for emphasis using \macro{\emph} macro (instead of the default \emph{Italic} shape, which is reserved mainly for math formulas)
201 | \begin{remark}[Nested Emphasis]
202 | Nested emphasis is displayed in \emph{Italic} shape.
203 | It is rather rare to nest an \emph{additional \emph{emphasis} inside an emphasis}.
204 | \end{remark}
205 | \item \emph{(Bold) Sans} family for headings and other structural elements
206 | \item \emph{Typewriter} family for computer code and similar stuff
207 | \end{itemize}
208 | \vspace{1ex}
209 |
210 | \begin{example}
211 | Quick showcase of some font families and shapes:\par \leftskip=1em
212 |
213 | { This is Latin Modern Serif \(\alpha = 2^{2}\)}\\
214 | {\slshape This is Latin Modern Serif Oblique \(\alpha = 2^{2}\)}\\
215 | {\bfseries This is Latin Modern Serif Bold \(\alpha = 2^{\bm{{2}}}\)}\\
216 | {\bfseries\slshape This is Latin Modern Serif Bold Oblique \(\alpha = 2^{2}\)}
217 |
218 | {\sffamily This is Latin Modern Sans \(\alpha = 2^{2}\)}\\
219 | {\sffamily\slshape This is Latin Modern Sans Oblique \(\alpha = 2^{2}\)}\\
220 | {\sffamily\bfseries This is Latin Modern Sans Bold \(\alpha = 2^{2}\)}\\
221 | {\sffamily\bfseries\slshape This is Latin Modern Sans Bold Oblique \(\alpha = 2^{2}\)}
222 | \end{example}
223 | \begin{Note}
224 | Sans math font has problems with showing properly all bold symbols (sub/superscripts don't work automatically).
225 | \end{Note}
226 |
227 | For consistent quotation use \macro{\enquote} macro provided by \package{csquotes}.
228 |
229 | \subsection{\texorpdfstring{Micro-\!Typography}{Micro-Typography}}%
230 | \label{sub:Micro-Typography}
231 | \fileTeXtured{preamble/general/typesetting.tex}
232 |
233 | Enable micro-typographic extensions with package \package{microtype}, most prominently character protrusion and font expansion.
234 |
235 | Following quote from \package{microtype} documentation nicely explains what it is about:
236 | \begin{displayquote}
237 | Micro-typography is the art of enhancing the appearance and readability of a document while exhibiting a minimum degree of visual obtrusion.
238 | It is concerned with what happens between or at the margins of characters, words or lines.
239 | Whereas the macro-typographical aspects of a document (i.e., its layout) are clearly visible even to the untrained eye, micro-typographical refinements should ideally not even be recognizable.
240 | That is, you may think that a document looks beautiful, but you might not be able to tell exactly why: good micro-typographic practice tries to reduce all potential irritations that might disturb a reader.
241 | \end{displayquote}
242 |
243 |
244 | \section{Document Structure}%
245 | \label{sec:Document Structure}
246 |
247 | It is important to have a clear and consistent structure of the document.
248 | This can be achieved by using various environments for different types of content, and by providing clear and informative titles for each part of the document, thus making it easier to navigate and understand.
249 |
250 | \subsection{Structure Environments}%
251 | \label{sub:Structure Environments}
252 | \fileTeXtured{preamble/environments/*.tex}
253 | % \fileTeXtured{preamble/environments/init.tex}
254 | % \fileTeXtured{preamble/environments/theorem-like.tex}
255 | % \fileTeXtured{preamble/environments/remark-like.tex}
256 | % \fileTeXtured{preamble/environments/todo-like.tex}
257 |
258 | Inspired by the structured mathematical texts, enclosing various parts of the document in the corresponding environments can help to make the document more structured and easier to read.
259 | Implemented mostly \package{tcolorbox} package and \package{keytheorems} (modern key--value interface for \package{amsthm}).
260 |
261 | \begin{remark}[Default Environments]
262 | There are predefined boxed \enquote{theorem-like} environments for \textsf{Definition}, \textsf{Theorem}, \textsf{Lemma}, \textsf{Corollary}, \textsf{Proposition}, and non-boxed \enquote{remark-like} environments for \textsf{Remark}, \textsf{Proof}, \textsf{Example}, \textsf{Derivation}, \textsf{Calculation}, \textsf{Idea}, and \textsf{Tip} (these have at least a mark indicating the end of the environment).
263 |
264 | Names of the corresponding environments are lowercase, for example \texttt{definition}, \texttt{remark}, and so on.
265 | They also accept an optional argument for a short description.
266 | \end{remark}
267 |
268 | Some additional points about the \emph{structure environments}:
269 | \begin{itemize}
270 | \item provide clear structure, enables high level of interlinking
271 | \item they make the text easy to skim through, quickly get an idea, and know roughly what to expect
272 | \item have shared numbering, together with tables, figures, equations --- leads to a linear increase of the reference number, making them easier to locate
273 | \item not only for physics/math texts, can be generally used to highlight key ideas
274 | \begin{tip}[Custom Structure Environments]
275 | You can easily create additional \enquote{structure} environments, see \Cref{sec:Structure}.
276 | \end{tip}
277 | \item avoid using emphasis for the whole body of \enquote{theorem-like} environments, since we already have a whole box around it to make them stand out
278 | \end{itemize}
279 | \vspace{1ex}
280 |
281 | \begin{remark}
282 | There are also helper environments for \textsf{Todo}-like notes.
283 | By default, there are \textsf{Todo}, \textsf{Note}, \textsf{Suggestion}, and \textsf{Question} environments, but you can easily create your own.
284 |
285 | To avoid conflicts with possible existing macros/environments, names of these environments are capitalized, for example \texttt{Todo}, \texttt{Note}, and so on.
286 | \end{remark}
287 |
288 | \begin{Note}
289 | No \enquote{code listing} setup yet.
290 | PRs welcome.
291 | \end{Note}
292 |
293 | \subsection{References and Links}%
294 | \label{sub:References Links}
295 | \fileTeXtured{preamble/hacks/custom-reference-boxes.tex}
296 |
297 | Custom reference/link/citation styles using \package{tcolorbox} package.
298 | \begin{Note}[Slight Inconvenience --- Line Breaks]
299 | There is a slight inconvenience due to small flexibility around line breaks.
300 | It would be nice to have a proper workaround.
301 | \end{Note}
302 | \begin{remark}[Rationale]
303 | I like to have clearly distinguished references, links, and citations.
304 | By default, \package{hyperref} provides frames around links, but they are not that pretty, and the PDF viewer must support them.
305 | Using just colors can sometimes look better, but I still wasn't satisfied.
306 |
307 | Sometimes it is nice to know the precise location of the reference, especially when the document is printed and you cannot simply click on them.
308 | Therefore, the page number is (by default) included with \custommacro{\Cref}, see \Cref{rem:zref-clever}.
309 | Use the starred variant \custommacro{\Cref*} to omit it.
310 | \end{remark}
311 | \begin{remark}[Automatic Reference Type Detection] \label{rem:zref-clever}
312 | Package \package{zref-clever} provides \macro{\zcref} command --- similarly to the older, no longer maintained, \package{cleveref} package --- which automatically detects the type of reference, and formats it accordingly.
313 | This behavior is adapted in \TeXtured{} with the macro \custommacro{\Cref}, which wraps the link in nice box, and also shows a corresponding page number of the target.
314 |
315 | If you want the link to show the reference title, use \custommacro{\Nref} --- or the starred variant \custommacro{\Nref*} to omit the page number --- which utilizes \package{zref-titleref}.
316 | \end{remark}
317 |
318 | \subsection{Table of Contents and Outline/Index}%
319 | \label{sub:Table of Contents and Index}
320 | \fileTeXtured{preamble/layout/toc.tex}
321 |
322 | Clear and elegant Table of Contents, which includes all the important parts --- also \grayenclose{unnumbered} subsections, but in a more compact style.
323 |
324 | Similarly, automatically populate the PDF Outline/Index (digital Table of Contents in PDF viewer).
325 | It is very handy for navigating longer documents, and includes also other important pages other than just initial pages of main chapters: Title Page, Contents, Introduction, References, and so on.
326 | \begin{remark}
327 | I use \texttt{Zathura} as my PDF viewer, with the Outline/Index just one \macro{Tab} away, allowing me to quickly jump to the desired part of the document.
328 | \end{remark}
329 |
330 | \begin{remark}[List of Figures, Tables, \ldots{}]
331 | If you want/need to include a List of Figures, List of Tables, and so on, you can easily do so by uncommenting the relevant lines in the \custommacro{\contentsandlists} macro.
332 | \end{remark}
333 |
334 |
335 | \section{Bibliography/References}%
336 | \label{sec:Bibliography/References}
337 | \dirTeXtured{preamble/references/}
338 |
339 | Pretty and functional Bibliography/References, via \package{biblatex} package.
340 |
341 | \subsection{Bibliography Style}%
342 | \label{sub:Bibliography Style}
343 | \fileTeXtured{preamble/references/*.tex}
344 | % \fileTeXtured{preamble/references/biblatex.tex}
345 | % \fileTeXtured{preamble/references/style.tex}
346 | % \fileTeXtured{preamble/references/fields.tex}
347 |
348 | Entries in \Nref{ch:References} have a clean consistent style, which builds on the \macro{ext-numeric-verb} style from \package{biblatex-ext} package.
349 |
350 | \begin{tip}[Bibliography Data]
351 | Make sure to gather all the relevant data you need for every reference.
352 | If you later decide you want to reduce the amount of presented information, \package{biblatex} can help you with that.
353 | For example, it is possible to automatically
354 | \begin{itemize}
355 | \item remove \macro{url} field if \macro{doi} field is present,
356 | \item ignore unwanted fields (\macro{pages}, \macro{number}, \macro{volume}, \macro{series}, \macro{location}, \ldots). \qedhere*
357 | \end{itemize}
358 | \end{tip}
359 |
360 | \subsection{Extra Fields}%
361 | \label{sub:Extra Fields}
362 | \fileTeXtured{preamble/references/biblatex-extra-fields.dbx}
363 |
364 | Support extra \custommacro{github} field.
365 |
366 | \subsection{Custom External Links}%
367 | \label{sub:Custom External Links}
368 | \fileTeXtured{preamble/references/doi-eprint-url.tex}
369 |
370 | Have the external \textsf{DOI/arXiv/URL/GitHub} links displayed in custom boxes, and place them on the new line.
371 |
372 | \subsection{Backreferences}%
373 | \label{sub:Backreferences}
374 | \fileTeXtured{preamble/references/backref.tex}
375 |
376 | Include \emph{backreferences}, which point from the bibliography to the pages where the reference was cited.
377 |
378 | \subsection{Citation Style}%
379 | \label{sub:Citation Style}
380 | \fileTeXtured{preamble/references/cite.tex}
381 |
382 | Include \texttt{[} and \texttt{]} characters around citation number inside the link (and wrap in \package{tcolorbox} \ldots), for example \autocite{TeXtured}.
383 |
384 |
385 | \section{PDF/A Compliance}%
386 | \label{sec:PDF/A Compliance}
387 | \dirTeXtured{preamble/pdfA-compliance/}
388 |
389 | Proper metadata setup (via \package{hyperref} and \macro{\DocumentMetadata}).
390 | \begin{remark}[Document Data]
391 | Various data about the work should be entered in \path{preamble/data.tex} file.
392 | When the relevant entries contain \LaTeX{} commands (for example to obtain specific formatting of the title), it is necessary to provide \enquote{plaintext} variations, so that \package{hyperref} can properly set up PDF metadata.
393 | \end{remark}
394 |
395 | Next we will describe various common violations of PDF/A standard, and how to fix them.
396 |
397 | \subsection{Glyph to Unicode Map}%
398 | \label{sub:Glyph to Unicode Map}
399 | \fileTeXtured{.../pdfA-compliance/glyphtounicode.tex}
400 | % \fileTeXtured[0ex]{preamble/pdfA-compliance/glyphtounicode.tex}
401 |
402 | To obtain PDF/A compliant PDF, we need to have Unicode mapping for all glyphs used in the document.
403 | It can happen --- mainly when using fonts providing extra mathematical symbols --- that certain glyphs are not covered by mappings loaded in \path{preamble/pdfA-compliance/glyphtounicode.tex}.
404 |
405 | In the \path{preamble/pdfA-compliance/glyphtounicode.tex} file you can also find an example \textsf{veraPDF} output for a PDF with a problematic glyph.
406 | It also points to a guide located in \path{preamble/pdfA-compliance/LaTeX-find-glyph-name/} directory, which explains how to find out the glyph name, and how to provide the \emph{glyph to Unicode} mapping with \macro{\pdfglyphtounicode} command.
407 |
408 |
409 | \subsection{PDF \texorpdfstring{\fakemacro{/Interpolation}}{/Interpolation} Key}%
410 | \label{sub:PDF Interpolation Key}
411 |
412 | Some PDFs can have enabled the \macro{/Interpolation} key, for example \texttt{Inkscape} generated PDFs with blur parts.
413 | However, PDF/A requires it to be disabled.
414 |
415 | This is automatically fixed by \path{figures/Inkscape/inkscape-export-to-latex} shell script.
416 |
417 |
418 | \section{Miscellaneous}%
419 | \label{sec:Miscellaneous}
420 |
421 | \subsection{Math-Related Tweaks --- \texorpdfstring{\rmfamily\(\E^{\I\pi}\)}{exp(iπ)}}%
422 | \label{sub:Math Macros}
423 | \fileTeXtured{preamble/math/}
424 |
425 | Some of the math-related tweaks:
426 | \begin{itemize}
427 | \item Use \macro{\boldmath} automatically for \macro{\textbf} text (useful mainly in headings).
428 | \item Possible to use sans italic font for math via \custommacro{\mathsfit}.
429 | \item Better extendable arrows with \package{TikZ}.
430 | \item \emph{(Optional, disabled by default)} Automatically change usage of \macro{\textcolor} to \macro{\mathcolor} in math mode, so that we get proper math spacing, for example
431 | \[ a \mathcolor{gray}{\times} b \text{ (right spacing)} \qquad\text{versus}\qquad a \textcolor{gray}{\times} b \text{ (wrong spacing)}\eqend \]
432 | However, it is recommended to explicitly use \macro{\mathcolor} when appropriate, since it leads to easier maintenance of the code (copy-pasting to other projects will work without problems).
433 | \end{itemize}
434 |
435 | \vspace{1ex}
436 | Following practice is highly recommended.
437 | \begin{tip}[Define Your Own Math Macros]
438 | Frequently define macros for notation used more than once.
439 | Advantages are for example:
440 | \begin{itemize}
441 | \item Code is easier to read/write, since it is more \enquote{semantic}.
442 | \item To tweak notation, you only need to change it in one place.
443 | \item Easier to find all occurrences of a certain notion. \qedhere
444 | \end{itemize}
445 | \end{tip}
446 |
447 | \subsection{GitHub Actions}%
448 | \label{sub:GitHub Actions}
449 | \fileTeXtured{.github/workflows/}
450 |
451 | Describe implemented \textsf{GitHub Actions}:
452 | \begin{itemize}
453 | \item Automatic \texttt{latexmk} build of the latest PDF version.
454 | \item PDF/A verification via \textsf{veraPDF}.
455 | \item Deploy to \texttt{gh-pages} branch.
456 | One can furthermore enable (in repo settings) \textsf{GitHub Pages} for \texttt{gh-pages} branch, which will automatically upload latest PDF to \texttt{https://username.github.io/reponame/thesis.pdf}.
457 | This enables convenient sharing of your (even continuously evolving) work without needing to commit the PDF (resulting in large repository size) or compiling the PDF on the receiving side.
458 | \begin{remark}[Private Repositories]
459 | Even for private repositories such link is publicly accessible.
460 | This is why \textsf{GitHub Pages} setup is not done automatically for you.
461 | If you want to share the work more \enquote{privately}, there are other solutions, for example \textsf{GitHub Action} which uploads PDF to \textsf{Google Drive}, and sharing via a private link.
462 | Also look at \Cref{sub:Censoring}.
463 | \end{remark}
464 | \end{itemize}
465 |
466 | \subsection{Censoring}%
467 | \label{sub:Censoring}
468 | \fileTeXtured{preamble/debug/censor.tex}
469 |
470 | Censoring/redaction using \package{censor} package.
471 | Use \macro{\censor}, \macro{\blackout}, or \macro{\censorbox}.
472 | For example, \censor{\TeXtured{} is an amazing template!}.
473 |
474 | \subsection{\texorpdfstring{\texttt{Inkscape}}{Inkscape} Integration}%
475 | \label{sub:Inkscape Integration}
476 | \fileTeXtured{preamble/misc/inkscape.tex}
477 |
478 | Put your \texttt{Inkscape} figures into \path{figures/Inkscape/} directory, and include them using \custommacro{\includeInkscapeSVG} macro (in place of \macro{\includegraphics}), which has the following features:
479 | \begin{itemize}
480 | \item Automatic export after changing the \texttt{svg} (need to enable \macro{--shell-escape} for \hologo{pdfTeX} or \hologo{LuaTeX}, done via \path{.latexmkrc}).
481 | \item Watermark via a \texttt{PostScript} injection.
482 | \begin{remark}[Watermark String]
483 | By default, the watermark string is composed as \enquote{\copyright \textlangle\textit{year}\textrangle{} \textlangle\textit{author's name}\textrangle}, where the author's name is extracted from \custommacro{\ThesisAuthorPlaintext}.
484 | You can customize it in the shell script \path{figures/Inkscape/inkscape-export-to-latex} to your liking.
485 | \end{remark}
486 | \item Automatic fix of \macro{/Interpolation} key problem.
487 | \item All text is processed by \LaTeX{}, ensuring consistent typesetting experience.
488 | In particular, you can enter math as usual through \macro{$...$}.
489 | \end{itemize}
490 |
491 |
492 | \section{Non-Features}%
493 | \label{sec:Non-Features}
494 |
495 | These features were deemed unnecessary, or even counterproductive, and thus were not implemented/not customized.
496 | This does not mean that it is hard or not compatible to use them with \TeXtured{}.
497 |
498 | \subsection{Footnotes}%
499 | \label{sub:Footnotes}
500 |
501 | \begin{itemize}
502 | \item they break the flow of reading, can be distracting
503 | \item either it is important and you want it there --- no need to use footnotes --- or it is not so important (maybe just a reminder/remark), but then there are in my opinion better ways to handle such situation
504 | \begin{itemize}
505 | \item grayed out/smaller text, sidenotes are better alternative, if the page layout enables them
506 | \item it is not bad to remind reader of something in the main text\ldots
507 | \end{itemize}
508 | \end{itemize}
509 |
510 | \subsection{Index, Glossary}%
511 | \label{sub:Index Glossary}
512 |
513 | \begin{itemize}
514 | \item since the text is primarily intended for electronic use, finding usage of certain terms is easy
515 | \item text should be ideally structured in such a way, that finding definitions of important terms is straightforward --- interlinking/referencing in proper places to indicate where the notion to be used was defined/discussed
516 | \end{itemize}
517 |
--------------------------------------------------------------------------------
/chapters/Introduction.tex:
--------------------------------------------------------------------------------
1 | \chapternotnumbered{Introduction} \label{ch:Introduction}
2 |
3 | Already when I started writing my bachelor thesis \autocite{Dujava2022}, I tweaked a lot the original \LaTeX{} template (which itself was slightly updated since then \autocite{MaresTemplate}) provided for students at MFF CUNI --- Faculty of Mathematics and Physics, Charles University in Prague.
4 |
5 | Some design choices originated already during this stage, particularly the significant use of theorem-like and remark-like environments with highly interlinked structure of the text.
6 |
7 | I picked up right where I left off when I started writing my master thesis \autocite{TODO}, and I have been refining the template ever since.
8 | Improved understanding of the coding backbone behind \LaTeX{} and its package ecosystem enabled me to customize it even further to my liking, and add even more \enquote{bells and whistles}.
9 |
10 | \begin{remark}[Template Purpose]
11 | While primarily targeting theses, \TeXtured{} can be used for other document types as well.
12 | \end{remark}
13 |
14 | To make it user-friendly, I have restructured the preamble into several files, each of which is responsible for a specific aspect of the document.
15 | This way, the user can (and is encouraged to) easily find the relevant part of the code and modify it.
16 |
17 | Numerous comments and explanations are provided throughout the code to further aid the user in understanding the template without always having to consult the documentation of packages (which is recommended for more advanced changes).
18 |
19 | \begin{remark}[How to Setup]
20 | To set up \TeXtured{} template for your document, you can use the \texttt{Overleaf} template or clone the repository on \textsf{GitHub} \autocite{TeXtured}.
21 | Then, you can start modifying the files to suit your needs.
22 |
23 | Also make sure to check the \texttt{README.md} file for more detailed instructions, particularly on various software dependencies.
24 | If you encounter any issues, please see \href{https://github.com/jdujava/TeXtured/issues/2}{\texttt{jdujava/TeXtured \#2}} and \href{https://github.com/jdujava/TeXtured/issues/5}{\texttt{jdujava/TeXtured \#5}}.
25 | \end{remark}
26 |
--------------------------------------------------------------------------------
/chapters/Notation.tex:
--------------------------------------------------------------------------------
1 | \setcounter{chapter}{13} % "N" (14th letter, but latex first increments -> 14-1=13)
2 | \chapter{Notation \& Conventions} \label{ch:notation}
3 | % NOTE: since we are in the "frontmatter" part, we need to manually set headers
4 | % we didn't use `\chapternotnumbered`, because we want its letter in TOC,
5 | % and the numbering of environments to be of the form "N.1"
6 | \markboth{Notation \& Conventions}{Notation \& Conventions}
7 |
8 | \vspace{2ex}
9 |
10 | \begin{remark}
11 | This chapter is numbered (or perhaps more precisely \enquote{lettered}).
12 | This means that is appears in Table of Contents with its letter \enquote{\textbf{\textsf{N}}}, which also prefixes all numbering of environments in this chapter.
13 |
14 | On the other hand, \Nref{ch:Introduction} and \Nref{ch:Quick Summary} are unnumbered (or \enquote{unlettered}) in this sense.
15 | \end{remark}
16 |
17 | \begin{example}[Usage of Mathematical Fonts]
18 | To make the text more readable and beautiful, we can use different types of mathematical fonts for different types of objects (striving to be at least somewhat consistent):
19 | \begin{itemize}
20 | \item \(\bm{Bold}\) often for tensorial object (abstract index).
21 | \item \(\mathsf{Sans}\) for groups, certain spaces, or some operations/maps.
22 | \item \(\mathfrak{Fraktur}\) for algebras (and densities).
23 | \item \(\mathcal{C}a\ell\ell igraphic\) (available are only capital letters, and \(\ell\))
24 | \item \(\mathpzc{Calligraphic}\) (alternative font containing also lowercase letters)
25 | \item \(\mathbb{D}\)ouble-\(\mathbb{S}\)truck for fields like \(\R\), spaces like \(\Sphere^{n}\) and \(\CP^{n}\).
26 | \item \(\mathtt{Typewriter}\) for code functions, or other special objects. \qedhere
27 | \end{itemize}
28 | \end{example}
29 |
30 | \begin{example}
31 | You can use \(\.\argument\.\) as an argument placeholder.
32 | \end{example}
33 |
--------------------------------------------------------------------------------
/chapters/QuickSummary.tex:
--------------------------------------------------------------------------------
1 | % \setcounter{chapter}{16} % "Q" (17th letter, but latex first increments -> 17-1=16)
2 | % \chapter{Quick Summary}
3 | \chapternotnumbered{Quick Summary} \label{ch:Quick Summary}
4 |
5 | \vspace{2ex} % extra vertical space, since letter Q has a long tail
6 |
7 |
8 | In \textbf{\Cref*{ch:notation}} we exhibit an example of a \emph{front matter} chapter.
9 | %% TODO: maybe use \nameref{}, and more fluid description of chapters
10 |
11 | \makebox{In \textbf{\Cref*{ch:Design}}} we present design \emph{Principles} to which \TeXtured{} adheres.
12 | %% NOTE: `\makebox` is used to fix the width of "In Chapter X" part
13 |
14 | \makebox{In \textbf{\Cref*{ch:Usage}}} we explain the file structure and the basics of using the template.
15 |
16 | \makebox{In \textbf{\Cref*{ch:Features}}} we describe various implemented features, design choices, and \LaTeX{} packages helping with the task of realizing goals sketched in \Cref*{ch:Design}.
17 |
18 | \makebox{In \textbf{\Cref*{ch:Tips}}} we give tips and tricks on how to fully utilize and even extend capabilities of \TeXtured{}.
19 |
20 | In \textbf{\Cref*{appendix:example}} we show an example of an Appendix chapter.
21 |
22 | \begin{Note}[WIP Disclaimer]
23 | Both \Cref{ch:Features} and \Cref{ch:Tips} are as of now Work-in-Progress.
24 | There is a lot of stuff yet to be exhibited and explained.
25 | All the colored \textsf{TODO}-like environments are to be resolved in the final version of this document.
26 | \end{Note}
27 |
--------------------------------------------------------------------------------
/chapters/Summary.tex:
--------------------------------------------------------------------------------
1 | %% NOTE: uncomment following line if you use parts in your document
2 | % \addtocontents{toc}{\vspace{2ex}} % Add extra space after the last part in TOC
3 |
4 | \chapternotnumbered{Summary and Outlook}
5 |
6 | Summary and Outlook.
7 |
--------------------------------------------------------------------------------
/chapters/Tips.tex:
--------------------------------------------------------------------------------
1 | \chapter{Tips \& Tricks} \label{ch:Tips}
2 |
3 | In this chapter we will see how to utilize and even extend capabilities of \TeXtured{}.
4 | Additionally, there will be sprinkled miscellaneous tips on how to improve the quality of your document.
5 |
6 | \section{Structure}%
7 | \label{sec:Structure}
8 |
9 | \subsection{Headings}%
10 | \label{sub:Headings}
11 |
12 | \begin{itemize}
13 | \item numbered and \enquote{lettered} chapters
14 | \begin{Todo}
15 | Describe \custommacro{\chapternotnumbered}, and \enquote{lettered} chapters in front matter.
16 | \end{Todo}
17 | \item Use nicely named \textcolor{gray}{sub}sections --- much easier to navigate, since it leads to better ToC and Index
18 | \begin{Todo}
19 | Describe \macro{\texorpdfstring}.
20 | \end{Todo}
21 | \end{itemize}
22 |
23 | \subsection{Structure Environments}%
24 | \label{sub:Structure Environments tips}
25 |
26 | \begin{itemize}
27 | \item Utilize structure (remark, definition, ...) environments to make the document more structured and easier to read.
28 | Including a brief description as an optional argument can help to foreshadow the content of the environment.
29 | Important concepts will then stick out more and will be remembered better.
30 | \begin{remark}[Spacing at the End of Structure Environments]
31 | Structure environments ending with displayed math or a list may need a bit of tweaking to ensure proper spacing at their end.
32 |
33 | This is most easily achieved using the \custommacro{\qedhere} macro on the line, which should be the last one in the environment.
34 | This uses the mechanism of the \macro{\qedhere} macro from \package{amsthm} package, but now has also a starred variant for extra vertical space (for equations containing big operators), or even an optional argument for a completely custom vertical shift.
35 | \end{remark}
36 | \begin{Todo}
37 | Describe creation of new \enquote{structure} environments.
38 | \end{Todo}
39 | \item Try to motivate every definition/theorem with \enquote{normal} text, do not let the document degenerate just into a listing of definitions/theorems/proofs/...
40 | \item Use references to other remarks/definitions/sections to make the document more interconnected, which can help the reader to look at a bigger picture, recollect necessary information to proceed further, or to understand the context better.
41 | \end{itemize}
42 |
43 | \begin{Todo}
44 | Show using \macro{\autocite{TODO}} in the text \autocite{TODO}.
45 | Helps to not forget to add the citation later.
46 | \end{Todo}
47 |
48 |
49 | \section{Typography}%
50 | \label{sec:Typography}
51 |
52 | \begin{itemize}
53 | \item use \macro{~} to enter a non-breakable space, or also after a dot in the initials or after academic titles
54 | (otherwise one gets bigger space than is proper), for example \macro{M.Sc.~Name Surname}
55 | \item proper usage of hyphens/dashes --- learn when to use hyphen - (\macro{-}), when en-dash -- (\macro{--}), and when em-dash --- (\macro{---})
56 | \item use \emph{emphasis} with \macro{\emph} for the names of new and important concepts
57 | \item for quotation marks use \macro{\enquote} from \package{csquotes} package
58 | \item sometimes using gray text instead of parentheses may result in a cleaner look, for example instead of \enquote{(pseudo-)Riemannian} just gray out \enquote{pseudo-} like \enquote{\textcolor{gray}{pseudo-}Riemannian}
59 | \item choose capitalization style of titles, and stick with it --- I chose \enquote{titlecase}
60 | \end{itemize}
61 |
62 |
63 | \section{Mathematics \& Physics}%
64 | \label{sec:MathematicsandPhysics}
65 |
66 | \subsection{Math Typesetting}%
67 | \label{sub:Math Typesetting}
68 |
69 | Learn stuff in \package{amsmath}/\package{eqnlines} and \package{mathtools} packages.
70 | Then it is possible to write pretty multi-line equations like the following inclusion map
71 | \ifdefined\equations
72 | \<[mincolsep=0pt,maxcolsep=0pt] % uses \<...\> shortcut for `equations` environment provided by `eqnlines`
73 | % NOTE: maybe there is a better way to center parameters (t,r,\mathsf{\hat{x}})?
74 | \iota\colon & \brk{\Sphere^{1}, \R_{\ge 0}, \Sphere^{\spacedim-1}} & & \longrightarrow \coset{\AdS_{\spacedim+1}}{\Z} \\
75 | & \brk{\chphantom{t}{\Sphere^{1}},\chphantom{r}{\R_{\ge 0}},\chphantom{\omega^{\ind}}{\Sphere^{\spacedim-1}}} & & \longmapsto X =
76 | \iota(t,r,\omega^{\ind}) \equiv \smash[t]{
77 | \begin{dcases}
78 | \begin{aligned}
79 | X^{\shortminusone} & = \sqrt{\ell^{2} + r^{2}} \cos(t/\ell), \\
80 | X^{0} & = \sqrt{\ell^{2} + r^{2}} \sin(t/\ell), \\
81 | X^{i} & = r\.\omega^{i} \quad \mathcolor{darkgray}{\text{for } i\in \{1,\ldots,\spacedim\}} \eqend \\
82 | \end{aligned}
83 | \end{dcases}
84 | }
85 | \>
86 | \else
87 | \[
88 | \begin{alignedat}{2}
89 | % NOTE: maybe there is a better way to center parameters (t,r,\mathsf{\hat{x}})?
90 | \iota\colon & \brk{\Sphere^{1}, \R_{\ge 0}, \Sphere^{\spacedim-1}} & & \longrightarrow \coset{\AdS_{\spacedim+1}}{\Z} \\
91 | & \brk{\chphantom{t}{\Sphere^{1}},\chphantom{r}{\R_{\ge 0}},\chphantom{\omega^{\ind}}{\Sphere^{\spacedim-1}}} & & \longmapsto X =
92 | \iota(t,r,\omega^{\ind}) \equiv \smash[t]{
93 | \begin{dcases}
94 | \begin{aligned}
95 | X^{\shortminusone} & = \sqrt{\ell^{2} + r^{2}} \cos(t/\ell), \\
96 | X^{0} & = \sqrt{\ell^{2} + r^{2}} \sin(t/\ell), \\
97 | X^{i} & = r\.\omega^{i} \quad \mathcolor{darkgray}{\text{for } i\in \{1,\ldots,\spacedim\}} \eqend \\
98 | \end{aligned}
99 | \end{dcases}
100 | }
101 | \end{alignedat}
102 | \]
103 | \fi
104 | \begin{remark}[Math Ending Punctuation]
105 | Make sure to use \custommacro{\eqend} or \custommacro{\eqcomma} macro (when appropriate) to properly end a math environment with a period or a comma, respectively.
106 | They add a small space before the punctuation to make the formula look better.
107 | \end{remark}
108 |
109 | \begin{Todo}
110 | Maybe show diagrams with \package{TikZ} package.
111 | \end{Todo}
112 |
113 | \subsection{Numbers and Units}%
114 | \label{sub:Numbers and Units}
115 |
116 | Use \package{siunitx} package for convenient typesetting numbers and units.
117 | Examples are shown in \Cref{tab:siunitx}.
118 |
119 | \begin{Note}
120 | The \package{siunitx} package is very powerful and flexible.
121 | It can be even used to nicely align numbers in tables.
122 | As of now, this feature is not customized in any way in \TeXtured{}.
123 | Suggestions for improvements are welcome.
124 | \end{Note}
125 | \begin{table}[ht!]
126 | \begin{booktabs}{stretch=1.1}
127 | \toprule
128 | \textbf{Command} & \textbf{Output} & \textbf{Usage} \\
129 | \midrule
130 | \fakemacro{\num{123.45 e-8}} & \num{123.45 e-8} & numbers \\
131 | \fakemacro{\si{\meter\per\second\squared}} & \si{\meter\per\second\squared} & units \\
132 | \fakemacro{\SI{123.45}{m/s^2}} & \SI{123.45}{m/s^2} & numbers with units \\
133 | \fakemacro{\SIrange{1}{10}{\kilo\meter}} & \SIrange{1}{10}{\kilo\meter} & ranges \\
134 | \fakemacro{\SIlist{1;3;5}{A}} & \SIlist{1;3;5}{A} & lists \\
135 | \fakemacro{\SI{1.23 +- 0.45}{\celsius}} & \SI{1.23 +- 0.45}{\celsius} & uncertainties \\
136 | \bottomrule
137 | \end{booktabs}
138 | \caption{Examples of \package{siunitx} package usage.}
139 | \label{tab:siunitx}
140 | \end{table}
141 |
142 |
143 | \section{\texorpdfstring{\LaTeX{}}{LaTeX} Coding}%
144 | \label{sec:LaTeX Coding}
145 |
146 | \begin{Todo}
147 | Describe how to create custom macros with \macro{\NewDocumentCommand}, \macro{\RenewDocumentCommand}, \macro{\NewCommandCopy}, ...
148 | \end{Todo}
149 | \begin{Question}
150 | Difference between \enquote{macro} and \enquote{function} in \LaTeX{}?
151 | Which nomenclature is appropriate?
152 | \end{Question}
153 | \begin{remark}[Macro Space Handling]
154 | Using macro inside text in the form \macro{\foo} can swallow the following whitespace.
155 | When this is not the desired behavior, call the macro like \macro{\foo{}}.
156 | In this way an empty argument is passed to the macro, leaving the following whitespace intact.
157 | \end{remark}
158 | \begin{Todo}
159 | Describe \macro{\makeatletter} and \macro{\makeatother}.
160 | \end{Todo}
161 | \begin{Todo}
162 | Describe \macro{\ensuremath}.
163 | When math macro is used often outside math mode (alone as \macro{...\(\foo\)...}), defining it wrapped in \macro{\ensuremath} can lead to perhaps easier use (as just \macro{...\foo{}...}).
164 | \end{Todo}
165 | \begin{Todo}
166 | Describe \custommacro{\includeonlysmart}.
167 | \end{Todo}
168 | \begin{Note}
169 | Be careful about implicit end of line spaces in function definitions, sometimes necessary to use \macrobox{\texttt{\%}} after last command on the line.
170 | \todo{Describe this in more detail.}
171 | \end{Note}
172 | \begin{Todo}
173 | Describe WIP mode (particularly with \hologo{LuaLaTeX}).
174 | \end{Todo}
175 | \begin{Note}
176 | Some comments in source code refer to files from \TeX{}Live installation on Arch Linux.
177 | On other distributions or operating systems the paths might be different.
178 | \end{Note}
179 |
--------------------------------------------------------------------------------
/chapters/Usage.tex:
--------------------------------------------------------------------------------
1 | \chapter{Usage of \TeXtured{}} \label{ch:Usage}
2 |
3 | To quickly familiarize yourself with the \TeXtured{} template, we will go through the basic structure of the template files and explain how to use them.
4 | First, take a look at \Cref{fig:file-structure} for a visual representation of the file structure.
5 | \begin{figure}[!ht]
6 | \fcapside[\FBwidth]{%
7 | \captionsetup{parskip = .5\baselineskip plus 1pt}%
8 | \caption[\TeXtured{} Template File Structure]{%
9 | \TeXtured{} template file structure.
10 |
11 | The main file is \path{thesis.tex}.
12 | It does not contain the actual content of the document, but instead \fakemacro{\include}s the chapters and \emph{front matter} pages from the corresponding directories.
13 |
14 | Make sure to fill all PDF \grayenclose{meta}data --- like title, author, etc.~--- in the \path{preamble/data.tex} file.
15 | The bibliography/reference data is stored in the \path{preamble/bibliography.bib} file.
16 |
17 | All of the \TeXtured{} tweaks and settings located in files under \path{preamble/...} directories are loaded by the \path{preamble/main.tex} file, which is itself \fakemacro{\input}ed in the \path{thesis.tex} file.
18 |
19 | The \path{.latexmkrc} file contains a configuration for the \textsf{latexmk} tool, which provides a convenient way to compile the document.
20 | }%
21 | \label{fig:file-structure}%
22 | }{%
23 | \begin{tikzpicture}[dirtree]
24 | \node[directory] {\TeXtured{} Root Directory/}
25 | child { node {thesis.tex}}
26 | child { node {LICENSE}}
27 | child { node {README.md}}
28 | child { node[directory] {chapters/...}}
29 | child { node[directory] {figures/...}}
30 | child { node[directory] {frontmatter/...}}
31 | child { node[directory] {preamble/}
32 | child { node {bibliography.bib}}
33 | child { node {data.tex}}
34 | child { node {main.tex}}
35 | child { node[directory] {...} }
36 | }
37 | child [missing] {} child [missing] {} child [missing] {} child [missing] {}
38 | child { node {.latexmkrc}}
39 | child { node {.gitignore}}
40 | child { node {.gitattributes}}
41 | child { node[directory] {.github/...}}
42 | ;
43 | \end{tikzpicture}%
44 | }
45 | \end{figure}
46 |
47 | The usual workflow looks something like this:
48 | \begin{itemize}
49 | \item \textsf{Metadata.} Fill in the \path{preamble/data.tex} file with the necessary information about the document --- title, author, and other \emph{metadata}.
50 | \item \textsf{Content.} Write the content of the document in the \path{chapters/} directory.
51 | If you need more chapters, just create a new file, and \macro{\include} it in the \path{thesis.tex} file at appropriate place.
52 | \item \textsf{Figures.} To include figures, you can put them in the \path{figures/} directory.
53 | Since this directory is by default included in \macro{\graphicspath}, there is no need to specify full/relative path, and it is enough to use just the filename in the \macro{\includegraphics} command.
54 | \item \textsf{Citations.} Using \grayenclose{for example} \macro{\autocite} macro, you can cite in the text any entry added to the \path{preamble/bibliography.bib} file.
55 | \end{itemize}
56 |
57 | \begin{remark}[Toggles]
58 | There are a couple of \emph{toggles} in the \path{thesis.tex} file that can be used to customize style/layout/creation of the document:
59 | \begin{itemize}
60 | \item \textsf{Page Layout} --- you can choose between \emph{Single-Side} or \emph{Two-Sided} printing by uncommenting the appropriate \macro{\documentclass} line.
61 | \item \textsf{Fancy Style} \textcolor{gray}{(default:\,\texttt{enabled})} --- if the default style is not to your liking, you can disable some of the more \enquote{fancy} stylistic elements by using the \custommacro{\FANCYfalse} line.
62 | \item \textsf{Work-In-Progress Version} \textcolor{gray}{(default:\,\texttt{disabled})} --- if you want to mark the document as a \emph{Draft}, leave the \custommacro{\WIPtrue} line uncommented (comment out for the final version).
63 | \begin{itemize}
64 | \item \textsf{Extra Margin} \textcolor{gray}{(default:\,\texttt{disabled})} --- the \emph{Draft} document will include extra right margin (for notes and corrections) when you enable it using \custommacro{\EXTRAMARGINtrue}.
65 | \end{itemize}
66 | \item \textsf{Censored Version} \textcolor{gray}{(default:\,\texttt{disabled})} --- if you want to censor chosen parts of the document, include the \custommacro{\CENSORtrue} line.
67 | \item \textsf{Include Only \ldots{}} --- if you want to compile only a subset of chapters, you can utilize the \custommacro{\includeonlysmart} command. \qedhere*
68 | \end{itemize}
69 | \end{remark}
70 |
71 | \begin{remark}[MFF CUNI Template Compatibility]
72 | \TeXtured{} can be used out of the box for theses at the Faculty of Mathematics and Physics, Charles University in Prague.
73 | Just be sure to include all \emph{front matter} pages and fill out necessary data:
74 | \begin{itemize}
75 | \item \textsf{Title Page} with the faculty logo (among other things),
76 | \item \textsf{Declaration},
77 | \item \textsf{Dedication} (optional),
78 | \item \textsf{Information Page} including the \textsf{Abstract}.
79 | \end{itemize}
80 | This is done by uncommenting the relevant lines in the main \path{thesis.tex} file.
81 |
82 | Layout of these front matter pages is adapted and modified from the original MFF CUNI template \autocite{MaresTemplate}.
83 | However, always make sure it is compliant with the faculty guidelines, otherwise please raise an issue on \textsf{GitHub} \autocite{TeXtured}.
84 | \end{remark}
85 |
86 | \begin{remark}[License]
87 | If you want to make your document publicly available (together with the source code), you should not forget to include an appropriate license of your choice --- change the \path{LICENSE} file, specifying the \href{https://creativecommons.org/publicdomain/zero/1.0/}{\texttt{CC0 1.0 Universal}} license of \TeXtured{}.
88 | \end{remark}
89 |
--------------------------------------------------------------------------------
/figures/Inkscape/add-watermark:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | usage() {
4 | echo "Usage: $0 "
5 | exit 1
6 | }
7 |
8 | [ "$#" -ne 2 ] && usage && exit 1
9 | [ ! -f "$1" ] && echo "File not found: $1" && exit 1
10 |
11 | directory=$(dirname "$1")
12 | [ ! -f "$directory/watermark-template.ps" ] && echo "Watermark template not found: $directory/watermark-template.ps" && exit 1
13 |
14 | ## Temporary files
15 | watermark=$(mktemp --suffix=.ps)
16 | tempfile=$(mktemp --suffix=.pdf)
17 |
18 | ## Replace the watermark text in the template
19 | sed "s//$2/" "$directory/watermark-template.ps" >"$watermark"
20 |
21 | ## Add the watermark to the PDF
22 | gs -q -dBATCH -dNOPAUSE -sDEVICE=pdfwrite \
23 | -sOutputFile="$tempfile" "$watermark" "$1"
24 |
25 | mv "$tempfile" "$1"
26 | rm "$watermark"
27 |
--------------------------------------------------------------------------------
/figures/Inkscape/inkscape-export-to-latex:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | [ -z "$1" ] && echo "Usage: $0 " && exit 1
4 | [ ! -f "$1.svg" ] && echo "File $1.svg not found" && exit 1
5 |
6 | ## Export Inkscape SVG to PDF+LaTeX code
7 | inkscape "$1.svg" --export-area-drawing --export-dpi=300 --export-latex --export-filename="$1.pdf"
8 |
9 | ## Disable interpolation in the PDF (to conform with PDF/A standard)
10 | # sed -i 's|/Interpolate true$|/Interpolate false|' "$1.pdf" # sometimes CORRUPTS the PDF
11 | ## https://stackoverflow.com/questions/20011515/how-to-remove-anti-aliasing-in-pdf-images
12 | perl -M-encoding -0777pe "s|/Interpolate true|' 'x17|ge" <"$1.pdf" >"$1-fixed.pdf"
13 |
14 | ## Add watermark to the PDF (if watermark script is available)
15 | directory=$(dirname "$1")
16 | if [ -f "$directory/add-watermark" ]; then
17 | ## try to extract the author's name from the LaTeX preamble
18 | author_name=$(sed -n 's/^[^%].*ThesisAuthorPlaintext}{}{\(.*\)}$/\1/p' preamble/data.tex)
19 | ## if the `\ThesisAuthorPlaintext` command is commented out, extract from the `\ThesisAuthor` command
20 | [ -z "$author_name" ] && author_name=$(sed -n 's/.*ThesisAuthor}{}{\(.*\)}$/\1/p' preamble/data.tex)
21 | ## use just ASCII characters, see https://unix.stackexchange.com/a/653210
22 | author_name=$(echo "$author_name" | uconv -x Latin-ASCII)
23 |
24 | watermark_string="$(date +%Y) $author_name" # prepend the year
25 | # watermark_string="$(date +%Y) Author's Name" # NOTE: or manually edit the watermark string here
26 |
27 | ## use the `add-watermark` script to insert the watermark into the PDF
28 | "$directory"/add-watermark "$1-fixed.pdf" "$watermark_string"
29 | fi
30 |
31 | mv "$1-fixed.pdf" "$1.pdf"
32 |
--------------------------------------------------------------------------------
/figures/Inkscape/parallel-plate-capacitor.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jdujava/TeXtured/b9a52e020cc6893ad330d9737bf39a7ed19e7d11/figures/Inkscape/parallel-plate-capacitor.pdf
--------------------------------------------------------------------------------
/figures/Inkscape/parallel-plate-capacitor.pdf_tex:
--------------------------------------------------------------------------------
1 | %% Creator: Inkscape 1.3.2 (091e20ef0f, 2023-11-25, custom), www.inkscape.org
2 | %% PDF/EPS/PS + LaTeX output extension by Johan Engelen, 2010
3 | %% Accompanies image file 'parallel-plate-capacitor.pdf' (pdf, eps, ps)
4 | %%
5 | %% To include the image in your LaTeX document, write
6 | %% \input{.pdf_tex}
7 | %% instead of
8 | %% \includegraphics{.pdf}
9 | %% To scale the image, write
10 | %% \def\svgwidth{}
11 | %% \input{.pdf_tex}
12 | %% instead of
13 | %% \includegraphics[width=]{.pdf}
14 | %%
15 | %% Images with a different path to the parent latex file can
16 | %% be accessed with the `import' package (which may need to be
17 | %% installed) using
18 | %% \usepackage{import}
19 | %% in the preamble, and then including the image with
20 | %% \import{}{.pdf_tex}
21 | %% Alternatively, one can specify
22 | %% \graphicspath{{/}}
23 | %%
24 | %% For more information, please see info/svg-inkscape on CTAN:
25 | %% http://tug.ctan.org/tex-archive/info/svg-inkscape
26 | %%
27 | \begingroup%
28 | \makeatletter%
29 | \providecommand\color[2][]{%
30 | \errmessage{(Inkscape) Color is used for the text in Inkscape, but the package 'color.sty' is not loaded}%
31 | \renewcommand\color[2][]{}%
32 | }%
33 | \providecommand\transparent[1]{%
34 | \errmessage{(Inkscape) Transparency is used (non-zero) for the text in Inkscape, but the package 'transparent.sty' is not loaded}%
35 | \renewcommand\transparent[1]{}%
36 | }%
37 | \providecommand\rotatebox[2]{#2}%
38 | \newcommand*\fsize{\dimexpr\f@size pt\relax}%
39 | \newcommand*\lineheight[1]{\fontsize{\fsize}{#1\fsize}\selectfont}%
40 | \ifx\svgwidth\undefined%
41 | \setlength{\unitlength}{720bp}%
42 | \ifx\svgscale\undefined%
43 | \relax%
44 | \else%
45 | \setlength{\unitlength}{\unitlength * \real{\svgscale}}%
46 | \fi%
47 | \else%
48 | \setlength{\unitlength}{\svgwidth}%
49 | \fi%
50 | \global\let\svgwidth\undefined%
51 | \global\let\svgscale\undefined%
52 | \makeatother%
53 | \begin{picture}(1,1.15333061)%
54 | \lineheight{1}%
55 | \setlength\tabcolsep{0pt}%
56 | \put(0,0){\includegraphics[width=\unitlength,page=1]{parallel-plate-capacitor.pdf}}%
57 | \end{picture}%
58 | \endgroup%
59 |
--------------------------------------------------------------------------------
/figures/Inkscape/template.svg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
19 |
38 |
40 |
44 |
46 |
47 |
49 |
50 |
51 | Jonáš Dujava
52 |
53 |
54 |
55 |
56 |
57 |
58 |
--------------------------------------------------------------------------------
/figures/Inkscape/watermark-template.ps:
--------------------------------------------------------------------------------
1 | % https://community.adobe.com/t5/postscript-discussions/make-text-watermark-on-top-of-background-image/m-p/5223824
2 | % https://stackoverflow.com/questions/12243044/is-it-possible-in-ghostscript-to-add-watermark-to-every-page-in-pdf
3 | % https://www.tek-tips.com/viewthread.cfm?qid=830058
4 | <<
5 | /BeginPage % pushes an integer on the operand stack indicating how many times showpage has been invoked
6 | {
7 | 0 eq { % only on the first page (0th invocation)
8 | currentpagedevice /PageSize get aload pop % get the page size (stack: `width` `height`)
9 | /ph exch def /pw exch def % save page height to `ph` and width to `pw`
10 | gsave % save current graphics state (used for restoring it later)
11 | /NimbusMonoPS-Regular findfont % find a font
12 | 2 scalefont setfont 0.9 setgray % set the font size and the gray level
13 | /myString () def % define watermark text
14 | myString dup stringwidth pop 2.5 add % ignore the height and get the width of the string (+extra offset for ©)
15 | pw exch sub 1.2 moveto % move to (x,y)=(`pw`-`stringwidth`-2.5,1.2) -> bottom right corner
16 | /copyright glyphshow % print the copyright symbol
17 | show % print the watermark text
18 | grestore % restore graphics state (to not disturb original content)
19 | true % show the page
20 | }
21 | { true } ifelse % just show the page
22 | } bind
23 | >> setpagedevice
24 |
--------------------------------------------------------------------------------
/figures/TeXtured-logo-dark-mode.svg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
19 |
38 |
40 |
44 |
49 |
53 |
57 |
58 |
59 |
61 |
62 |
64 |
65 |
66 | Jonáš Dujava
67 |
68 |
69 |
70 |
71 |
72 |
73 |
--------------------------------------------------------------------------------
/figures/TeXtured-logo-light-mode.svg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
19 |
38 |
40 |
44 |
48 |
52 |
56 |
57 |
58 |
60 |
61 |
63 |
64 |
65 | Jonáš Dujava
66 |
67 |
68 |
69 |
70 |
71 |
72 |
--------------------------------------------------------------------------------
/frontmatter/declaration.tex:
--------------------------------------------------------------------------------
1 | %%% A page with a solemn declaration
2 |
3 | \cleardoublepage
4 | \markboth{Declaration of Authorship}{Declaration of Authorship}
5 | \vspace*{\fill}
6 |
7 | \subsection*{Declaration of Authorship}
8 |
9 | I declare that I carried out this \ThesisType{} thesis on my own, and only with the cited sources, literature and other professional sources.
10 | I understand that my work relates to the rights and obligations under the Act No.~121/2000 Sb., the~Copyright Act, as amended, in particular the fact that the Charles University has the right to conclude a license agreement on the use of this work as a school work pursuant to Section 60 subsection 1 of the Copyright Act.
11 |
12 | \vspace{7ex}
13 |
14 | \begin{center}
15 | \renewcommand{\arraystretch}{1.3}
16 | \begin{tabular}{W{c}{0.32\linewidth} p{2em} W{c}{0.42\linewidth}}
17 | \arrayrulecolor{Gray70} \cmidrule{1-1} \cmidrule{3-3} % gray placeholder lines
18 | \emph{\textsf{Place \& Date}} && \emph{\textsf{\ThesisAuthor}} \\
19 | \end{tabular}
20 | \end{center}
21 |
22 | \vspace{5em}
23 | \newpage
24 |
--------------------------------------------------------------------------------
/frontmatter/dedication.tex:
--------------------------------------------------------------------------------
1 | \cleardoublepage
2 | \markboth{Dedication}{Dedication}
3 |
4 | \vspace*{-2ex}
5 | { \slshape
6 | Write dedication here.
7 | \begin{flushright}
8 | \sffamily\large
9 | \ThesisAuthor
10 | \end{flushright}
11 | }
12 |
13 | \vfill
14 |
--------------------------------------------------------------------------------
/frontmatter/img/MFF-logo.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jdujava/TeXtured/b9a52e020cc6893ad330d9737bf39a7ed19e7d11/frontmatter/img/MFF-logo.pdf
--------------------------------------------------------------------------------
/frontmatter/information.tex:
--------------------------------------------------------------------------------
1 | %%% Mandatory information page of the thesis
2 |
3 | %% NOTE: MFF guidelines can be found at
4 | %% https://www.mff.cuni.cz/cs/vnitrni-zalezitosti/predpisy/opatreni-dekana/opatreni-dekana-c-27-2023
5 | %% -> no special formatting is required, so it should be fine to customize it
6 |
7 | \cleardoublepage
8 |
9 | % \chapternotnumbered{Information \& Abstract}
10 | \MakeLinkTarget{}
11 | \addcontentsline{toc}{chapter}{Information \& Abstract}
12 | \markboth{Information \& Abstract}{Information \& Abstract}
13 |
14 | \subsection*{Information}
15 |
16 | \begin{tblr}{
17 | colspec = {r X},
18 | column{1} = {font=\small\sffamily\color{Gray40}},
19 | column{2} = {font=\small},
20 | }
21 | Title & \ThesisTitle \\
22 | Author & \ThesisAuthor \\
23 | \DeptType{} & \Department \\
24 | Supervisor & \Supervisor{} --- \SupervisorsDepartment \\
25 | % Abstract & \Abstract \\
26 | Keywords & \Keywords \\
27 | \end{tblr}
28 |
29 | \subsection*{Abstract}
30 |
31 | \Abstract
32 |
--------------------------------------------------------------------------------
/frontmatter/title.tex:
--------------------------------------------------------------------------------
1 | \pdfbookmark{Title Page}{titlepage} % add PDF outline entry
2 | \thispagestyle{empty} % no number on the title page
3 | \begin{center}
4 | \begin{adjustbox}{center,trim=0 0.2cm 4cm 0.2cm}
5 | \includegraphics[width=1.4\textwidth]{MFF-logo.pdf}
6 | \end{adjustbox}
7 |
8 | \Large
9 |
10 | \vspace{-2em}
11 | \vfill
12 |
13 | {\ifFANCY\sffamily\Huge\else\bfseries\LARGE\fi
14 | \MakeUppercase{\ThesisType} THESIS}
15 |
16 | \vfill
17 |
18 | {\Huge
19 | \ThesisAuthor}
20 |
21 | \vspace{1em}
22 |
23 | %% if `\ThesisTitleFront` is not defined, use `\ThesisTitle`
24 | \providecommand*{\ThesisTitleFront}{\ThesisTitle}
25 | % {\Huge \bfseries \ThesisTitleFront \par}
26 | {\fontsize{30pt}{36pt}\selectfont \bfseries
27 | \ThesisTitleFront \par}
28 |
29 | \vfill
30 |
31 | \Department
32 |
33 | \vspace{1.1em}
34 |
35 | \begin{center}
36 | \large
37 | \renewcommand{\arraystretch}{1.2}
38 | \begin{tabular}{>{\sffamily\color{Gray40}}r @{\hspace{1.0em}} l}
39 | Supervisor of the Thesis & \Supervisor \\
40 | \ifdef{\CoSupervisor}{%
41 | Co-Supervisor of the Thesis & \CoSupervisor \\
42 | }{}
43 | \ifdef{\StudyProgramme}{% TODO: programme vs program?
44 | Study Programme & \StudyProgramme \\
45 | }{}
46 | \end{tabular}
47 | \end{center}
48 |
49 | \vspace{2em}
50 |
51 | \ifFANCY\sffamily\fi
52 | Prague \YearSubmitted \\
53 | \ifdef{\YearRevision}{%
54 | \emph{Revised version \YearRevision} \par
55 | }{}
56 | \ifWIP
57 | \small\ttfamily \textcolor{red}{(Draft - \today)} \par
58 | \fi
59 | \end{center}
60 |
61 | \newpage
62 |
--------------------------------------------------------------------------------
/preamble/bibliography.bib:
--------------------------------------------------------------------------------
1 | %%% References/Bibliography
2 | @misc{TODO,
3 | author = {Unknown, Author},
4 | title = {{TODO}},
5 | }
6 | @misc{secondary_review,
7 | author = {Unknown, Author},
8 | title = {{Secondary Review}},
9 | }
10 | @thesis{Dujava2022,
11 | author = {Dujava, Jon\'{a}\v{s}},
12 | title = {{Counting operators in Effective Field Theory}},
13 | type = {Bachelor Thesis},
14 | institution = {Charles University},
15 | year = {2022},
16 | url = {https://hdl.handle.net/20.500.11956/175647},
17 | archiveprefix = {arXiv},
18 | primaryclass = {hep-th},
19 | eprint = {2211.05759},
20 | github = {jdujava/CountingInEFT},
21 | }
22 | @online{MaresTemplate,
23 | author = {Mare\v{s}, Martin and Kom\'{a}rek, Arno\v{s}t and Kulich, Michal},
24 | title = {{A Template for Typesetting Thesis at MFF UK in \LaTeX{}}},
25 | year = {2024},
26 | url = {https://gitlab.mff.cuni.cz/teaching/thesis-templates/thesis-en},
27 | addendum = {\mkbibacro{URL}\addcolon\space\url{https://mff.cuni.cz/en/students/student-theses-templates}},
28 | }
29 | @online{TeXtured,
30 | author = {Dujava, Jon\'{a}\v{s}},
31 | title = {{\TeXtured{} --- \LaTeX{} Template}},
32 | year = {2024},
33 | url = {https://overleaf.com/latex/templates/textured/zwtzzwgddbsh},
34 | github = {jdujava/TeXtured},
35 | }
36 | @online{ITTtemplate,
37 | author = {Wild, Vasco Alexander and Povel, Alex},
38 | title = {{Template of the Institute of Engineering Thermodynamics (M-21)}},
39 | year = {2024},
40 | url = {https://collaborating.tuhh.de/m21/public/theses/itt-latex-template},
41 | }
42 |
--------------------------------------------------------------------------------
/preamble/data.tex:
--------------------------------------------------------------------------------
1 | %% Thesis type: bachelor, master, doctoral
2 | \newcommand*{\ThesisType}{master}
3 |
4 | %% Thesis title (exactly as in the formal assignment)
5 | \newcommand*{\ThesisTitle}{\TeXtured{} Manual}
6 | %% Plaintext version for PDF metadata, uncomment if needed (defauls to \ThesisTitle)
7 | \newcommand*{\ThesisTitlePlaintext}{TeXtured Manual \TeXturedVERSION}
8 | %% Thesis title (if custom formatting is needed for the title page, defauls to \ThesisTitle)
9 | \newcommand*{\ThesisTitleFront}{
10 | \ThesisTitle\\
11 | {\Huge\color{gray}\TeXturedVERSION}
12 | }
13 |
14 | %% Author of the thesis
15 | \newcommand*{\ThesisAuthor}{\textcolor{red}{Author's Name}}
16 | %% Plaintext version for PDF metadata, uncomment if needed (defauls to \ThesisAuthor)
17 | \newcommand*{\ThesisAuthorPlaintext}{Author's Name}
18 |
19 | %% Year when the thesis is submitted
20 | \newcommand*{\YearSubmitted}{2025}
21 | %% Year of the last revision, uncomment if it is different from \YearSubmitted
22 | % \newcommand*{\YearRevision}{2025}
23 |
24 | %% University
25 | \newcommand*{\University}{Charles University}
26 |
27 | %% Name of the department or institute, where the work was officially assigned
28 | %% (according to the Organizational Structure of MFF UK in English,
29 | %% or a full name of a department outside MFF)
30 | \newcommand*{\Department}{\textcolor{red}{Name of the Department/Institute}}
31 |
32 | %% Is it a Department (katedra), or an Institute (ústav)?
33 | \newcommand*{\DeptType}{Institute}
34 |
35 | %% Thesis supervisor: name, surname and titles
36 | \newcommand*{\Supervisor}{\textcolor{red}{Name, Surname, and Titles}}
37 | %% Thesis co-supervisor: name, surname and titles (uncomment if applicable)
38 | % \newcommand*{\CoSupervisor}{Name, Surname, and Titles}
39 |
40 | %% Supervisor's department/institute (again according to Organizational structure of MFF)
41 | \newcommand*{\SupervisorsDepartment}{\textcolor{red}{Supervisor's Department/Institute}}
42 |
43 | %% Study programme and specialization
44 | \newcommand*{\StudyProgramme}{\textcolor{red}{Study Programme}}
45 |
46 | %% Abstract (recommended length around 80-200 words; this is not a copy of your thesis assignment!)
47 | \newcommand*{\Abstract}{%
48 | \textcolor{red}{Write abstract here.}
49 | }
50 |
51 | %% Subject (short description for PDF metadata)
52 | \newcommand*{\Subject}{%
53 | Write subject here.
54 | }
55 |
56 | %% Keywords (about 3-7)
57 | \newcommand*{\Keywords}{%
58 | \textcolor{red}{Manual, Demo, Draft, WIP}
59 | }
60 | %% Plaintext version for PDF metadata, uncomment if needed (defauls to \Keywords)
61 | \newcommand*{\KeywordsPlaintext}{%
62 | Manual, Demo, Draft, WIP
63 | }
64 |
--------------------------------------------------------------------------------
/preamble/debug/commands.tex:
--------------------------------------------------------------------------------
1 | %% Include only listed files
2 | %% NOTE: ignored if the document is not in WIP mode, or if the argument is empty
3 | \NewDocumentCommand{\includeonlysmart}{m}{
4 | \ifWIP % ignore if not WIP
5 | \IfBlankF{#1}{\includeonly{#1}} % ignore if empty argument
6 | \fi
7 | }
8 |
9 | %% Draw black "slugs" whenever a line overflows, so that we can spot it easily
10 | \ifWIP
11 | \overfullrule=1mm
12 | \ifluatex % only for luaLaTeX
13 | % \usepackage{lua-visual-debug} % helper for space tweaking
14 | \fi
15 | \fi
16 |
17 | %% Censoring
18 | \usepackage{censor}
19 | \ifCENSOR % censor package censors by default
20 | % do nothing if censoring requested
21 | \else
22 | \StopCensoring % disable censoring
23 | \fi
24 |
--------------------------------------------------------------------------------
/preamble/debug/line-numbers.tex:
--------------------------------------------------------------------------------
1 | \usepackage[pagewise]{lineno} % line numbers for drafts
2 |
3 | \newif\ifDebugLineNumbers
4 | %% NOTE: Uncomment out the following line to show line numbers
5 | % \DebugLineNumberstrue % show line numbers (by default disabled)
6 |
7 | \ifDebugLineNumbers
8 | \ifWIP
9 | \linenumbers
10 | \renewcommand{\linenumberfont}{\normalfont\footnotesize\ttfamily\color{black!15}}
11 | \setlength\linenumbersep{1em}
12 | \fi
13 | \fi
14 |
--------------------------------------------------------------------------------
/preamble/debug/silence.tex:
--------------------------------------------------------------------------------
1 | \usepackage[debrief]{silence} % filter out unwanted warnings
2 |
3 | % ignore "Marginpar on page ___ moved" (basically harmless)
4 | \WarningFilter{latex}{Marginpar on page}
5 |
6 | %% ignore "Unused \captionsetup[floatfoot]" (harmless)
7 | \WarningFilter{caption}{Unused \captionsetup[floatfoot]}
8 |
9 | %% ignore "Detected the "physics" package: omitting definition of \qty."
10 | %% see https://github.com/josephwright/siunitx/issues/720
11 | \ExplSyntaxOn
12 | \msg_redirect_name:nnn{siunitx}{physics-pkg}{none}
13 | \ExplSyntaxOn
14 |
15 | %% ignore "Font shape `U/stmry/m/n' in size <30> (or <15>) not available ..."
16 | %% WARN: stmry math font is not availabe in arbitary sizes
17 | %% -> it will be replaced by closes available size
18 | \WarningFilter{latexfont}{Font shape `U/stmry/m/n' in size <30>}
19 | \WarningFilter{latexfont}{Font shape `U/stmry/m/n' in size <15>}
20 | \WarningFilter*{latexfont}{Size substitutions with differences\MessageBreak
21 | up to \font@submax\space have occurred}
22 |
23 | %% ignore "Font shape `OT1/cmbr/bx/n' in size (less than <9>) ..."
24 | %% WARN: sans-serif math font is not available for sizes smaller than <9>
25 | %% -> it will be replaced by regular (not bold, medium) font
26 | \WarningFilter{latexfont}{Font shape `OT1/cmbr/bx/n' in size <6>}
27 | \WarningFilter{latexfont}{Font shape `OT1/cmbr/bx/n' in size <7>}
28 | \WarningFilter{latexfont}{Font shape `OT1/cmbr/bx/n' in size <8>}
29 |
--------------------------------------------------------------------------------
/preamble/environments/init.tex:
--------------------------------------------------------------------------------
1 | %%% Macros for definitions, theorems, claims, examples, ...
2 | \usepackage{keytheorems} % key-value interface for enhanced theorem/proof environments
3 | % extending `amsthm` (modern implementation of `thmtools` package)
4 |
5 | \usepackage{tcolorbox} % flexible frames/boxes
6 | \tcbuselibrary{skins, breakable, theorems}
7 |
8 | %% Default style options for `tcolorbox` environments (used in theorems, remarks, ...)
9 | \newlength{\depthofj} \settodepth{\depthofj}{j} % save depth of character "j" (typical descender)
10 | \tcbset{
11 | enhanced, % TODO: need to test for differences
12 | colframe=black, colback=white,
13 | boxrule=0.4pt, arc=3pt, boxsep=0em,
14 | left=0.9em, right=0.9em, top=1.3ex, bottom=1.3ex-0.8\depthofj, % try to reduce effect of descenders
15 | % enlarge bottom at break by=-\depthofj,
16 | % pad at break*=3ex,
17 | beforeafter skip=0.5\baselineskip plus 2pt,
18 | }
19 | \tcbset{ % persist font color from the text before the box, see https://github.com/T-F-S/tcolorbox/issues/305
20 | every box/.style={coltext=.}, % dot `.` refers to the current text color (just before the box)
21 | } % set inside `every box`, thus using color at the place of box creation
22 |
23 | %%% Definitions of theorem/remark-like environments
24 | \newkeytheoremstyle{thmcommon}{
25 | headfont=\bfseries\sffamily,
26 | notefont=\mdseries\sffamily,
27 | bodyfont=\normalfont,
28 | headpunct={\strut.}, % dot, and `\strut` to ensure consistent height of the first line
29 | }
30 |
31 | %% More flexible placement of "qed" symbol (star/optional argument tweaks the vertical shift)
32 | %% NOTE: this is used in all theorem/remark-like environments to ensure consistent height
33 | %% of the final line, particularly when the last line is an equation
34 | \NewCommandCopy{\oldqedhere}{\qedhere}
35 | \RenewDocumentCommand{\qedhere}{s o}{%
36 | \def\qedshift{0.6ex}% % by default, set shift corresponfing to normal height display math
37 | \IfBooleanT{#1}{\def\qedshift{1.5ex}}% if starred, set shift corresponding to big operators (\sum, ...)
38 | \IfValueT{#2}{\def\qedshift{#2}}% % if optional argument is passed, set shift to the custom value
39 | \NewCommandCopy{\oldqed}{\qedsymbol}%
40 | \renewcommand*{\qedsymbol}{\raisebox{-\qedshift}{\oldqed}}%
41 | \oldqedhere%
42 | }
43 |
44 | %% provide a reference type name for `zref-clever` package
45 | %% NOTE: the plural form is defined only heuristically, tweak manually later if necessary
46 | \NewDocumentCommand{\declareCleverTypeName}{m}{
47 | \zcRefTypeSetup{#1}{
48 | name-sg = #1, Name-sg = \MakeTitlecase{#1}, % singular form (second is capitalized)
49 | name-pl = #1s, Name-pl = \MakeTitlecase{#1}s, % plural form (second is capitalized)
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/preamble/environments/remark-like.tex:
--------------------------------------------------------------------------------
1 | %% Mark denoting end of remark-like environment;
2 | %% `\strut` to ensure consistent height of the final line
3 | %% `\hspace{-0.9em}` to enable longer last line in remark-like environments,
4 | %% otherwise the line is breaking earlier then necesarry
5 | \newcommand*{\remarkqed}{\hspace{-0.9em}\textcolor{black!60}{\(\lrcorner\)}\strut}
6 |
7 | %% Factory for new remark-like environments
8 | \NewDocumentCommand{\NewRemarkLike}{O{qed=\remarkqed} m}{
9 | \declarekeytheorem{#2}[
10 | sibling=table, % same numbering as tables/figures
11 | style=thmcommon, % use the common theorem style
12 | #1, % other options, such as `qed` symbol
13 | tcolorbox-no-titlebar={ % wrap in a `tcolorbox`
14 | parbox=false,
15 | breakable, % allow breaking
16 | blanker, % no frame
17 | overlay first={ %% marks indicating that the box continues to the next page
18 | \draw[-{>[length=2pt]}, line width=0.7pt, black!15] ([xshift=0.5em,yshift=0.9ex]frame.south east) -- +(0.08,0) arc[start angle=90, end angle=0, radius=0.05] -- +(0,-0.2);
19 | },
20 | overlay middle={
21 | \draw[-{>[length=2pt]}, line width=0.7pt, black!15] ([xshift=0.5em,yshift=0.9ex]frame.south east) -- +(0.08,0) arc[start angle=90, end angle=0, radius=0.05] -- +(0,-0.2);
22 | \draw[{<[length=2pt]}-, line width=0.7pt, black!15] ([xshift={-0.5em-0.15},yshift={-1.1ex}]frame.north west) -- +(-0.1,0) arc[start angle=270, end angle=180, radius=0.05] -- +(0,0.2);
23 | },
24 | overlay last={
25 | \draw[{<[length=2pt]}-, line width=0.7pt, black!15] ([xshift={-0.5em-0.15},yshift={-1.1ex}]frame.north west) -- +(-0.1,0) arc[start angle=270, end angle=180, radius=0.05] -- +(0,0.2);
26 | },
27 | }
28 | ]
29 | \declareCleverTypeName{#2} % provide a reference type name
30 | }
31 | \NewDocumentCommand{\NewRemarkLikes}{>{\SplitList{,}}m}{\ProcessList{#1}{\NewRemarkLike}}
32 |
33 | %% Define remark-like environments
34 | \NewRemarkLikes{remark, example, derivation, calculation, idea, tip}
35 |
36 |
37 | %%% Proof environment
38 |
39 | %% Proof QED symbol
40 | %% `\hspace{-1em}` to enable longer last line in the proof environment,
41 | %% otherwise the line is breaking earlier then necesarry
42 | \newcommand*{\proofqed}{
43 | \color{black!60}% lighter color for the smaller square QED symbol
44 | \hspace{-1em}\raisebox{-0.01em}{\(\square[0.4em][aligntableaux=bottom]\mspace{1mu}\)}% tweak positioning
45 | \strut% ensure consistent height of the final line
46 | }
47 |
48 | %% Make proof environment remark-like without numbering
49 | \let\proof\relax
50 | \NewRemarkLike[numbered=no, qed=\proofqed]{proof}
51 | \NewRemarkLike[numbered=no, name={Idea of the Proof}, qed=\proofqed]{proofidea}
52 |
53 | %% NOTE: Suggestion on how to pass arguments to `tcolorbox` when calling proof
54 | %% https://tex.stackexchange.com/questions/565220/is-it-possibe-to-pass-options-to-a-tcolorboxenvironment
55 | %% Maybe useful for nesting, or other rare behavior.
56 |
--------------------------------------------------------------------------------
/preamble/environments/theorem-like.tex:
--------------------------------------------------------------------------------
1 | %% Ensure consistent height of the final line with `\strut`
2 | %% `\hspace{-1.␣␣em}` to enable longer last line in theorem-like environments,
3 | %% otherwise the line is breaking earlier then necesarry
4 | \newcommand*{\theoremqed}{\hspace{-1.195em}\strut}
5 |
6 | %% Factory for new theorem-like environments
7 | \NewDocumentCommand{\NewTheoremLike}{O{qed=\theoremqed} m}{
8 | \declarekeytheorem{#2}[
9 | sibling=table, % same numbering as tables/figures
10 | style=thmcommon, % use the common theorem style
11 | #1, % other options, such as `qed` symbol
12 | tcolorbox-no-titlebar={parbox=false, breakable}, % wrap in a `tcolorbox`, allow breaking
13 | % TODO: maybe set refname, Refname already here, see https://github.com/mbertucci47/keytheorems/issues/21
14 | ]
15 | \declareCleverTypeName{#2} % provide a reference type name
16 | }
17 | \NewDocumentCommand{\NewTheoremLikes}{>{\SplitList{,}}m}{\ProcessList{#1}{\NewTheoremLike}}
18 |
19 | %% Define theorem-like environments
20 | \NewTheoremLikes{definition, theorem, lemma, corollary, proposition}
21 |
22 | %% Tweak plural form of `corollary` reference type name
23 | \zcRefTypeSetup{corollary}{
24 | name-sg = corollary, Name-sg = Corollary, % singular form
25 | name-pl = corollaries, Name-pl = Corollaries, % plural form
26 | }
27 |
--------------------------------------------------------------------------------
/preamble/environments/todo-like.tex:
--------------------------------------------------------------------------------
1 | %%% Helper TODO/WIP environments
2 |
3 | %% Quick inline todo command
4 | \NewDocumentCommand{\todo}{O{} >{\TrimSpaces} m}{%
5 | \textcolor{red}{%
6 | \textsf{TODO\IfBlankF{#1}{(#1)}}%
7 | \IfBlankTF{#2}{.}{: #2}%
8 | }%
9 | }
10 |
11 | %% Base style for todo-like environments
12 | \tcbset{
13 | todolike/.style={
14 | % breakable, after upper=\strut, parbox=false,
15 | breakable, parbox=false,
16 | colframe=pink, sharp corners=west, boxrule=0pt, leftrule=4pt,
17 | coltitle=black, fonttitle=\sffamily\bfseries,
18 | attach title to upper={\ },
19 | beforeafter skip=0.5\baselineskip plus 2pt,
20 | }
21 | }
22 | %% Factory for new todo-like environments
23 | \NewDocumentCommand{\NewTodoLike}{mm}{
24 | \NewTColorBox{#1}{o}{todolike, colback=#2, title={#1\IfValueT{##1}{ \textmd{(##1)}}.}}
25 | }
26 |
27 | %% Define todo-like environments
28 | \NewTodoLike{Todo}{pink!20}
29 | \NewTodoLike{Question}{orange!10}
30 | \NewTodoLike{Suggestion}{cyan!10}
31 | \NewTodoLike{Note}{cyan!50!green!10}
32 |
--------------------------------------------------------------------------------
/preamble/general/colors.tex:
--------------------------------------------------------------------------------
1 | %% Colors
2 | \usepackage[rgb,table]{xcolor} % color facilities
3 |
4 | %% TODO: slightly darker gray color for "optional" words
5 | \definecolor{ChapterNumberColor}{gray}{0.88}
6 | \definecolor{HeaderColor}{gray}{0.35}
7 | \definecolor{HeaderRuleColor}{gray}{0.75}
8 | \definecolor{UrlColor}{RGB}{255,127,100}
9 | \definecolor{CiteColor}{RGB}{127,230,252}
10 |
11 | \definecolor{Gray10}{gray}{0.1}
12 | \definecolor{Gray20}{gray}{0.2}
13 | \definecolor{Gray30}{gray}{0.3}
14 | \definecolor{Gray40}{gray}{0.4}
15 | \definecolor{Gray50}{gray}{0.5}
16 | \definecolor{Gray60}{gray}{0.6}
17 | \definecolor{Gray70}{gray}{0.7}
18 | \definecolor{Gray80}{gray}{0.8}
19 | \definecolor{Gray90}{gray}{0.9}
20 |
21 | \definecolor{LightGrayFill}{gray}{0.97}
22 |
--------------------------------------------------------------------------------
/preamble/general/floats.tex:
--------------------------------------------------------------------------------
1 | %% Configuration of figures, tables, captions, ...
2 |
3 | %% Use same numbering for figures, tables, and equations
4 | \makeatletter
5 | \let\c@figure\c@table
6 | \let\c@equation\c@table
7 | \makeatother
8 |
9 | %%% Graphics
10 | \usepackage{graphicx} % embedding of pictures
11 | \graphicspath{ % default paths to figures
12 | {./figures/}
13 | {./figures/Inkscape/}
14 | {./frontmatter/img/}
15 | }
16 | %% Macro for appending to the graphics path
17 | \ExplSyntaxOn
18 | \NewDocumentCommand{\appendtographicspath}{m}{
19 | \tl_if_exist:cF { Ginput@path } { \tl_new:c { Ginput@path } }
20 | \tl_gput_right:cn { Ginput@path } { #1 }
21 | }
22 | \ExplSyntaxOff
23 |
24 | %%% Tables
25 | \usepackage{adjustbox} % center big tables
26 | \usepackage{array} % custom column types in tables
27 | \usepackage{booktabs} % improved horizontal lines in tables
28 |
29 | %% Increase default vertical space between rows in tables (default is 1.0)
30 | \renewcommand*{\arraystretch}{1.1}
31 |
32 | \usepackage{tabularray} % advanced LaTeX tables
33 | \usepackage{codehigh} % verbatim in tables (with `\fakeverb` macro)
34 | \UseTblrLibrary{amsmath, booktabs, siunitx} % load libraries for `tabularray`
35 |
36 |
37 | %% Does \centering automatically, provides side captions (`\fcapside`) and much more
38 | %% Inspired by https://collaborating.tuhh.de/m21/public/theses/itt-latex-template
39 | \usepackage{floatrow}
40 | \floatsetup{ % for all floats
41 | footnoterule = none,
42 | footposition = bottom,
43 | }
44 | \floatsetup[figure]{
45 | capbesideposition = right,
46 | capbesidesep = quad,
47 | }
48 |
49 | %% If you want to position the caption above the figure, use the following
50 | % \floatsetup[table]{
51 | % style = plaintop, % caption always above, no matter where \caption is called
52 | % }
53 |
54 | %% Set caption width to be the same as the table width
55 | % \floatsetup[longtable]{LTcapwidth=table} % https://tex.stackexchange.com/a/345772/120853
56 |
57 | \usepackage{caption} % customizing captions in floating environments
58 | \usepackage{subcaption}
59 |
60 | % \DeclareCaptionLabelSeparator{slash}{~/~} % `␣/␣` between label and caption
61 | \DeclareCaptionLabelSeparator{slash}{\hspace{0.25em}/\hspace{0.25em}} % `␣/␣` between label and caption
62 | \captionsetup{
63 | format = plain, % no hanging indent
64 | indention = 0.6em, % but still slightly indent the caption
65 | % format = hang, % alternative: hanging indent
66 | font = small,
67 | labelfont = {sf,bf},
68 | labelsep = slash,
69 | labelformat = simple,
70 | tableposition = bottom,
71 | parskip = .3\baselineskip plus 1pt,
72 | }
73 |
74 | \makeatletter
75 | % Make this new length and indent, same length as regular caption indent:
76 | \newlength{\floatfootruleindent}
77 | \setlength{\floatfootruleindent}{\caption@indent}% Set the new length
78 | % A bit hacky; introduce a rule underneath caption if \floatfoot is called:
79 | \renewcommand*{\floatfootskip}{2pt\color{Gray50}\hspace{\floatfootruleindent}\hrulefill}%
80 | \makeatother
81 |
82 | \DeclareCaptionFont{ftfont}{%
83 | \scriptsize%
84 | \color{Gray60}%
85 | \sffamily\raggedleft%
86 | }
87 | \captionsetup[floatfoot]{
88 | footfont=ftfont, % https://tex.stackexchange.com/q/9547/120853
89 | }
90 |
91 | %%% You can change the justification of all side-captions here
92 | % \captionsetup[capbesidefigure]{
93 | % % When using sidecaptions, the linewidth can be rather small and awkward breaks and
94 | % % many underfull hboxes occur. Therefore, raggedright.
95 | % justification=raggedright,
96 | % }
97 | %
98 | % \captionsetup[subfigure]{%
99 | % labelformat=simple,% 'parens' uses parantheses, 'brace' just the right one
100 | % labelsep=slash,%
101 | % labelfont={sf,bf},%
102 | % list=off,% list=off removes subfigures from LoF
103 | % }%
104 | %
105 | % \captionsetup[subtable]{%
106 | % labelformat=simple,% 'parens' uses parantheses, 'brace' just the right one
107 | % labelsep=slash,%
108 | % labelfont={sf,bf},%
109 | % list=off,% list=off removes subfigures from LoF
110 | % }%
111 |
112 | %% Change counter from Arabic number to letter:
113 | \renewcommand*{\theContinuedFloat}{\alph{ContinuedFloat}}
114 |
--------------------------------------------------------------------------------
/preamble/general/hyperref.tex:
--------------------------------------------------------------------------------
1 | %% Hyperlinks, PDF metadata
2 | \usepackage[allowmove]{url}
3 | \usepackage{hyperref} % clickable links and metadata
4 | \usepackage{bookmark} % more control over PDF bookmarks
5 |
6 | \usepackage{zref-titleref}
7 | \usepackage{zref-clever}
8 | \zcsetup{
9 | cap, % capitalize the first letter of the reference type name
10 | noabbrev % do not use abbreviations
11 | }
12 |
13 | %% Fallbacks for PDF metadata commands
14 | \providecommand*{\ThesisAuthorPlaintext}{\ThesisAuthor}
15 | \providecommand*{\ThesisTitlePlaintext}{\ThesisTitle}
16 | \providecommand*{\KeywordsPlaintext}{\Keywords}
17 |
18 | \hypersetup{
19 | linktoc = all, % whole entry in TOC is clickable link
20 | colorlinks = true, % color links/references (if not using boxed variants provided by \Cref{...})
21 | urlcolor = [rgb]{0.82,0.25,0.08}, % tweak the default URL color
22 | pdfborder = {0 0 0}, % to disable borders/frames around links (even when colorlinks=false)
23 | pdflinkmargin = 1.0pt, % extra link area around the text box (default 1pt)
24 | pdfdisplaydoctitle, % https://tex.stackexchange.com/a/435434/120853
25 | }
26 | \hypersetup{ % PDF metadata
27 | pdfauthor = {\ThesisAuthorPlaintext},
28 | pdftitle = {\ThesisTitlePlaintext},
29 | pdfsubject = {\Subject},
30 | pdfkeywords = {\KeywordsPlaintext},
31 | pdfcreator = {LaTeX with hyperref, and biblatex/biber},
32 | }
33 | \bookmarksetup{
34 | numbered, % include chapter/section numbers in PDF outline
35 | open, openlevel=1, % expand bookmarks to level 1 (chapters)
36 | }
37 |
38 |
39 | %% NOTE: look of references, hyperlinks, and citations is customized
40 | %% mainly in `preamble/hacks/custom-reference-boxes.tex`
41 |
--------------------------------------------------------------------------------
/preamble/general/typesetting.tex:
--------------------------------------------------------------------------------
1 | %%% Typesetting, figures, tables, etc.
2 |
3 | \ifpdftex % only for pdfLaTeX
4 | \usepackage[T1]{fontenc} % better support for accented characters
5 | \fi
6 | \usepackage{lmodern} % Latin Modern fonts
7 | \usepackage{romanbar} % Roman numerals with bars, provides `\Romanbar{...}`
8 |
9 | %% slightly more breathing space between lines
10 | \linespread{1.05}\selectfont
11 |
12 | %% Commands for accessing extra Latin Modern fonts
13 | %% - `sbc` - sans bold condensed
14 | %% - `sfe` - sans serif extended (font family `lmssq` for "Latin Modern Sans Serif Quotation")
15 | %% https://www.tug.org/pracjourn/2006-1/robertson/robertson.pdf
16 | \newcommand*{\sbcseries}{\sffamily\fontseries{sbc}\selectfont}
17 | \newcommand*{\sfefamily}{\fontfamily{lmssq}\selectfont}
18 | \DeclareTextFontCommand{\textsbc}{\sbcseries}
19 | \DeclareTextFontCommand{\textsfe}{\sfefamily}
20 |
21 | %% use slanted shape for emphasis `\emph{...}`, and for nested emphasis use italics
22 | \DeclareEmphSequence{\slshape,\itshape}
23 |
24 | \usepackage{microtype} % improve typography
25 | \DisableLigatures[-]{family=tt*} % disable ligatures in typewriter font
26 | \usepackage{parskip} % no paragraph indentation
27 | \usepackage{csquotes} % context-sensitive quotation facilities
28 |
29 | %% Enumerate/itemize environments
30 | \usepackage[alwaysadjust,neverdecrease]{paralist} % improved enumerate and itemize
31 | \setdefaultleftmargin{1.87em}{1.7em}{1.5em}{1em}{1em}{1em}
32 | \setdefaultitem{$\bullet$}{\textbullet}{\textasteriskcentered}{\textperiodcentered}
33 | \setdefaultenum{\bfseries (1)}{\bfseries (a)}{\bfseries (i)}{A.}
34 |
--------------------------------------------------------------------------------
/preamble/hacks/custom-reference-boxes.tex:
--------------------------------------------------------------------------------
1 | %% Functionality of PDF frames around links is nice, but their look can be improved.
2 | %% Moreover, not all PDF viewers support/show them.
3 | %% In the following we setup frames around ref/href/url/cite links via `tcolorbox`.
4 |
5 | %% Universal style options applied to all links
6 | \tcbset{
7 | link/.style={
8 | nobeforeafter, box align=base, boxsep=0em, before upper={\vphantom{]}},
9 | left=0.15em, right=0.15em, top=0.25ex, bottom=0.05ex,
10 | arc=0.1em, rounded corners=all, boxrule=0.3mm,
11 | grow sidewards by=0.05em, enlarge bottom by=-0.05ex, enlarge top by=-0.4ex,
12 | }
13 | }
14 | %% Style modifications for different types of links
15 | \tcbset{
16 | refbox/.style ={colframe=black!30, colback=black!3},
17 | % refbox/.style ={colframe=black!30, colback=black!3, fontupper=\sffamily},
18 | pagebox/.style={refbox, boxsep=0.1ex, bottom=0.25ex, fontupper=\ttfamily},
19 | hrefbox/.style={colframe=black!10!UrlColor!70, colback=UrlColor!15},
20 | citebox/.style={left=0em, right=0em, bottom=0.25ex, colframe=black!10!CiteColor!80, colback=CiteColor!20, fontupper=\ttfamily},
21 | }
22 | %% Definition of the link boxes (loading corresponding styles)
23 | \NewTCBox{\refbox} {!O{}}{link,refbox, #1}
24 | \NewTCBox{\pagebox}{!O{}}{link,pagebox,#1}
25 | \NewTCBox{\hrefbox}{!O{}}{link,hrefbox,#1}
26 | \NewTCBox{\citebox}{!O{}}{link,citebox,#1}
27 |
28 | %% Save the original link commands
29 | \NewCommandCopy{\hrefold}{\href}
30 | \NewCommandCopy{\urlold}{\url}
31 |
32 | %% Overwrite the default link commands to use the new boxes
33 | \RenewDocumentCommand{\href}{O{} m m}{\hrefold{#2}{\hrefbox[#1]{#3}}} % remote links (DOI, arXiv, etc.)
34 | \RenewDocumentCommand{\url}{O{} m}{\href[#1]{#2}{\nolinkurl{#2}}} % URLs (using the new \href command)
35 |
36 | %% Clever reference with reference type name and page number in a superscript, all wrapped in a box
37 | %% TODO: maybe automatically omit the page number if the reference is on the same page?
38 | %% TODO: maybe (optionally) append name of theorem/remark/...?
39 | \DeclareDocumentCommand{\Cref}{s m}{%
40 | \hyperref[#2]{% link around the whole reference box
41 | \refbox[right={\IfBooleanTF{#1}{0.15em}{0.1em}}]{% box around the reference (tweak right padding)
42 | \zcref*[noref]{#2}~\zcref*[noname]{#2}% reference type name and label (number)
43 | \IfBooleanF{#1}{% if not starred, add page number to the superscript
44 | \textsuperscript{\ttfamily\tiny\(\,\to\,\)p.\zpageref{#2}}%
45 | }%
46 | }%
47 | }%
48 | }
49 | %% Like \Cref, but use reference title
50 | \DeclareDocumentCommand{\Nref}{s m}{%
51 | \hyperref[#2]{% link around the whole reference box
52 | \refbox[right={\IfBooleanTF{#1}{0.15em}{0.1em}}]{% box around the reference (tweak right padding)
53 | \ztitleref{#2}% reference title
54 | \IfBooleanF{#1}{% if not starred, add page number to the superscript
55 | \textsuperscript{\ttfamily\tiny\(\,\to\,\)p.\zpageref{#2}}%
56 | }%
57 | }%
58 | }%
59 | }
60 |
61 | %% TODO: figure out how to push `tcbox` on the next line if it would cause overfull hbox...
62 | %% issues: https://github.com/T-F-S/tcolorbox/issues/223
63 | %% https://github.com/T-F-S/tcolorbox/issues/272
64 |
65 |
66 | %% Backreferences in the bibliography
67 | \NewDocumentCommand{\pagelink}{O{} m}{\hyperlink{page.#2}{\pagebox[#1]{#2}}}
68 | %% -> changed from /usr/share/texmf-dist/tex/latex/biblatex/biblatex.def
69 | \makeatletter
70 | \DeclareListFormat{pageref}{%
71 | \ifnumless{\abx@pagerefstyle}{0}
72 | {\usebibmacro{list:plain}%
73 | \ifhyperref
74 | % {\hyperlink{page.#1}{#1}} % changed
75 | {\pagelink{#1}} % <--- to this
76 | {#1}}
77 | {\ifnumequal{\value{listcount}}{1}
78 | {\usebibmacro{pageref:init}}
79 | {}%
80 | \usebibmacro{pageref:comp}{#1}%
81 | \ifnumequal{\value{listcount}}{\value{liststop}}
82 | {\usebibmacro{pageref:dump}}
83 | {}}}
84 | \makeatother
85 |
--------------------------------------------------------------------------------
/preamble/hacks/fix-hyperref.tex:
--------------------------------------------------------------------------------
1 | %% HACK: fix https://github.com/T-F-S/tcolorbox/issues/297
2 | %% see https://github.com/latex3/hyperref/commit/6f0378f4339538d397874873d338c85c8b03c6bb#diff-78b0d75637be67a5e057881594b09f87fa61562fb56bde1e1298c81c30fa45e8R431
3 | %% modifies /usr/share/texmf-dist/tex/latex/hyperref/hyperref.sty
4 | \ExplSyntaxOn
5 | \makeatletter
6 | \cs_undefine:N \__hyp_target_raise:n
7 | \cs_new_protected:Npn \__hyp_target_raise:n #1
8 | {
9 | \mode_if_vertical:TF
10 | { #1 }
11 | {
12 | \Hy@SaveSpaceFactor
13 | \penalty\@M
14 | \smash
15 | {
16 | \box_move_up:nn
17 | { \normalbaselineskip }
18 | {
19 | \hbox:n
20 | {
21 | \Hy@RestoreSpaceFactor
22 | #1
23 | \Hy@SaveSpaceFactor
24 | }
25 | }
26 | }
27 | \kern0pt
28 | \Hy@RestoreSpaceFactor
29 | }
30 | }
31 | \makeatother
32 | \ExplSyntaxOff
33 |
--------------------------------------------------------------------------------
/preamble/hacks/fix-qed.tex:
--------------------------------------------------------------------------------
1 | %% HACK: Fix bug, where \qedhere overwrotes the proper behavior of \tag
2 | %% I dont entirely know what I am doing here, but seems to work
3 | %% -> changed from /usr/share/texmf-dist/tex/latex/amscls/amsthm.sty
4 | \makeatletter
5 | \renewcommand*{\equation@qed}{%
6 | \iftagsleft@
7 | \hbox{\phantom{\quad\qedsymbol}}%
8 | \gdef\alt@tag{%
9 | \rlap{\hbox to\displaywidth{\hfil\qedsymbol}}%
10 | \global\let\alt@tag\@empty
11 | }%
12 | \else
13 | \gdef\alt@tag{%
14 | \global\let\alt@tag\@empty
15 | \vtop{\ialign{\hfil####\cr
16 | % \tagform@\theequation\cr % <--- original
17 | \make@display@tag\cr % <--- changed
18 | \qedsymbol\cr}}%
19 | % \setbox\z@ % <--- original
20 | \if@eqnsw \setbox\z@ \fi % <--- changed
21 | }%
22 | \fi
23 | }
24 | \makeatother
25 |
--------------------------------------------------------------------------------
/preamble/hacks/floatrow-parskip.tex:
--------------------------------------------------------------------------------
1 | %% BUG: `floatrow` captions (that is ones set with `\fcapside` or `\ffigbox`)
2 | %% do not respect the `parskip` option of the `caption` package.
3 | %% More generally, the usual paragraph spacing is not applied in such captions.
4 |
5 | %% HACK: By commenting out the `\everypar{}` in the `\@arrayparboxrestore` macro,
6 | %% the ordinary paragraph spacing is restored in the `floatrow` captions.
7 | %% However, I am not entirely sure why this works..
8 |
9 | \makeatletter
10 | \newcommand*{\redefineparboxrestore}{%
11 | \def\@arrayparboxrestore{%
12 | \let\if@nobreak\iffalse
13 | \let\if@noskipsec\iffalse
14 | \let\par\@@par
15 | \let\-\@dischyph
16 | \let\'\@acci\let\`\@accii\let\=\@acciii
17 | \parindent\z@ \parskip\z@skip
18 | % \everypar{} % <--- commented out, so that paragraphs work properly in the caption
19 | \linewidth\hsize
20 | \@totalleftmargin\z@
21 | \leftskip\z@skip \rightskip\z@skip \@rightskip\z@skip
22 | \parfillskip\@flushglue
23 | \lineskip\normallineskip
24 | \lineskiplimit\normallineskiplimit
25 | \baselineskip\normalbaselineskip
26 | \sloppy}%
27 | }
28 | \NewCommandCopy{\fcapsideOrig}{\fcapside}
29 | \RenewDocumentCommand{\fcapside}{O{\FBwidth} >{\TrimSpaces}+m >{\TrimSpaces}+m}{%
30 | \redefineparboxrestore%
31 | \fcapsideOrig[#1]{#2}{#3}%
32 | }
33 | \NewCommandCopy{\ffigboxOrig}{\ffigbox}
34 | \RenewDocumentCommand{\ffigbox}{O{\FBwidth} >{\TrimSpaces}+m >{\TrimSpaces}+m}{%
35 | \redefineparboxrestore%
36 | \ffigboxOrig[#1]{#2}{#3}%
37 | }
38 | \makeatother
39 |
--------------------------------------------------------------------------------
/preamble/layout/geometry.tex:
--------------------------------------------------------------------------------
1 | %%% Page dimensions
2 | %% single-side (electronic) -> use `\documentclass[12pt,a4paper]{report}`
3 | %% two-sided (for printing) -> use `\documentclass[12pt,a4paper,twoside,openright]{report}`
4 | \usepackage{geometry} % flexible interface for adjusting page layout/dimensions
5 | \makeatletter
6 | \if@twoside%
7 | \setlength\Gm@bindingoffset{15mm} % binding offset for two-sided printing
8 | \fi%
9 | \makeatother
10 | \geometry{
11 | width=145mm,
12 | height=250mm,
13 | hmarginratio=1:1, % space ratio between left and right margins
14 | vmarginratio=3:4, % space ratio between top and bottom margins
15 | includehead, % include header in total height
16 | headheight=2.5em, % height of the header (includes space below the rule)
17 | headsep=0mm, % no extra space between header and text
18 | % showframe, % for DEBUG: helper lines for adjusting layout
19 | }
20 | \ifWIP\ifEXTRAMARGIN
21 | \geometry{
22 | paperwidth=260mm, % PDF will be wider
23 | paperheight=297mm, % A4 paper height
24 | layoutwidth=210mm, % Real A4 content area
25 | layoutheight=297mm,
26 | layoutoffset=0mm, % Align A4 layout to left edge
27 | % showcrop,
28 | }
29 | \AddToHook{shipout/background}{ % add dashed line indicating the usual paper size
30 | \begin{tikzpicture}[remember picture, overlay]
31 | \draw[dashed, black!10, line width=0.3pt]
32 | ([xshift=210mm]current page.south west) -- ([xshift=210mm]current page.north west);
33 | \end{tikzpicture}
34 | }
35 | \fi\fi
36 |
37 | %% try to make text on all pages have the same height (default for `twoside`)
38 | \flushbottom
39 |
--------------------------------------------------------------------------------
/preamble/layout/headers.tex:
--------------------------------------------------------------------------------
1 | %%% Headers and footers, page styles
2 | \usepackage{fancyhdr} % custom headers and footers
3 | % \usepackage{extramarks} % extra marks for headers and footers
4 |
5 | %% Disable `fancyhdr` warning: "\fancyhead's `E' option without twoside option is useless.
6 | %% Please consider using the `twoside' option"
7 | \makeatletter
8 | \def\f@nch@fancyhf@Echeck#1{}
9 | \makeatother
10 |
11 | \newlength{\headerpadding} % left/right padding of header
12 | \setlength{\headerpadding}{2pt}
13 | % \RenewDocumentCommand{\chaptermark}{m}{\markboth{\chaptername\ \thechapter.\ #1}{\chaptername\ \thechapter.\ #1}}
14 | % \RenewDocumentCommand{\sectionmark}{m}{\markright{\thesection.\ #1}}
15 |
16 | %% Style of the header rule and decorations
17 | \tikzset{
18 | header rule/.style={HeaderRuleColor,line width=0.9},
19 | header decor left/.style={HeaderRuleColor,line width=1.0,{Diamond[open]}-,overlay},
20 | header decor right/.style={HeaderRuleColor,line width=1.0,-{Diamond[open]},overlay},
21 | }
22 |
23 | %% Default header style (includes a rule with decorations)
24 | \fancypagestyle{header}{
25 | \renewcommand*{\headrule}{
26 | % \renewcommand*{\headrulewidth}{0.9pt}
27 | % \textcolor{HeaderRuleColor}{\rule[1em]{\headwidth}{\headrulewidth}}%
28 | \tikz[baseline=-1em]{
29 | \fill[header rule] (0, 0) rectangle (\headwidth, 0.9pt);
30 | \ifFANCY % add fancy decorations
31 | \draw[header decor right] (\headwidth,0.45pt) -- ++(7pt,0);
32 | \draw[header decor left] (-7pt,0.45pt) -- (0,0.45pt);
33 | \fi
34 | }
35 | }
36 | \fancyhead[LO]{\hspace{\headerpadding}\textcolor{HeaderColor}{\textsf{\nouppercase{\leftmark}}}}
37 | % \fancyhead[LO]{\hspace{\headerpadding}\textcolor{HeaderColor}{\textsf{\nouppercase{\rightmark}}}}
38 | \fancyhead[RE]{\textcolor{HeaderColor}{\textsf{\nouppercase{\rightmark}}}\hspace{\headerpadding}}
39 | \fancyhead[RO]{\textbf{\thepage}\hspace{\headerpadding}}
40 | \fancyhead[LE]{\hspace{\headerpadding}\textbf{\thepage}}
41 | \ifWIP % show draft watermark in footer
42 | \fancyfoot[C]{\vskip1ex\relax \ttfamily\textcolor{black!15}{Draft - \today}}
43 | \else
44 | \fancyfoot{}
45 | \fi
46 | }
47 | %% For chapter pages, the `plain` style is used
48 | \fancypagestyle{plain}[header]{
49 | %% NOTE: following does not handle properly the even-numbered pages for the two-sided printing
50 | \renewcommand*{\headrule}{
51 | \hfill\tikz[baseline=-1em]{
52 | \fill[header rule, path fading=west] (0, 0) rectangle (0.45\headwidth, 0.9pt);
53 | \ifFANCY % add fancy decorations
54 | \draw[header decor right] (0.45\headwidth,0.4pt) -- ++(7pt,0);
55 | \fi
56 | }
57 | }
58 | \fancyhead[LO,RE]{} % leave only the page number
59 | }
60 | \pagestyle{header} % set up default header style
61 |
--------------------------------------------------------------------------------
/preamble/layout/numbering.tex:
--------------------------------------------------------------------------------
1 | %% Page numbering style and counters for different parts of the document
2 | \makeatletter
3 | \NewDocumentCommand{\frontmatter}{}{ % the front matter
4 | \pagenumbering{roman} % roman page numbering
5 | \gdef\thechapter{\@Alph\c@chapter} % uppercase roman chapter numbering
6 | }
7 | \NewDocumentCommand{\mainmatter}{}{ % the main matter
8 | \cleardoublepage % start on the right page
9 | \pagenumbering{arabic} % arabic page numbering
10 | \setcounter{chapter}{0} % reset chapter counter
11 | \setcounter{section}{0} % reset section counter
12 | \gdef\thechapter{\@arabic\c@chapter} % arabic chapter numbering
13 | }
14 | \NewDocumentCommand{\backmatter}{}{ % the back matter (continue with arabic page numbering)
15 | \bookmarksetup{startatroot} % reset bookmarks level (in case parts are used)
16 | %% BUG: following line does not work as expected (adds space too late)
17 | % \addtocontents{toc}{\vspace{2ex}} % add some space after last part in TOC
18 | }
19 | \makeatother
20 |
--------------------------------------------------------------------------------
/preamble/layout/titles.tex:
--------------------------------------------------------------------------------
1 | %% Chapter without number, but included in header and TOC
2 | \NewDocumentCommand{\chapternotnumbered}{m}{
3 | \chapter*{#1}
4 | \markboth{#1}{#1} % use chapter title in header
5 | \addcontentsline{toc}{chapter}{#1} % include chapter in TOC
6 | }
7 |
8 | %%% Chapter and section formatting
9 | %% `clearempty` option removes page numbers from empty pages when using `\cleardoublepage`
10 | \usepackage[newparttoc, clearempty]{titlesec}
11 |
12 | %% NOTE: also include `\phantomsection` so that hyperlink anchors are properly placed
13 | %% (or modern `\MakeLinkTarget`) (even for non-numbered subsections)
14 | \titleformat{\section} {\MakeLinkTarget[section]{}\Large\sffamily\bfseries}{\thesection} {0.8em}{}
15 | \titleformat{\subsection}{\MakeLinkTarget[subsection]{}\large\sffamily\bfseries}{\thesubsection}{0.8em}{}
16 | \titleformat{\paragraph}[runin]{\MakeLinkTarget[paragraph]{}\normalsize\sffamily\bfseries}{\theparagraph}{0em}{}
17 |
18 | %% Part title (page) formatting
19 | \titleformat{\part}[display]
20 | {\thispagestyle{empty}\sffamily}
21 | {\LARGE Part \Romanbar{\thepart}}
22 | {0.2em}{\fontsize{30pt}{36pt}\selectfont\bfseries}
23 |
24 | %%% Chapter title formatting
25 | %% No extra space above and below chapter headings, big number/letter behind chapter title
26 | %% inspired by https://tex.stackexchange.com/a/690632
27 | \NewDocumentCommand{\chaphead}{s O{} m}{
28 | \vspace*{-25pt}% reduce vertical space before the title
29 | {\setlength{\parindent}{0pt}\raggedright
30 | \Huge\sffamily\bfseries
31 | \ifFANCY
32 | \chapterheadingletter{#2}% fancy Chapter number/letter
33 | \else
34 | \IfBooleanF{#1}{#2\hspace{0.7em}}% just a basic Chapter number/letter
35 | \fi
36 | #3\par\nobreak% Chapter title
37 | \vspace{20pt}% extra vertical space after the title
38 | }
39 | }
40 | %% -> modifying /usr/share/texmf-dist/tex/latex/base/report.cls
41 | \makeatletter
42 | \def\@makechapterhead#1{\chaphead[\thechapter]{#1}} % for numbered Chapters simply use their number
43 | \def\@makeschapterhead#1{\chaphead*[\ExtractLeadingChars{#1}]{#1}} % extract first letter of the unnumbered Chapter title
44 | \makeatother
45 |
46 | %% Chapter number/letter formatting
47 | \NewDocumentCommand{\chapterheadingletter}{m}{%
48 | \makebox[0pt][l]{% Make box of zero width, don't move other stuff horizontally
49 | \raisebox{-16pt}[0pt][0pt]{% Align the number vertically, don't move other stuff vertically
50 | \hspace{0.55em}\color{ChapterNumberColor}% Horizontal whitespace, text color
51 | \usefont{T1}{qzc}{m}{it}\fontsize{95pt}{95pt}\selectfont% Font type and size (TeX Gyre Chorus)
52 | #1 % Chapter heading letter
53 | }%
54 | }%
55 | }
56 | %% Macro to extract first `#1` characters from `#2` (see https://tex.stackexchange.com/a/402840)
57 | %% TODO: latex treesitter grammar support ExplSyntaxOn/Off, command names containting also `_:`
58 | \ExplSyntaxOn
59 | \cs_generate_variant:Nn \tl_item:nn { f } % `f` argument -> full expansion to the first unexpandable token
60 | \NewDocumentCommand{\ExtractLeadingChars}{O{1} m}{
61 | \tl_item:fn { #2 } { #1 }
62 | }
63 | \ExplSyntaxOff
64 |
--------------------------------------------------------------------------------
/preamble/layout/toc.tex:
--------------------------------------------------------------------------------
1 | %% Table of Contents
2 | % \addtocontents{toc}{\vspace{-0.9em}} % change space after "Contents" title in TOC
3 | \newcommand*{\contentsandlists}{
4 | {\hypersetup{hidelinks}
5 | \tableofcontents
6 |
7 | %% Add list of structured environments
8 | %% -> see `keytheorems` package documentation for more customization
9 | % \newcommand*{\listtheoremname}{List of Definitions, Remarks, \ldots}
10 | % \cleardoublepage\MakeLinkTarget{}
11 | % \currentpdfbookmark{\listtheoremname}{loe} % add PDF Index/Outline entry
12 | % \listofkeytheorems[onlynamed, swapnumber, title=\listtheoremname]
13 |
14 | %% Add list of figures and tables
15 | %% -> see `tocbibind` package (or maybe also `titletoc`)
16 | % \listoffigures
17 | % \listoftables
18 | }
19 | }
20 |
21 | %%% TOC formatting
22 | \usepackage{titletoc} % formatting of TOC entries
23 | \usepackage{tocbibind} % more things in table of contents
24 |
25 | \setcounter{secnumdepth}{1} % subsections are not numbered (no need for *), but are included in the TOC
26 | \setcounter{tocdepth}{2} % include subsections in toc, but not subsubsections (this is the default)
27 | \contentsmargin[0.6em]{2em} % margin for the page numbers in the TOC
28 |
29 | %% bold math for chapter titles in TOC, slightly bigger space between label and title
30 | %% BUG: pdfLaTeX with changed `\contentsmargin` does not properly align page numbers
31 | %% (works properly when using absolute \contentsmargin, or with luaLaTeX)
32 | %% HACK: to obatain consistent placement of page numbers (bold or not), we need to toggle
33 | %% off `\bfseries` with `\normalfont`, and only then apply it inside `\contentspage`
34 | \titlecontents{chapter}[1.6em]{\addvspace{2.4ex}\bfseries} %
35 | {\contentslabel{1.4em}}{\hspace*{-1.4em}} %
36 | {\hfill\normalfont\contentspage[\bfseries\thecontentspage]} % <--- HACK
37 |
38 | %% prettier visual alignment of section label with chapter title
39 | \titlecontents{section}[4.0em]{} %
40 | {\contentslabel{2.3em}}{\hspace*{-2.3em}} %
41 | {\textcolor{gray}{\titlerule*[9pt]{.}}\contentspage} %
42 |
43 | %% subsection entries in TOC are "inline" separated by a bullet
44 | \titlecontents*{subsection}[4.7em]{\footnotesize\color{Gray40}} %
45 | {}{}{ \thecontentspage} %
46 | [][\ \textbullet\ ][\hspace*{0.6em}\vspace{0.1em}] %
47 |
48 | %% part entries in TOC are centered, bigger, and without page number
49 | \titlecontents{part}[2em]{\addvspace{3ex}\filcenter} % centered part title
50 | {\small Part \thecontentslabel\\*[-0.2ex]\Large\bfseries}{\Large\bfseries}
51 | {}[\addvspace{1.0ex}] % without page number
52 |
53 |
--------------------------------------------------------------------------------
/preamble/main.tex:
--------------------------------------------------------------------------------
1 | %%% Preamble
2 |
3 | %% Data about the document, like title, author, etc.
4 | \input{preamble/data}
5 |
6 | %% DEBUG: various helper debug goodies
7 | \input{preamble/debug/commands}
8 | \input{preamble/debug/line-numbers}
9 | \input{preamble/debug/silence}
10 |
11 | %% Colors
12 | \input{preamble/general/colors}
13 |
14 | %% Typesetting, figures, tables, etc.
15 | \input{preamble/general/typesetting}
16 | \input{preamble/general/floats}
17 |
18 | %% Hyperlinks, PDF metadata
19 | \input{preamble/general/hyperref}
20 |
21 | %% Miscellaneous commands/macros
22 | \input{preamble/misc/macros}
23 | \input{preamble/misc/packages-macros}
24 | \input{preamble/misc/tikz}
25 | \input{preamble/misc/inkscape}
26 |
27 | %% Layout of the document, formatting of chapters, sections, TOC, etc.
28 | \input{preamble/layout/geometry}
29 | \input{preamble/layout/numbering}
30 | \input{preamble/layout/headers}
31 | \input{preamble/layout/titles}
32 | \input{preamble/layout/toc}
33 |
34 | %% Bibliography/References configuration
35 | \input{preamble/references/biblatex}
36 |
37 | %% Math stuff
38 | \input{preamble/math/packages}
39 | \input{preamble/math/fonts}
40 | \input{preamble/math/macros}
41 | \input{preamble/math/spacing}
42 |
43 | %% Theorem-like, Remark-like, and Todo-like environments
44 | \input{preamble/environments/init}
45 | \input{preamble/environments/theorem-like}
46 | \input{preamble/environments/remark-like}
47 | \input{preamble/environments/todo-like}
48 |
49 | %% Hacky stuff, oftentimes overriding commands of other packages
50 | \input{preamble/hacks/custom-reference-boxes}
51 | \input{preamble/hacks/fix-qed}
52 | \input{preamble/hacks/fix-hyperref}
53 | \input{preamble/hacks/floatrow-parskip}
54 |
55 | %% User macros
56 | \input{preamble/user/main}
57 |
--------------------------------------------------------------------------------
/preamble/math/fonts.tex:
--------------------------------------------------------------------------------
1 | %% TODO: think about what style is appropriate
2 | %% Set the default bold math sans font to be `sbc` (sans bold condensed)
3 | %% https://tex.stackexchange.com/questions/27843/level-of-boldness-changeable
4 | \newcommand*{\mathsfbfdefault}{sbc}
5 | \SetMathAlphabet{\mathsf}{bold}{T1}{\sfdefault}{\mathsfbfdefault}{n}
6 | % \SetMathAlphabet{\mathsf}{bold}{T1}{\sfdefault}{\bfdefault}{\sldefault}
7 |
8 | %% Math sans slanted font
9 | \DeclareMathAlphabet{\mathsfit}{T1}{\sfdefault}{\mddefault}{\sldefault}
10 | \SetMathAlphabet{\mathsfit}{bold}{T1}{\sfdefault}{\bfdefault}{\sldefault}
11 |
12 | %% When using sans font for surrounding text, also adapt the math font
13 | %% -> use Computer Modern Bright when `\mathversion{sans}` is active
14 | %% see https://tex.stackexchange.com/q/33165
15 | %% https://mirrors.nic.cz/tex-archive/fonts/cmbright/cmbright.pdf
16 | %% Requirements (font packages): `cmbright`, `hfbright`, `iwona`
17 | \DeclareMathVersion{sans}
18 | \SetSymbolFont{operators}{sans}{OT1}{cmbr}{m}{n}
19 | \SetSymbolFont{letters}{sans}{OML}{cmbrm}{m}{it}
20 | \SetSymbolFont{symbols}{sans}{OMS}{cmbrs}{m}{n}
21 | \SetSymbolFont{largesymbols}{sans}{OMX}{iwona}{m}{n}
22 | \SetMathAlphabet{\mathit}{sans}{OT1}{cmbr}{m}{sl}
23 | \SetMathAlphabet{\mathsf}{sans}{OT1}{lmss}{m}{n} % still use `lmodern` for `\mathsf`
24 | \SetMathAlphabet{\mathbf}{sans}{OT1}{cmbr}{bx}{n}
25 | \SetMathAlphabet{\mathtt}{sans}{OT1}{cmtl}{m}{n}
26 |
27 | %% TODO: bold sans math is not optimal...
28 | \DeclareMathVersion{boldsans}
29 | \SetSymbolFont{operators}{boldsans}{OT1}{cmbr}{b}{n}
30 | \SetSymbolFont{letters}{boldsans}{OML}{cmbrm}{b}{it}
31 | \SetSymbolFont{largesymbols}{boldsans}{OMX}{iwona}{bx}{n}
32 | \SetMathAlphabet{\mathit}{boldsans}{OT1}{cmbr}{b}{sl}
33 | \SetMathAlphabet{\mathsf}{boldsans}{OT1}{lmss}{\mathsfbfdefault}{n} % still use `lmodern` for `\mathsf`
34 | \SetMathAlphabet{\mathbf}{boldsans}{OT1}{cmbr}{bx}{n}
35 | \SetMathAlphabet{\mathtt}{boldsans}{OT1}{cmtl}{b}{n}
36 |
37 | %%% Automatic switching between math versions
38 | \newif\ifInSansMode % keep track of whether we are in sans mode
39 | \newif\ifInBoldMode % keep track of whether we are in bold mode
40 | \AddToHook{cmd/sffamily/after}{\InSansModetrue \ifInBoldMode\mathversion{boldsans}\else\mathversion{sans}\fi}
41 | \AddToHook{cmd/rmfamily/after}{\InSansModefalse\ifInBoldMode\mathversion{bold}\else\mathversion{normal}\fi}
42 | \AddToHook{cmd/bfseries/after}{\InBoldModetrue \ifInSansMode\mathversion{boldsans}\else\mathversion{bold}\fi}
43 | \AddToHook{cmd/mdseries/after}{\InBoldModefalse\ifInSansMode\mathversion{sans}\else\mathversion{normal}\fi}
44 |
45 |
46 | %% BUG: \mathbf{} is weird, use \bm with \mathrm
47 | \NewDocumentCommand{\bmrm}{m}{\bm{\mathrm{#1}}}
48 |
49 | %% Sans Greek Letters
50 | \DeclareSymbolFont{sfletters}{OML}{cmbrm}{m}{it}
51 | \DeclareSymbolFont{sflettersbold}{OML}{cmbrm}{b}{it}
52 | \DeclareMathSymbol{\sbGamma}{\mathalpha}{sflettersbold}{0}
53 |
54 | %% Alternative caligraphic math font `mathpazo`
55 | \DeclareMathAlphabet{\mathpzc}{OT1}{pzc}{m}{it}
56 |
57 | %% Load doublebrackets symbols (requires `stmaryrd` font package)
58 | %% (need to declare `pdfglyphtounicode` translations to satisfy PDF/A -> done in `pdfA-compliance.tex`)
59 | \DeclareSymbolFont{stmry}{U}{stmry}{m}{n}
60 | \DeclareMathDelimiter{\dblbracketleft}{\mathopen}{stmry}{"4A}{stmry}{"71}
61 | \DeclareMathDelimiter{\dblbracketright}{\mathclose}{stmry}{"4B}{stmry}{"79}
62 |
63 | %% Shorter minus sign - https://tex.stackexchange.com/a/469724
64 | \DeclareMathSymbol{\shortminus}{\mathbin}{AMSa}{"39}
65 | \newcommand*{\shortminusone}{\mspace{-1.1mu}\scalemath{1.2}[1]{\shortminus}\mspace{-1.4mu} 1}
66 |
67 |
68 | %% HACK: Reduce verbosity of "No alphabet change ..." messages
69 | %% https://tex.stackexchange.com/a/663843
70 | \makeatletter
71 | \let\old@font@info\@font@info
72 | \def\@font@info#1{%
73 | \expandafter\ifx\csname\detokenize{#1}\endcsname\relax
74 | \old@font@info{#1}%
75 | \fi
76 | \expandafter\xdef\csname\detokenize{#1}\endcsname{}%
77 | }
78 | \makeatother
79 |
--------------------------------------------------------------------------------
/preamble/math/macros.tex:
--------------------------------------------------------------------------------
1 | %%% Macros for math symbols
2 |
3 | %% Punctuation in math mode
4 | \newcommand*{\eqend}{\,.}
5 | \newcommand*{\eqcomma}{\,,}
6 |
7 | %% Equals in given dimension
8 | \NewDocumentCommand{\eqdim}{O{} m}{
9 | \IfBlankTF{#1}
10 | {\mathrel{\overset{\mathcolor{black!70}{d\.=\.#2}}{\scalebox{2.8}[1]{\(=\)}}}}
11 | {\mathrel{\overset{\mathcolor{black!70}{#2}}{\scalebox{#1}[1]{\(=\)}}}}
12 | }
13 | %% Phantom with relation spacing
14 | \NewDocumentCommand{\relphantom}{m}{\mathrel{\phantom{#1}}}
15 | %% Continuation of expression to the next line
16 | \NewDocumentCommand{\graytimes}{}{\mathcolor{gray}{\times}}
17 |
18 | % %% (Optional) Automatically use \mathcolor in math mode
19 | % \NewCommandCopy{\textcolorOrig}{\textcolor}
20 | % \RenewDocumentCommand{\textcolor}{O{} m m}{%
21 | % \ifmmode%
22 | % \let\colorcmd\mathcolor%
23 | % \else%
24 | % \let\colorcmd\textcolorOrig%
25 | % \fi%
26 | % \IfBlankTF{#1}{\colorcmd{#2}{#3}}{\colorcmd[#1]{#2}{#3}}%
27 | % }
28 |
29 | %% Determinants (use normal position of superscript/subscript)
30 | \AddToHook{cmd/det/after}{\nolimits} % functionally replaces the following 2 lines
31 | % \NewCommandCopy{\olddet}{\det}
32 | % \renewcommand*{\det}{\olddet\nolimits}
33 | \DeclareMathOperator{\Det}{Det}
34 |
35 | %% Misc math macros
36 | \NewCommandCopy{\transpose}{\intercal}
37 | \DeclareMathOperator{\vol}{vol}
38 | \DeclareMathOperator{\sgn}{sgn}
39 | \newcommand*{\Id}{\bm{1}}
40 | \newcommand*{\const}{\mathrm{const.}}
41 | \DeclareMathOperator{\Span}{Span}
42 | \DeclareMathOperator{\diag}{diag}
43 | \newcommand*{\bdry}{\partial}
44 | \newcommand*{\disjunion}{\sqcup} % TODO: spacing too small sometimes (in subscripts)
45 | \NewDocumentCommand{\inclusion}{s}{\IfBooleanTF{#1}{\hookleftarrow}{\hookrightarrow}}
46 | \NewDocumentCommand{\surjection}{s}{\IfBooleanTF{#1}{\twoheadleftarrow}{\twoheadrightarrow}}
47 | \NewDocumentCommand{\exchange}{O{\quad}}{\xleftrightarrow{#1}}
48 |
49 | %% Imaginary unit and Euler's number
50 | %% inspired by Niklas Beisert
51 | \NewDocumentCommand{\I}{}{\mathring{\imath}}
52 | \NewDocumentCommand{\E}{s}{\IfBooleanTF{#1}{\mathrm{e}}{\mathinner{\mathrm{e}}}}
53 |
54 | %% Big O notation (\biggO for centered O)
55 | \NewDocumentCommand{\bigO} {l m}{\fbraces#1{\lparen}{\rparen} {O} {#2}}
56 | \NewDocumentCommand{\biggO}{l m}{\fbraces#1{\lparen}{\rparen}{\raisemath{-0.1ex}{O}}{#2}}
57 |
58 | %%% Various fields and number sets
59 | \newcommand*{\R}{\mathbb{R}}
60 | \newcommand*{\Z}{\mathbb{Z}}
61 | \newcommand*{\C}{\mathbb{C}}
62 | \newcommand*{\F}{\mathbb{F}}
63 | \newcommand*{\N}{\mathbb{N}}
64 |
65 | %% Group/Representation Theory
66 | \DeclareMathOperator{\Hom}{Hom}
67 | \DeclareMathOperator{\Ker}{Ker}
68 | \DeclareMathOperator{\End}{End}
69 | \DeclareMathOperator{\Aut}{Aut}
70 | \DeclareMathOperator{\gl}{\mathfrak{gl}}
71 | \DeclareMathOperator{\GL}{\mathsf{GL}}
72 | \let\sl\relax % override (anyway deprecated) `sl` command
73 | \DeclareMathOperator{\sl}{\mathfrak{sl}}
74 | \DeclareMathOperator{\SL}{\mathsf{SL}}
75 | \DeclareMathOperator{\oo}{\mathfrak{o}}
76 | \DeclareMathOperator{\OO}{\mathsf{O}}
77 | \DeclareMathOperator{\so}{\mathfrak{so}}
78 | \NewDocumentCommand{\SO}{s}{\operatorname{\IfBooleanTF{#1}{\widetilde{\mathsf{SO}}}{\mathsf{SO}}}}
79 | \DeclareMathOperator{\ISO}{\mathsf{ISO}}
80 | \DeclareMathOperator{\spin}{\mathfrak{spin}}
81 | \DeclareMathOperator{\Spin}{\mathsf{Spin}}
82 | \DeclareMathOperator{\U}{\mathsf{U}}
83 | \DeclareMathOperator{\su}{\mathfrak{su}}
84 | \DeclareMathOperator{\SU}{\mathsf{SU}}
85 | \DeclareMathOperator{\Sp}{\mathsf{Sp}}
86 | \newcommand*{\g}{\mathfrak{g}}
87 | \newcommand*{\rankgroup}{\mathsf{r}}
88 |
89 | %%% Differential Geometry
90 |
91 | \DeclareMathOperator{\Sect}{Sect}
92 | \NewDocumentCommand{\Tangent}{s e{_}}{\IfBooleanTF{#1}{\bm{T}^{*}\mspace{-2mu}}{\bm{T}}\IfValueT{#2}{_{\mspace{-2mu}#2}}}
93 | \NewDocumentCommand{\TSect}{s e{^_}}{\IfBooleanTF{#1}{\mathcal{T}^{*}\mspace{-2mu}}{\mathcal{T}}\IfValueT{#2}{^{#2}}\IfValueT{#3}{_{\mspace{0mu}#3}}\mspace{-2mu}}
94 | \NewDocumentCommand{\Lie}{}{\mathcal{L}}
95 | \DeclarePairedDelimiterX{\Liebracket}[2]{\dblbracketleft}{\dblbracketright}{#1,#2}
96 | % \DeclarePairedDelimiterX{\Liebracket}[2]{\lbrack}{\rbrack}{#1,#2}
97 |
98 | \DeclareMathOperator{\Tor}{\mathsf{Tor}}
99 | \NewDocumentCommand{\Riem}{O{}}{\IfBlankTF{#1}{\bm{R}}{\tens{\bm{R}}{#1}}}
100 | \NewDocumentCommand{\Ric}{O{}}{\IfBlankTF{#1}{\bmrm{Ric}}{\tens{\bmrm{Ric}}{#1}}}
101 | \NewDocumentCommand{\Rscalar}{}{\mathcal{R}}
102 |
103 | %% Override `physics` package command `\dd` to optionally use bold `d`
104 | \RenewDocumentCommand{\dd}{s O{} m}{
105 | \mathinner{
106 | \IfBooleanTF{#1}{\bm{\mathrm{d}}}{\mathrm{d}}^{\mspace{-1mu}#2}#3
107 | }
108 | }
109 | %% Bold differential
110 | \NewCommandCopy{\dotunderaccent}{\d}
111 | \RenewDocumentCommand{\d}{O{} m}{\TextOrMath{\dotunderaccent{#2}}{\dd*[#1]{#2}}}
112 |
113 |
114 | %% Covariant derivative (with optional arguments for space tweaking)
115 | \NewDocumentCommand{\cder}{s O{a} e{_}}{
116 | \IfBooleanT{#1}{\mspace{-2mu}} % use starred variant when more \cder after each other
117 | \bm{\nabla}
118 | \IfValueT{#3}{ % when subscript index is given
119 | _{ % start subscript
120 | \mspace{-7mu} % remove extra space after nabla
121 | \chphantom{#3}{#2} % print #3 with the width of #2
122 | }
123 | }
124 | }
125 | %% Coordinate derivative
126 | \NewDocumentCommand{\del}{s}{\IfBooleanTF{#1}{\partial}{\bm{\partial}}}
127 | \NewDocumentCommand{\fdel}{O{} m}{{\frac{\del #1}{\del #2}}}
128 | \NewDocumentCommand{\Dv}{O{} m}{{\frac{\bmrm{D} #1}{\mathrm{d} #2}}}
129 | \NewDocumentCommand{\Laplacian}{}{\triangle}
130 | \NewDocumentCommand{\dAlembertian}{s}{
131 | \mathord{\raisemath{0.07ex}{
132 | \mspace{1.5mu}
133 | \IfBooleanTF{#1}{\square[0.35em][boxframe=0.05em]}{\square[][boxframe=0.06em]}
134 | \.\.
135 | }}
136 | }
137 | % \RenewDocumentCommand{\dAlembertian}{s}{\mathord{\raisemath{-0.05ex}{\oldsquare}}}
138 |
139 | %%% Tweaking of math index positioning, spacing, etc.
140 | %%% (also definitions of new arrows, etc.)
141 |
142 | %% TODO: see if \cramped{...} could be used sometimes to make
143 | %% (inline) math prettier (to avoid weird line spacing weird)
144 |
145 | %% Modify size of `\bigwedge`/`\bigodot` and the position of their superscripts
146 | \NewDocumentCommand{\Ext}{e{^}}{
147 | \scalerel*{\bigwedge}{\xmathstrut[-0.1]{0.1}} % scale down the \bigwedge a bit
148 | \IfValueT{#1}{^{\mspace{-2mu}#1}} % shift possible superscript little bit to the left
149 | }
150 | \NewDocumentCommand{\Odot}{e{^}}{
151 | \scalerel*{\bigodot}{\xmathstrut[-0.1]{0.1}} % scale down the \bigodot a bit
152 | \IfValueT{#1}{^{\mspace{-0mu}#1}} % (do not) shift possible superscript little bit to the left
153 | }
154 |
155 | %% Exchange \epsilon and \varepsilon
156 | \NewCommandCopy{\oldepsilon}{\epsilon}
157 | \renewcommand*{\epsilon}{\varepsilon}
158 | \renewcommand*{\varepsilon}{\oldepsilon}
159 |
160 | %% Math version of `\raisebox` and `\scalebox`
161 | \NewDocumentCommand{\raisemath}{m}{\mathpalette{\raisemathAux{#1}}}% \raisemath{}{...}
162 | \NewDocumentCommand{\raisemathAux}{mmm}{\raisebox{#1}{\(#2#3\)}}
163 | \NewDocumentCommand{\scalemath}{m O{}}{\mathpalette{\scalemathAux{#1}[#2]}}% \scalemath{}{...}
164 | \NewDocumentCommand{\scalemathAux}{m O{} mm}{\IfBlankTF{#2}{\scalebox{#1}{\(#3#4\)}}{\scalebox{#1}[#2]{\(#3#4\)}}}
165 |
166 | %% Modify subscript position
167 | \NewDocumentCommand{\lowerindex}{O{0pt} O{0pt} e{_^}}{
168 | \IfValueT{#3}{_{\raisemath{#1}{#3}}}
169 | \IfValueT{#4}{^{\raisemath{#2}{#4}}}
170 | }
171 |
172 | %% Modify superscript/subscript positions for some greek letters
173 | \NewCommandCopy{\oldchi}{\chi}
174 | \renewcommand*{\chi}{\oldchi\lowerindex[-1.5pt]}
175 | \NewCommandCopy{\olddelta}{\delta}
176 | \renewcommand*{\delta}{\olddelta\lowerindex[1pt][1.0pt]}
177 | \newcommand*{\bmdelta}{\bm{\olddelta}\lowerindex[1pt][1.0pt]}
178 | \newcommand*{\altdelta}{{\olddelta\xmathstrut[-0.2]{0.0}}}
179 | \newcommand*{\altbmdelta}{{\bm{\olddelta}\xmathstrut[-0.2]{0.0}}}
180 |
181 | %% Smaller \in, \notin, \subset, ...
182 | %% https://tex.stackexchange.com/questions/34393/the-mysteries-of-mathpalette
183 | \NewDocumentCommand{\smallermath}{O{0.05ex} O{0.85} m}{\raisemath{#1}{\scalemath{#2}{#3}}}
184 | \newcommand*{\smallplus} {\mathrel{\smallermath{+}}}
185 | \newcommand*{\textplus} {\ensuremath{\.\smallplus\.}}
186 | \newcommand*{\smallin} {\mathrel{\smallermath{\in}}}
187 | \newcommand*{\smallnotin} {\mathrel{\smallermath{\notin}}}
188 | \newcommand*{\smallsubset}{\mathrel{\smallermath{\subset}}}
189 | \newcommand*{\smallotimes}{\mathbin{\smallermath[0ex]{\oldotimes}}}
190 | % \newcommand*{\smallotimes}{\.\smallerrel{\oldotimes}\.}
191 |
192 |
193 | %% Fix spacing of \left( .. \middle| .. \right)
194 | \NewCommandCopy{\leftOrig}{\left}
195 | \NewCommandCopy{\rightOrig}{\right}
196 | \NewCommandCopy{\middleOrig}{\middle}
197 | \renewcommand*{\left}{\mathopen{}\mathclose\bgroup\leftOrig}
198 | \renewcommand*{\right}{\aftergroup\egroup\rightOrig}
199 | \RenewDocumentCommand{\middle}{sm}{\IfBooleanTF{#1}{\.\middleOrig#2\.}{\mathrel{}\middleOrig#2\mathrel{}}}
200 | \NewDocumentCommand{\innermiddle}{m}{\mathinner{}\middleOrig#1\mathinner{}}
201 |
202 | %% Less space around \setminus (\mathord instead of \mathinner)
203 | \DeclareMathSymbol{\setminus}{\mathord}{symbols}{"6E}
204 |
205 | %% Redefine `\square` to Young tableaux
206 | \usepackage{ytableau} % Young Tableaux
207 | \ytableausetup{centertableaux}
208 | \NewCommandCopy{\oldsquare}{\square}
209 | \NewCommandCopy{\oldotimes}{\otimes}
210 | \RenewDocumentCommand{\square}{O{0.55em} O{} O{}}{%
211 | \IfBlankTF{#1}{\ytableausetup{boxsize=0.55em}}{\ytableausetup{boxsize=#1}}%
212 | \ytableausetup{aligntableaux=top, boxframe = normal, #2}%
213 | \operatorname{\ydiagram[#3]{1}}%
214 | }
215 | \NewDocumentCommand{\smallsquare}{O{0.35em}}{\square[#1]}
216 |
217 | %% Sizeable bullet
218 | \NewDocumentCommand{\sbullet}{O{0.5}}{%
219 | \mathbin{\ThisStyle{\vcenter{\hbox{\scalebox{#1}{\(\SavedStyle\bullet\)}}}}}
220 | }
221 | \NewDocumentCommand{\fdot}{}{\mathcolor{black!80}{\sbullet[0.65]}}
222 | \NewDocumentCommand{\adot}{}{\sbullet[0.52]}
223 | \NewDocumentCommand{\idot}{s}{\mathcolor{darkgray}{\IfBooleanTF{#1}{\.\sbullet[0.4]\.}{\sbullet[0.4]}}}
224 |
225 | %% (abstract) index placeholders
226 | \NewDocumentCommand{\aind}{}{\bullet}
227 | \NewDocumentCommand{\dind}{}{\mathcolor{black!60}{\sbullet[1.2]}}
228 | \NewDocumentCommand{\ind}{}{\mathcolor{lightgray}{\bullet}}
229 |
230 | %% Argument placeholder
231 | \NewDocumentCommand{\argument}{s O{} O{1}}{%
232 | \def\squaresize{1.0}% % default size
233 | \IfBooleanT{#1}{\def\squaresize{0.7}}% % if starred, set size corresponding to scriptstyle
234 | \IfBlankF{#2}{\def\squaresize{#2}}% % if optional argument is passed, set size to custom value
235 | % TODO: utilize \mathpalette
236 | \scalebox{\squaresize}{%
237 | \begin{tikzpicture}[baseline=-#3*0.6ex]
238 | \node(char)[draw, shape=rectangle, dash=on 1.2pt off 1.05pt phase 0.5pt, dash expand off,
239 | inner ysep=2pt, inner xsep=2pt, minimum size=0.6em, rounded corners=2pt] {};
240 | %% alternative:
241 | % \node(char)[draw, shape=rectangle, dash=on 1.1pt off 0.8pt phase 0.5pt, dash expand off,
242 | % inner ysep=2pt, inner xsep=2pt, minimum size=0.6em, rounded corners=2pt] {};
243 | \end{tikzpicture}%
244 | }%
245 | }
246 |
247 | %% Curly arrows
248 | \tikzset{
249 | leadsto/.style={-{Stealth[length=0.6em,open,round]},decorate,decoration={snake,amplitude=0.20ex,segment length=0.5em,pre length=0.2em,post length=0.6em}},
250 | toleads/.style={{Stealth[length=0.6em,open,round]}-,decorate,decoration={snake,amplitude=0.20ex,segment length=0.5em,pre length=0.6em,post length=0.2em}},
251 | correspondsto/.style={{Stealth[length=0.6em,open,round]}-{Stealth[length=0.6em,open,round]},decorate,decoration={snake,amplitude=0.20ex,segment length=0.5em,pre length=0.7em,post length=0.7em}},
252 | }
253 | \NewDocumentCommand{\longleadsto}{s O{} O{}}{%
254 | \ensuremath{\mathrel{
255 | \tikz[baseline=-0.5ex, inner sep=0ex, font=\scriptsize]{
256 | \node[minimum width=2.15em, inner xsep=0.6em, align=center] (a){\hphantom{#2}\\[0ex]\hphantom{#3}};
257 | \IfBlankF{#2}{\node[inner sep=0.3ex, above=0.3ex, xshift=-0.1em] at (a){#2};}
258 | \IfBlankF{#3}{\node[inner sep=0.3ex, below=0.3ex, xshift=-0.1em] at (a){#3};}
259 | \IfBooleanTF{#1}
260 | {\draw[line width=0.6pt, toleads] (a.west) -- (a.east);}
261 | {\draw[line width=0.6pt, leadsto] (a.west) -- (a.east);}
262 | }
263 | }}%
264 | }
265 | %% https://tex.stackexchange.com/questions/170092/xleftrightarrows-command-in-tikz-with-arrows-matching-the-latex-font?rq=1
266 | \NewDocumentCommand{\correspondsto}{O{}O{}}{%
267 | \ensuremath{\mathrel{
268 | \tikz[baseline=-0.5ex, inner sep=0ex, font=\scriptsize]{
269 | \node[minimum width=3.48em, inner xsep=0.8em, align=center] (a){\hphantom{#1}\\[0ex]\hphantom{#2}};
270 | \IfBlankF{#1}{\node[inner sep=0.3ex, above=0.3ex] at (a){#1};}
271 | \IfBlankF{#2}{\node[inner sep=0.3ex, below=0.3ex] at (a){#2};}
272 | \draw[line width=0.6pt, correspondsto] (a.west) -- (a.east);
273 | }
274 | }}%
275 | }
276 |
277 | %% Quotient macro
278 | \NewDocumentCommand{\bigslant}{O{0.2}O{1.7}mm}{
279 | \left.\mspace{-1mu}\raisemath{#1em}{#3}
280 | \mspace{-#2mu} \middleOrig/ \mspace{-\fpeval{#2+1}mu}
281 | \raisemath{-#1em}{#4} \mspace{-\fpeval{5*#1}mu} \right.
282 | }
283 | % \NewDocumentCommand{\coset}{O{0.05} O{0.1} m m}{\bigslant[#1][#2]{#3}{#4}}
284 | \NewDocumentCommand{\coset}{O{}O{} m m}{#3/#4}
285 | \NewDocumentCommand{\gt}{}{\bigslant{\g}{\mathfrak{t}}}
286 | \NewDocumentCommand{\gts}{}{\bigslant[0.15]{\scriptstyle\g}{\scriptstyle\mathfrak{t}}}
287 | \NewDocumentCommand{\onehalf}{}{\mspace{-2mu}\bigslant[0.15]{\scriptscriptstyle 1 \mspace{-1.2mu}}{\scriptscriptstyle 2}}
288 |
289 | %% Cancel macro
290 | \definecolor{cancelgray}{gray}{0.85}
291 | \tikzset{
292 | main node/.style={inner sep=0,outer sep=0},
293 | label node/.style={inner sep=0.3em,font=\tiny,overlay},
294 | strike out/.style={shorten <=-.2em,shorten >=-.2em,overlay,thick,double distance = 0em,line cap=round},
295 | }
296 | \NewDocumentCommand{\cancel}{O{cancelgray}mo}{%
297 | \tikz[baseline=(N.base)]{
298 | \node[main node](N){\(#2\)};
299 | \IfValueT{#3}{\node[label node, gray, anchor=south] at (N.north){#3};}
300 | \draw[strike out, #1] (N.south west) -- (N.north east);
301 | }
302 | }
303 |
--------------------------------------------------------------------------------
/preamble/math/packages.tex:
--------------------------------------------------------------------------------
1 | %% Math/Physics packages
2 | \usepackage{amsmath} % extensions for typesetting of math
3 | \usepackage{mathtools} % advanced math typesetting
4 | \usepackage{scalerel} % scaling of math symbols (\ThisStyle, \SavedStyle, ...)
5 | % \usepackage{esint} % various fancy integral symbols
6 | % \usepackage{arydshln} % dashlines
7 |
8 | %% Math fonts & symbols
9 | \usepackage{amsfonts} % math fonts
10 | \usepackage{amssymb} % math fonts
11 | \usepackage{bm} % boldface math via `\bm`
12 |
13 | %% Some notation used in physics
14 | \usepackage{physics}
15 |
16 | % \usepackage{tensor} % tensor indices
17 | \usepackage{tensind} % tensor indices
18 | \tensordelimiter{@}
19 | \tensorformat{c}
20 | \NewDocumentCommand{\tens}{o m m}{
21 | \IfValueTF{#1}{@[#1]{#2}#3@}{@{#2}#3@}
22 | }
23 |
24 | %% Numbers/Units
25 | \usepackage{siunitx}
26 | %% TODO: customize font style propagation
27 | \sisetup{
28 | range-phrase = {--}, % en-dash as number range separator
29 | range-units = single, % print unit only once at the end
30 | exponent-product = {\cdot}, % default is `\times`
31 | per-mode = symbol, % use `/` for per
32 | uncertainty-mode = separate, % use `±` for uncertainties
33 | % table-align-uncertainty = false,
34 | % table-alignment-mode = format,
35 | % table-number-alignment = center,
36 | }
37 |
38 |
39 | \usepackage{mathfixs} % fix some odd behaviour in math mode, add math macros
40 | % \ProvideMathFix{autobold} % TeXtured contains automatic swith to bold and sans math
41 | \ProvideMathFix{greekcaps=it}
42 | \ProvideMathFix{frac,rfrac,vfrac,vfracskippre=4mu}
43 | % \ProvideMathFix{der,diff}
44 |
45 | %% Tiny space in math mode
46 | %% As of now the `mathfixs` implementation doesn't work in section titles
47 | % \ProvideMathFix{multskip=1mu} % tiny space `\.` in math mode
48 | \NewCommandCopy{\dotaccent}{\.}
49 | \renewcommand*{\.}{\TextOrMath{\dotaccent}{\mspace{1mu}}}
50 | \NewCommandCopy{\acuteaccent}{\'}
51 | \renewcommand*{\'}{\TextOrMath{\acuteaccent}{\mspace{-1mu}}}
52 |
53 | %% if `amsmath` package is loaded, slightly reduce the space after `\colon`
54 | \AddToHook{package/amsmath/after}{\AddToHook{cmd/colon/after}{\mspace{-2mu}}}%
55 |
56 | \usepackage[extdef]{delimset} % flexible typesetting and declaration delimeters sets
57 |
58 | %% TODO: fix/adapt a lot of stuff after the new release
59 | % \usepackage{eqnlines} % modern framework for typesetting single- and multi-line equations
60 |
--------------------------------------------------------------------------------
/preamble/math/spacing.tex:
--------------------------------------------------------------------------------
1 | %%% Space tweaking macros, thanks goes to https://github.com/valentjn/thesis-arxiv
2 |
3 | % math version of \settowidth, automatically choosing the right style
4 | % (textstyle, displaystyle, ...)
5 | \makeatletter
6 | \def\mathsettowidth#1#2{%
7 | \setbox\@tempboxa\hbox{\(\m@th\mathpalette{}{#2}\)}%
8 | #1=\wd\@tempboxa%
9 | \setbox\@tempboxa\box\voidb@x%
10 | }
11 | \makeatother
12 |
13 | %% \halfhphantom works like \hphantom, except that it creates a box
14 | %% that is only half as wide as that of \hphantom
15 | \newlength{\halfhphantomlength}
16 | \NewDocumentCommand{\halfhphantom}{m}{%
17 | \ifmmode\mathsettowidth{\halfhphantomlength}{#1}%
18 | \else\settowidth{\halfhphantomlength}{#1}\fi%
19 | \setlength{\halfhphantomlength}{\halfhphantomlength/2}%
20 | \hspace{\halfhphantomlength}%
21 | }
22 |
23 | %% \lhphantom{abc}{defghij} positions the text "abc" as follows:
24 | %% |abc |
25 | %% defghij
26 | \NewDocumentCommand{\lhphantom}{mm}{%
27 | \ifmmode\mathrlap{#1}\else\rlap{#1}\fi%
28 | \hphantom{#2}%
29 | }
30 |
31 | %% \chphantom{abc}{defghij} positions the text "abc" as follows:
32 | %% | abc |
33 | %% defghij
34 | \NewDocumentCommand{\chphantom}{mm}{%
35 | \halfhphantom{#2}%
36 | \ifmmode\mathclap{#1}\else\clap{#1}\fi%
37 | \halfhphantom{#2}%
38 | }
39 |
40 | %% \rhphantom{abc}{defghij} positions the text "abc" as follows:
41 | %% | abc|
42 | %% defghij
43 | \NewDocumentCommand{\rhphantom}{mm}{%
44 | \hphantom{#2}%
45 | \ifmmode\mathllap{#1}\else\llap{#1}\fi%
46 | }
47 |
--------------------------------------------------------------------------------
/preamble/misc/inkscape.tex:
--------------------------------------------------------------------------------
1 | %% Inkscape figures
2 | %% https://mirrors.nic.cz/tex-archive/info/svg-inkscape/InkscapePDFLaTeX.pdf
3 | %% this is (and a lot more) already implemented in `svg` package, but no reason to use it
4 | %% TODO: disable this for ArXiv submission (probably just leaving SVGs out will work fine)
5 | \usepackage{shellesc}
6 | \usepackage{filemod}
7 | \NewDocumentCommand{\exportInkscapeSVG}{O{./figures/Inkscape/} m}{%
8 | \filemodCmp{#1#2.pdf}{#1#2.svg}{}{% regenerate PDF+LaTeX code if SVG is newer
9 | \ClassNote{TeXtured}{(Re)generating Inkscape SVG to PDF+LaTeX figure:\MessageBreak #1#2.svg}%
10 | \ShellEscape{#1inkscape-export-to-latex "#1#2"}% use `inkscape-export-to-latex` script in the same directory
11 | }%
12 | }
13 | %% the third argument is the name of the SVG file without the extension
14 | \NewDocumentCommand{\includeInkscapeSVG}{O{0.8\linewidth} O{./figures/Inkscape/} m}{%
15 | \exportInkscapeSVG[#2]{#3}%
16 | \def\svgwidth{#1}% set the width of the figure
17 | \input{#2#3.pdf_tex}%
18 | }
19 | \DeclareCommandCopy{\includesvg}{\includeInkscapeSVG} % alias
20 |
--------------------------------------------------------------------------------
/preamble/misc/macros.tex:
--------------------------------------------------------------------------------
1 | %% Enclose with gray delimiters (by default parantheses)
2 | \NewDocumentCommand{\grayenclose}{s O{(} m O{)}}{%
3 | \ifmmode
4 | \let\colorcmd\mathcolor%
5 | \DeclareCommandCopy{\Left}{\left}%
6 | \DeclareCommandCopy{\Right}{\right}%
7 | \else%
8 | \let\colorcmd\textcolor%
9 | \DeclareCommandCopy{\Left}{\big}%
10 | \DeclareCommandCopy{\Right}{\big}%
11 | \fi% (just use one command for both cases)
12 | \IfBooleanTF{#1}{%
13 | \colorcmd{gray}{\Left#2}#3\colorcmd{gray}{\Right#4}%
14 | }{%
15 | \colorcmd{gray}{#2}#3\colorcmd{gray}{#4}%
16 | }%
17 | }
18 |
--------------------------------------------------------------------------------
/preamble/misc/packages-macros.tex:
--------------------------------------------------------------------------------
1 | %% Macros for - links to packages, and verbatim macros for LaTeX commands
2 | %% - verbatim macros for commands defined specifically by TeXtured
3 |
4 | %% will also utilize styles defined in `/preamble/hacks/custom-reference-boxes.tex`
5 | \usepackage{tcolorbox}
6 | \tcbset{
7 | packagebox/.style ={bottom=0.20ex, fontupper=\ttfamily},
8 | filebox/.style ={colframe=black!70!cyan!35, colback=black!10!cyan!3, bottom=0.20ex, fontupper=\ttfamily},
9 | dirbox/.style ={colframe=black!80!cyan!40, colback=black!60!cyan!8, bottom=0.20ex, fontupper=\ttfamily},
10 | macrobox/.style ={colframe=black!15, colback=black!3, bottom=0.20ex, fontupper=\ttfamily},
11 | custommacrobox/.style ={colframe=black!25!green!25, colback=black!5!green!5, bottom=0.20ex, fontupper=\ttfamily},
12 | }
13 |
14 | \NewTCBox{\packagebox}{!O{}}{link,hrefbox,packagebox,#1}
15 | \NewTCBox{\filebox}{!O{}}{link,filebox,#1}
16 | \NewTCBox{\dirbox}{!O{}}{link,dirbox,#1}
17 | \NewTCBox{\macrobox}{!O{}}{link,macrobox,#1}
18 | \NewTCBox{\custommacrobox}{!O{}}{link,custommacrobox,#1}
19 |
20 | \NewDocumentCommand{\package}{m}{%
21 | % \href{https://texdoc.org/pkg/#1}
22 | \hrefold{https://ctan.org/pkg/#1}{%
23 | \packagebox[right=0.1em]{#1\textsuperscript{\tiny\(\,\to\,\)\textsf{CTAN}}}%
24 | }%
25 | }
26 | \NewDocumentCommand{\fileTeXtured}{O{-\baselineskip} m}{
27 | \marginpar{
28 | \vspace{#1}
29 | \hspace{-\marginparsep}%
30 | \llap{%
31 | \filebox{#2}%
32 | }%
33 | }
34 | }
35 | \NewDocumentCommand{\dirTeXtured}{O{-1.5\baselineskip} m}{
36 | \marginpar{
37 | \vspace{#1}
38 | \hspace{-\marginparsep}%
39 | \llap{%
40 | \dirbox{#2}%
41 | }%
42 | }
43 | }
44 |
45 | \NewDocumentCommand{\macro}{O{}v}{\macrobox[#1]{#2}}
46 | \NewDocumentCommand{\fakemacro}{O{}m}{\macrobox[#1]{\fakeverb{#2}}}
47 | \NewDocumentCommand{\custommacro}{O{}v}{\custommacrobox[#1]{#2}}
48 | \NewDocumentCommand{\fakecustommacro}{O{}m}{\custommacrobox[#1]{\fakeverb{#2}}}
49 |
--------------------------------------------------------------------------------
/preamble/misc/tikz.tex:
--------------------------------------------------------------------------------
1 | %%% TikZ, and other drawing packages
2 |
3 | \usepackage{tikz}
4 | \usetikzlibrary{
5 | fadings,
6 | arrows.meta,
7 | calc,
8 | cd,
9 | decorations.pathmorphing, decorations.markings,
10 | trees,
11 | fit, matrix,
12 | }
13 |
14 | %% Directory Tree Structure
15 | \tikzset{
16 | dirtree/.style={ % http://www.texample.net/tikz/examples/filesystem-tree/
17 | draw=black!80!cyan!40, thick, rounded corners=0.2em,
18 | growth parent anchor=west,
19 | grow via three points={one child at (1.0,-0.78) and
20 | two children at (1.0,-0.78) and (1.0,-1.56)},
21 | edge from parent path={([xshift=1.2em]\tikzparentnode.south west) |- (\tikzchildnode.west)},
22 | every node/.style={text=black, anchor=west, inner sep=0.7ex, draw=black!70!cyan!35, fill=black!10!cyan!3, text depth=.25ex, execute at begin node=\vphantom{Aj}},
23 | directory/.style={draw=black!80!cyan!40, fill=black!60!cyan!8},
24 | font=\ttfamily,
25 | },
26 | }
27 |
28 | %%% Quiver macros (for https://q.uiver.app/ diagrams)
29 | %% A TikZ style for curved arrows of a fixed height, due to AndréC.
30 | \tikzset{curve/.style={settings={#1},to path={(\tikztostart)
31 | .. controls ($(\tikztostart)!\pv{pos}!(\tikztotarget)!\pv{height}!270:(\tikztotarget)$)
32 | and ($(\tikztostart)!1-\pv{pos}!(\tikztotarget)!\pv{height}!270:(\tikztotarget)$)
33 | .. (\tikztotarget)\tikztonodes}},
34 | settings/.code={\tikzset{quiver/.cd,#1}
35 | \def\pv##1{\pgfkeysvalueof{/tikz/quiver/##1}}},
36 | quiver/.cd,pos/.initial=0.35,height/.initial=0}
37 |
38 | %% TikZ arrowhead/tail styles.
39 | \tikzset{tail reversed/.code={\pgfsetarrowsstart{tikzcd to}}}
40 | \tikzset{2tail/.code={\pgfsetarrowsstart{Implies[reversed]}}}
41 | \tikzset{2tail reversed/.code={\pgfsetarrowsstart{Implies}}}
42 | %% TikZ arrow styles.
43 | \tikzset{no body/.style={/tikz/dash pattern=on 0 off 1mm}}
44 |
45 | %% Custom equal sign style - https://tex.stackexchange.com/a/443023
46 | \tikzset{
47 | double line with arrow/.style args={#1,#2}{decorate,decoration={
48 | markings,%
49 | mark=at position 0 with {
50 | \coordinate (ta-base-1) at (0,1.2pt);
51 | \coordinate (ta-base-2) at (0,-1.2pt);
52 | },
53 | mark=at position 1 with {
54 | \draw[#1] (ta-base-1) -- (0,1.2pt);
55 | \draw[#2] (ta-base-2) -- (0,-1.2pt);
56 | }
57 | }},
58 | Equal/.style args={#1}{-,double line with arrow={{-,#1},{-,#1}}},
59 | }
60 |
--------------------------------------------------------------------------------
/preamble/pdfA-compliance/LaTeX-find-glyph-name/.latexmkrc:
--------------------------------------------------------------------------------
1 | $aux_dir = ".aux";
2 |
--------------------------------------------------------------------------------
/preamble/pdfA-compliance/LaTeX-find-glyph-name/LaTeX-find-glyph-name.tex:
--------------------------------------------------------------------------------
1 | %%% Find out the name of a glyph in LaTeX
2 | %% based on https://tex.stackexchange.com/a/66302
3 |
4 | %% To obtain PDF/A compliant PDF, we need to have Unicode mapping for all
5 | %% glyphs used in the document. This can be done in LaTeX by using the
6 | %% `\pdfglyphtounicode{}{}` command.
7 |
8 | %% Using the veraPDF output, locate the problematic glyph in the PDF file,
9 | %% and insert it into the following minimal document.
10 |
11 | %% Name of the problematic glyph can be found by generating the following PDF.
12 | %% By disabling the PDF compression, we can inspect the whole PDF file as if
13 | %% it were a text file. Searching for `CharSet` in the PDF file we can find
14 | %% something like `/CharSet (/axisshort)`, which tells us that the glyph is
15 | %% named `axisshort`.
16 |
17 | %% Adequate Unicode code point can be found for example on the website
18 | %% https://codepoints.net/. Since the glyph in question is used as a short
19 | %% minus sign, we can search for `minus` and find the code point `U+2212`.
20 |
21 | %% The corresponding glyph to unicode mapping is then simply
22 | %% `\pdfglyphtounicode{axisshort}{2212}`.
23 |
24 | \pdfcompresslevel=0 % disable compression, such that we can inspect the PDF
25 | \documentclass[a6paper,12pt]{article}
26 |
27 | %% Load all the packages/fonts containing the problematic glyph
28 | \usepackage{amsmath}
29 | \usepackage{amsfonts}
30 | \DeclareMathSymbol{\shortminus}{\mathbin}{AMSa}{"39}
31 | \newcommand*{\shortminusone}{\mspace{-1.2mu}\shortminus\mspace{-1.5mu} 1}
32 |
33 | \begin{document}
34 | %% INCLUDE HERE THE PROBLEMATIC GLYPH (and ideally nothing else), for example:
35 | \(\shortminusone\) % This contains the problematic glyph
36 | \end{document}
37 |
--------------------------------------------------------------------------------
/preamble/pdfA-compliance/glyphtounicode.tex:
--------------------------------------------------------------------------------
1 | %%% PDF/A compliance - glyph to Unicode mappings
2 |
3 | %% NOTE: metadata are set up using the `hyperref` package in `preamble/general/hyperref.tex`
4 |
5 | %% WARN: `pdfx` package is SUPERSEDED by built-in LaTeX support for PDF/A
6 | %% However, in case additional fonts are used, some glyphs may not be covered
7 | %% by default Unicode mappings, in which case they need to be mapped to Unicode
8 | %% code points manually (see below for GUIDE and examples).
9 |
10 | %%% GUIDE: How to add missing unicode mappings for glyphs
11 | %%
12 | %% Consider following part of VeraPDF output for a non-compliant PDF:
13 | %%
14 | %% The Font dictionary of all fonts shall define the map of all used character codes to Unicode values,
15 | %% either via a ToUnicode entry, or other mechanisms as defined in ISO 19005-2, 6.2.11.7.2.
16 | %% Glyph
17 | %% toUnicode != null
18 | %%
19 | %% root/document[0]/pages[58](1323 0 obj PDPage)/contentStream[0](1324 0 obj PDContentStream)
20 | %% /operators[654]/usedGlyphs[0](RMTQUN+MSAM10 RMTQUN+MSAM10 57 0 0)
21 | %% The glyph can not be mapped to Unicode
22 | %%
23 | %%
24 | %%
25 | %% This means that some glyph on page 59 (indicated by a 0-based index `pages[58]`)
26 | %% is missing a Unicode mapping. To fix this, we need to find the name of the glyph,
27 | %% and provide a Unicode mapping for it. For further instructions how to proceed see
28 | %% `preamble/pdfA-compliance/LaTeX-find-glyph-name/LaTeX-find-glyph-name.tex`.
29 |
30 | \RequirePackage{iftex}
31 | \ifluatex % only for luaLaTeX (sourced by default for pdfLaTeX)
32 | \RequirePackage{luatex85}
33 | \input{glyphtounicode.tex} % probably not loaded automatically for luatex
34 | \pdfgentounicode=1 % probably disabled by default for luatex
35 | \fi
36 |
37 | %% Enable in case some glyphs are missing from imported PDF figures
38 | \pdfinclusioncopyfonts=1
39 |
40 | %% Additional Unicode mappings for mathematical symbols (provided by `pdfx`)
41 | %% https://gist.github.com/literalplus/045c4d090e2fe742157b4c903a984d24
42 | \input{glyphtounicode-cmr.tex} % <- /usr/share/texmf-dist/tex/latex/pdfx/glyphtounicode-cmr.tex
43 | % \input{glyphtounicode-ntx.tex} % <- /usr/share/texmf-dist/tex/latex/pdfx/glyphtounicode-ntx.tex
44 |
45 |
46 | %%% Additional Unicode mappings for various extra glyphs
47 |
48 | %% Glyphs: double brackets (of various sizes)
49 | %% name of glyph found in /usr/share/texmf-dist/fonts/afm/public/stmaryrd/stmary5.afm
50 | \pdfglyphtounicode{llbracket}{27E6} % https://codepoints.net/U+27E6
51 | \pdfglyphtounicode{rrbracket}{27E7} % https://codepoints.net/U+27E7
52 | \pdfglyphtounicode{largellbracket}{27E6 FE01} % variants according to size
53 | \pdfglyphtounicode{largerrbracket}{27E7 FE01} % ... ... .. ....
54 | \pdfglyphtounicode{Largellbracket}{27E6 FE02} % ... ... .. ....
55 | \pdfglyphtounicode{Largerrbracket}{27E7 FE02} % ... ... .. ....
56 | \pdfglyphtounicode{LARGEllbracket}{27E6 FE03} % ... ... .. ....
57 | \pdfglyphtounicode{LARGErrbracket}{27E7 FE03} % ... ... .. ....
58 | \pdfglyphtounicode{hugellbracket} {27E6 FE04} % ... ... .. ....
59 | \pdfglyphtounicode{hugerrbracket} {27E7 FE04} % ... ... .. ....
60 | \pdfglyphtounicode{Hugellbracket} {27E6 FE05} % ... ... .. ....
61 | \pdfglyphtounicode{Hugerrbracket} {27E7 FE05} % ... ... .. ....
62 | \pdfglyphtounicode{Hugellbrackettop}{23A5 23A1} % separate top, middle, bottom
63 | \pdfglyphtounicode{Hugellbracketex} {23A5 23A2} % ... ... .. ....
64 | \pdfglyphtounicode{Hugellbracketbot}{23A6 23A3} % ... ... .. ....
65 | \pdfglyphtounicode{Hugerrbrackettop}{23A4 23A2} % ... ... .. ....
66 | \pdfglyphtounicode{Hugerrbracketex} {23A5 23A2} % ... ... .. ....
67 | \pdfglyphtounicode{Hugerrbracketbot}{23A6 23A2} % ... ... .. ....
68 |
69 | %% Glyph: short minus
70 | \pdfglyphtounicode{axisshort}{2212} % short minus -> minus https://codepoints.net/U+2212
71 |
72 | %%% TODO: maybe use `\pdfstringdefDisableCommands` for something (in PDF metadata?)
73 |
--------------------------------------------------------------------------------
/preamble/references/backref.tex:
--------------------------------------------------------------------------------
1 | %%% Custom `backref`
2 | %% https://tex.stackexchange.com/questions/272159/biblatex-change-format-of-backreference
3 | %% https://tex.stackexchange.com/questions/76133/bibliography-backref-on-new-line-with-smaller-font-size
4 | %% https://tex.stackexchange.com/questions/91548/bump-right-aligned-text-to-next-line-iff-no-room
5 | %% -> changed from /usr/share/texmf-dist/tex/latex/biblatex/biblatex.def
6 | \renewcommand*{\finentrypunct}{}
7 | \DeclareFieldFormat{pagerefformat}{
8 | \nobreak\hfill\penalty50\hskip0.3em\null\nobreak
9 | % \hfill\mkbibparens{{\scriptsize #1}}\normalsize
10 | \hfill\scriptsize{#1}\normalsize%
11 | \parfillskip=0pt \finalhyphendemerits=0 \par
12 | }
13 | \renewbibmacro*{pageref}{%
14 | \iflistundef{pageref}
15 | {}
16 | {\printtext[pagerefformat]{% use custom format
17 | \printlist[pageref][-\value{listtotal}]{pageref}}}}%
18 |
19 | %% NOTE: the `hyperlink` command in `pageref` formatting is tweaked
20 | %% in `preamble/custom-reference-boxes.tex`
21 |
--------------------------------------------------------------------------------
/preamble/references/biblatex-extra-fields.dbx:
--------------------------------------------------------------------------------
1 | %% Support `github` field
2 | \DeclareDatamodelFields[type=field,datatype=verbatim]{github}
3 | \DeclareDatamodelEntryfields{github}
4 | %% Support `gitlab` field
5 | \DeclareDatamodelFields[type=field,datatype=verbatim]{gitlab}
6 | \DeclareDatamodelEntryfields{gitlab}
7 |
--------------------------------------------------------------------------------
/preamble/references/biblatex.tex:
--------------------------------------------------------------------------------
1 | %%% References/Bibliography
2 | \usepackage[
3 | style=ext-numeric-verb, sorting=none,
4 | date=year, articlein=false, isbn=false,
5 | maxnames=16, maxcitenames=4,
6 | backref=true, backrefstyle=none,
7 | datamodel=preamble/references/biblatex-extra-fields,
8 | ]{biblatex}
9 |
10 | %% Custom bibliography fields can be added in `preamble/references/biblatex-extra-fields.dbx`
11 | %% see for example explanation in https://suchicodes.com/resources/blog/65a59395
12 |
13 | %% Add bibliography resource
14 | \addbibresource{preamble/bibliography.bib}
15 |
16 | \newcommand*{\references}{
17 | \defbibheading{bibintoclabel}[\bibname]{%
18 | \chapter*{##1}%
19 | \label{ch:References}%
20 | \addcontentsline{toc}{chapter}{##1}%
21 | \markboth{##1}{##1}%
22 | }
23 | \defbibnote{note}{%
24 | % \vspace{-3em}
25 | \begin{flushright}
26 | \footnotesize
27 | % Asterisk in [\textcolor{black!35}{Author(s) Year}*] and (\textcolor{black!35}{Year}*) marks a secondary source/review article. \\
28 | % Asterisk in \texttt{[\({\mspace{1mu}\color{black!30}\bullet}\)*]} marks a secondary source/review article. \\
29 | Back-references to the pages where the publication was cited are given by \pagebox{\(\color{black!60}\bullet\)}.
30 | \end{flushright}
31 | \vspace{0.4em}
32 | }
33 | % \emergencystretch=1em % prevent some of the overfull hboxes
34 | % \hyphenpenalty 100 % try to prevent (some) hyphenation
35 | % \printbibliography[heading=bibintoc, title=References]
36 | \printbibliography[heading=bibintoclabel, title=References, prenote=note]
37 | }
38 |
39 |
40 | %%% Custom categories
41 | %% `todo` category for references to be added (marked with red)
42 | \DeclareBibliographyCategory{todo}
43 | \addtocategory{todo}{TODO}
44 |
45 | %% `secondary` category for secondary sources (will be marked with `*`)
46 | \DeclareBibliographyCategory{secondary}
47 | %% add secondary citations to this category
48 | \addtocategory{secondary}{secondary_review}
49 |
50 |
51 | %% Modification of fields
52 | \input{preamble/references/fields}
53 |
54 | %% Modification of `cite` command -> wrap whole citation with a `tcolorbox` frame
55 | \input{preamble/references/cite}
56 |
57 | %% Style tweaks
58 | \input{preamble/references/style}
59 |
60 | %% Customize DOI/arXiv/GitHub/URL formatting
61 | \input{preamble/references/doi-eprint-url}
62 |
63 | %% Custom backreferences
64 | \input{preamble/references/backref}
65 |
--------------------------------------------------------------------------------
/preamble/references/cite.tex:
--------------------------------------------------------------------------------
1 | %%% Wrap whole citation with braces in a `\citebox` frame, the whole being clickable link
2 |
3 | % \DeclareOuterCiteDelims{cite}{\bibopenbracket}{\bibclosebracket}
4 | \DeclareOuterCiteDelims{cite}{}{} % disable default outer delimiters
5 |
6 | %% modifying /usr/share/texmf-dist/tex/latex/biblatex/cbx/numeric-verb.cbx
7 | %% loaded subsequently in /usr/share/texmf-dist/tex/latex/biblatex-ext/ext-numeric-verb.cbx
8 | \renewbibmacro*{cite}{%
9 | \printtext[bibhyperref]{%
10 | \citebox{% <---- wrap the whole citation with a `tcolorbox` frame
11 | %% turn postnote into custom prenote
12 | \iffieldundef{postnote}{}{{\normalfont\hspace{0.18em}\printfield{postnote}\hspace{0.15em}}}%
13 | \lbrack% <---- always consistently use brackets
14 | \printfield{labelprefix}%
15 | \printfield{labelnumber}%
16 | \ifbool{bbx:subentry}{\printfield{entrysetcount}}{}%
17 | \rbrack% <---- always consistently use brackets
18 | }%
19 | }%
20 | }
21 |
22 | %% do not put commas between multiple citations when using `\cite{something,something}`
23 | \renewcommand*{\multicitedelim}{\space}
24 | % \renewcommand*{\multicitedelim}{\addsemicolon\space}
25 |
26 | %% disable default postnote
27 | \renewbibmacro*{postnote}{%
28 | % \iffieldundef{postnote}
29 | % {}
30 | % {\setunit{\printdelim{postnotedelim}}%
31 | % \printfield{postnote}}
32 | }
33 |
34 | %%% Alternative style of multicitations
35 | % \renewcommand*{\multicitedelim}{\addcomma} % no space between multiple citations, just a comma
36 | %
37 | % %% wrap the citation commands in a `\citebox`
38 | % \NewCommandCopy{\autociteOrig}{\autocite}
39 | % \NewCommandCopy{\citeOrig} {\cite}
40 | % \RenewDocumentCommand{\autocite}{O{} O{} m}{\citebox{\autociteOrig[#1][#2]{#3}}}
41 | % \RenewDocumentCommand{\cite} {O{} O{} m}{\citebox{\citeOrig[#1][#2]{#3}}}
42 |
--------------------------------------------------------------------------------
/preamble/references/doi-eprint-url.tex:
--------------------------------------------------------------------------------
1 | %% add format for `github`/`gitlab` field
2 | \DeclareFieldFormat*{github}{%
3 | \bibstring{github}\addcolon\space%
4 | \ifhyperref{\href{https://github.com/#1}{\nolinkurl{#1}}}{\nolinkurl{#1}}%
5 | }
6 | \DeclareFieldFormat*{gitlab}{%
7 | \bibstring{gitlab}\addcolon\space%
8 | \ifhyperref{\href{https://gitlab.com/#1}{\nolinkurl{#1}}}{\nolinkurl{#1}}%
9 | }
10 |
11 | %% put DOI/arXiv/GitHub/URL on a new line
12 | %% support also `github` field
13 | %% -> changed from /usr/share/texmf-dist/tex/latex/biblatex-ext/ext-standard.bbx
14 | \renewbibmacro*{doi+eprint+url}{%
15 | \setlength{\parskip}{0pt} % fix spacing of \fullcite in the body text of the document
16 | \printtext{\par} % doi+eprint+url are printed on a new line
17 | \footnotesize % make it small, so it (ideally) fits on one line
18 | \raggedright % right-align the text (so that there are no overfull hboxes for long URLs)
19 | \renewcommand{\newunitpunct}{\space} % no periods on this line
20 | \renewcommand{\newblockpunct}{\penalty-9\relax\space} % avoid line breaks after labels "DOI:", "arXiv:", ...
21 | \ifboolexpr{togl {bbx:doi} and not test {\iffieldxref{doi}}}{\printfield{doi}}{}%
22 | \newunit\newblock
23 | \ifboolexpr{togl {bbx:eprint} and not test {\iffieldxref{eprint}}}{\usebibmacro{eprint}}{}%
24 | \newunit\newblock
25 | \ifboolexpr{not test {\iffieldxref{github}}}{\printfield{github}}{}% <--- added print of `github` field
26 | \newunit\newblock
27 | \ifboolexpr{not test {\iffieldxref{gitlab}}}{\printfield{gitlab}}{}% <--- added print of `gitlab` field
28 | \newunit\newblock
29 | \ifboolexpr{togl {bbx:url} and not test {\iffieldxref{url}}}{\usebibmacro{url+urldate}}{}
30 | }
31 |
32 | %% print arXiv via \bibstring{arxiv}
33 | %% -> changed from /usr/share/texmf-dist/tex/latex/biblatex/biblatex.def
34 | \DeclareFieldFormat*{eprint:arxiv}{%
35 | \bibstring{arxiv}\addcolon\space % <--- added \bibstring{arxiv}
36 | \ifhyperref
37 | {\href{https://arxiv.org/abs/#1}{%
38 | \nolinkurl{#1}%
39 | \iffieldundef{eprintclass}
40 | {}
41 | {\addspace\texttt{\mkbibbrackets{\thefield{eprintclass}}}}}}
42 | {\nolinkurl{#1}%
43 | \iffieldundef{eprintclass}
44 | {}
45 | {\addspace\texttt{\mkbibbrackets{\thefield{eprintclass}}}}}}
46 |
--------------------------------------------------------------------------------
/preamble/references/fields.tex:
--------------------------------------------------------------------------------
1 | %%% Modification of fields in References/Bibliography
2 |
3 | %% if DOI is present, remove URL
4 | %% ignore certain fields completely
5 | %% set year to current year if title is TODO
6 | \DeclareSourcemap{
7 | \maps[datatype=bibtex]{
8 | \map[overwrite]{
9 | \step[fieldsource=doi, final] % if DOI is not present, terminate
10 | \step[fieldset=url, null] % (if DOI is present) remove URL
11 | % \step[fieldset=eprint, null]
12 | }
13 | \map{
14 | \step[fieldset=pages, null]
15 | \step[fieldset=number, null]
16 | \step[fieldset=volume, null]
17 | \step[fieldset=series, null]
18 | \step[fieldset=location, null]
19 | \step[fieldset=address, null]
20 | }
21 | \map{
22 | \step[fieldsource=title, match={TODO}, final] % match TODO in title
23 | \step[fieldset=year, fieldvalue={\the\year}] % set year to current year
24 | }
25 | }
26 | }
27 |
28 | %% Custom localisation strings
29 | \DeclareCapitalPunctuation{} % disable automatic capitalization of localisation strings
30 | \NewBibliographyString{arxiv, github, gitlab} % define new localisation strings
31 | \DefineBibliographyStrings{english}{
32 | url = {{}\textsc{url}}, % included `{}` to avoid automatic capitalization, see
33 | arxiv = {{}\textsc{arXiv}}, % https://tex.stackexchange.com/a/472547 for more details
34 | github = {\textsc{GitHub}},
35 | gitlab = {\textsc{GitLab}},
36 | in = {\footnotesize\textsc{In}},
37 | % in = {},
38 | editor = {editor},
39 | editors = {editors},
40 | }
41 |
42 | %% smaller space after "in:"
43 | \renewcommand*{\intitlepunct}{{\footnotesize\addcolon\,}}
44 | % \renewcommand*{\intitlepunct}{\addcolon\space}
45 |
46 | %% TODO: PhD or Ph.D.?
47 |
--------------------------------------------------------------------------------
/preamble/references/style.tex:
--------------------------------------------------------------------------------
1 | %%% References style tweaks
2 |
3 | %% separation modifications
4 | \setlength\bibitemsep{0.53\baselineskip}
5 | \setlength\biblabelsep{1.5\labelsep}
6 |
7 | %% label number always in brackets with monospaced font
8 | %% -> modifying /usr/share/texmf-dist/tex/latex/biblatex/bbx/numeric.bbx
9 | \DeclareFieldFormat{labelnumberwidth}{\ttfamily\mkbibbrackets{#1}}
10 | % \DeclareFieldFormat{labelnumberwidth}{\citebox{\mkbibbrackets{#1}}}
11 |
12 | %% red color for `todo` category
13 | %% asterisk in labelnumber for secondary sources (in `secondary` category)
14 | \DeclareFieldFormat{labelnumber}{%
15 | \ifcategory{todo}{\color{red}\(\sbullet[1.2]\)}{#1}%
16 | \ifcategory{secondary}{*}{}%
17 | }
18 |
19 | %% names in "small caps"
20 | % \DeclareNameWrapperFormat*{author}{\textsc{#1}}
21 |
22 | %% type "editor(s)" in parentheses
23 | \DeclareFieldFormat{editortype}{\mkbibparens{#1}}
24 | \DeclareDelimFormat{editortypedelim}{\addspace}
25 |
26 | %% titles in sans (with red for `todo` category)
27 | \DeclareFieldFormat*{title}{\sffamily\ifcategory{todo}{\textcolor{red}{#1}}{#1}}
28 |
29 | %% punctuation between title and subtitle
30 | \renewcommand*{\subtitlepunct}{\space{\normalfont\textbullet}\space}
31 |
32 | %% emphasize publishers (same as journals in IEEE style)
33 | % \DeclareListFormat{publisher}{\mkbibemph{#1}}
34 |
35 | %% emphasize journals and publishers, in dark gray color
36 | % \DeclareListFormat{publisher}{\mkbibemph{\textcolor{darkgray}{#1}}}
37 | % \DeclareFieldFormat{journaltitle}{\mkbibemph{\textcolor{darkgray}{#1}}}
38 | % \DeclareFieldFormat{booktitle}{\mkbibemph{\textcolor{darkgray}{#1}}}
39 |
40 | %% date in bold (without parentheses)
41 | \DeclareFieldFormat{issuedate}{#1}
42 | \renewcommand*{\volnumdatedelim}{\addcomma\space}
43 | \DeclareFieldFormat*{date}{\mkbibbold{#1}}
44 | % \DeclareFieldFormat*{date}{\ifcategory{secondary}{\mkbibbold{#1}*}{\mkbibbold{#1}}}
45 | % \DeclareFieldFormat{biblabeldate}{\mkbibparens{\mkbibbold{#1}}}
46 |
--------------------------------------------------------------------------------
/preamble/toggles.tex:
--------------------------------------------------------------------------------
1 | %% Define some toggle flags
2 |
3 | \newif\ifFANCY %% whether to enable some more fancy stylistic choices
4 | \newif\ifWIP %% whether to enable debug commands, todos, etc.
5 | \newif\ifEXTRAMARGIN %% whether WIP mode has extra right margin
6 | \newif\ifCENSOR %% whether to censor denoted passages
7 |
8 | \FANCYtrue %% by default, enable fancy features
9 |
--------------------------------------------------------------------------------
/preamble/user/macros.tex:
--------------------------------------------------------------------------------
1 | %% User macros
2 |
3 | %% TeXtured logo
4 | \newcommand*{\TeXtured}{\texorpdfstring{\textsf{\TeX{}tured}}{TeXtured}}
5 |
6 | \usepackage{hologo} % Provides *TeX logos (for example `\hologo{pdfLaTeX}`)
7 |
--------------------------------------------------------------------------------
/preamble/user/main.tex:
--------------------------------------------------------------------------------
1 | %%% User Preamble
2 |
3 | \input{preamble/user/macros}
4 | \input{preamble/user/math}
5 |
--------------------------------------------------------------------------------
/preamble/user/math.tex:
--------------------------------------------------------------------------------
1 | %% User math macros
2 | \newcommand*{\Sphere}{\ensuremath{\mathbb{S}}}
3 | \newcommand*{\Hyperboloid}{\ensuremath{\mathbb{H}}}
4 | \newcommand*{\CP}{\ensuremath{\mathbb{CP}}}
5 | \newcommand*{\AdS}{\ensuremath{\mathsf{AdS}}}
6 | \newcommand*{\spacedim}{\mathsfit{d}}
7 |
--------------------------------------------------------------------------------
/thesis.tex:
--------------------------------------------------------------------------------
1 | \newcommand*{\TeXturedVERSION}{1.3.0} %% TeXtured 2025-05-25
2 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3 | %% NOTE: If you find any issues or have any suggestions, please open %%
4 | %% an Issue on GitHub: https://github.com/jdujava/TeXtured %%
5 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6 |
7 | %% Enable built-in LaTeX support for PDF/A compliance (must be before `\documentclass`)
8 | \DocumentMetadata{lang=en, pdfversion=1.7, pdfstandard=A-2u}
9 | \input{preamble/pdfA-compliance/glyphtounicode}
10 |
11 | %% NOTE: Choose the desirable page layout version (electronic vs print)
12 | \documentclass[12pt,a4paper]{report} % single-side (electronic)
13 | % \documentclass[12pt,a4paper,openright,twoside]{report} % two-sided (for printing)
14 |
15 | %% Set some toggle flags to control some of the document properties
16 | \input{preamble/toggles}
17 | % \FANCYfalse % disable some of the more fancy stylistic choices
18 | %% NOTE: Comment out the following lines for the final version
19 | \WIPtrue % THIS IS A WORK-IN-PROGRESS VERSION
20 | % \EXTRAMARGINtrue % add extra right margin in WIP version (for notes/corrections)
21 | \CENSORtrue % THIS IS A CENSORED VERSION
22 |
23 | %% Preamble - data, packages, macros, and more
24 | \input{preamble/main}
25 |
26 | %% Only uncommented files are included (faster compilation)
27 | %% NOTE: If no files are uncommented, all files are included
28 | \includeonlysmart{
29 | % frontmatter/title,
30 | % frontmatter/declaration,
31 | % frontmatter/dedication,
32 | % frontmatter/information,
33 | % chapters/Introduction,
34 | % chapters/QuickSummary,
35 | % chapters/Notation,
36 | % chapters/Design,
37 | % chapters/Usage,
38 | % chapters/Features,
39 | % chapters/Tips,
40 | % chapters/Summary,
41 | % chapters/Appendix,
42 | }
43 |
44 | \begin{document}
45 |
46 | \frontmatter
47 | \include{frontmatter/title}
48 | % \include{frontmatter/declaration}
49 | % \include{frontmatter/dedication}
50 | % \include{frontmatter/information}
51 |
52 | \contentsandlists
53 |
54 | \include{chapters/Introduction}
55 | \include{chapters/QuickSummary}
56 | \include{chapters/Notation}
57 |
58 | \mainmatter
59 | \include{chapters/Design}
60 | \include{chapters/Usage}
61 | \include{chapters/Features}
62 | \include{chapters/Tips}
63 |
64 | \backmatter
65 | \include{chapters/Summary}
66 |
67 | \appendix
68 | \include{chapters/Appendix}
69 |
70 | \references
71 |
72 | \end{document}
73 |
--------------------------------------------------------------------------------