This is my personal LaTeX setup, which I store here to have easy access for various writing tasks.
It includes a style sheet for packages, fonts, etc. and a config-file for variables and custom title pages etc. that fit my whims, as well as the requirements of my department.
I mainly write musicological essays, therefore I have devised a way to include short music examples with the wonderful lyluatex
-package.
Since most of my research focuses on the early modern period and since I like my typography to match my subject, I am using the lovely humanist open source font EB Garamond, based on Claude Garamond’s 16th century cuts.
So far, I have not needed another font, if I come into the situation, I might outsource the font stuff in its own dedicated setup file.
The defaults of this setup are set for German meta information (i.e. the stuff on the cover page and the plagiarism statement) and a language for the body text, typically German or English, that can be specified in the config.tex
file.
At the moment it is advisable to assign every variable in config.tex
a value, as I somehow still cannot make if-statements work properly in TeX and missing elements might lead to unexpected behaviour…
The custom-style.sty
file contains commonly loaded packages, a font configuration for EB Garamond, the hyperref-setup, etc.
The config.tex
file contains all the variables for handing in an academic term paper, as well as setups for custom titlepage, anti-plagiarism declaration, works cited etc. From within config.tex
, the mylilypond
command and everything in the mylilypond.sty
-file can be enabled under the ‘Lilypond support’ header.
main.tex
is just some boilerplate TeX, calling all the other files and expecting content in a folder named content
The command \mylilypond
calls for the lyluatex
package, which requires an installation of Lilypond in order to work. If Lilypond is not installed in the expected location, the path can be specified as follows: \usepackage[program=/path/to/executable]{lyluatex}
(line 6 in mylilypond.sty
).
The setup assumes that a koma document class is used, such as scrartcl
. Since lyluatex
depends on LuaTeX, that recommends itself for compiling. Even without Lilypond support, either Lualatex or XeTeX should be used.
Custom fonts should be saved in a subfolder called fonts and invoked as follows: \setmainfont[Path=fonts/]{fontname.otf}
\setmonofont[Path=fonts/,Scale=MatchLowercase]{fontname.otf}
The 'scale' option can match the lower/upper case font, or accept a factor, i.e. 0.8
Graphics should be saved in a subfolder called images.
The commands and environments (re-)defined so far are:
-
\mymaketitle
– creates title, author and course info info on the first page -
\maketitlepage
– creates a dedicated titlepage -
\workscited
– creates a works cited list on a new page -
\tableofcontentspage
– creates a table of contents on a new page -
\plagiat
– creates a plagiarism statement -
\mylilypond[#1 #2]
(#1 is the file(path) and #2 is the caption) – embeds musical examples with lilypond files -
block quotes are handled as follows:
\begin{aquote}{\autocite[Pages]{citation.key}} A block quote goes in here, the attribution is placed intelligently either in the last line or the following, flushright. \end{aquote}
-
figures are inserted as follows:
\begin{figure} \centering \includegraphics[width=\textwidth]{nameofgraphic.png} \caption{My Caption} \label{figure n} \end{figure}
-
\autocite
is assumed as the default for citations and is used as follows:\autocite[Text before the citation, such as qtd. in][the pagerange]{citation.key}
All packages are loaded via custom-style.sty
, unless they require user input, such as babel, in which case they are loaded via config.tex
– lyluatex being the obvious exemption.
- fontspec
- tgcursor
- ebgaramond
- nth
- microtype
- setspace
- geometry
- changepage
- graphicx (graphics should be saved in an images/-subfolder)
- hyperref
- cleveref
- caption
- babel
- csquotes
- biblatex
- lyluatex
make sure they exist on Debian-based Distros with the following command: sudo apt install fontspec tgcursor ebgaramond nth microtype setspace geometry changepage graphicx hyperref cleveref babel csquotes texlive-biblatex-extra
A project could have the following structure:
. % your root directory
|
+-- config.tex
+-- custom-style.sty
+-- mylilypond.sty
|
+-- fonts % your fonts
| +-- mymainfont.otf
| +-- mymonospacedfont.otf
+-- images % your images
| +-- image1.png
| +-- image2.png
+-- music % your music examples
| +-- musicexample1.ly
| +-- musicexample2.ly
+-- content % your actual text
| +-- introduction.tex
| +-- mainpart.tex
| +-- conclusion.tex
|
+-- sources.bib % your bibliography
+-- main.tex % master document
The main.tex
file could then look like this:
\documentclass[a4paper]{scrarticle} % your document class
\include{config}
\usepackage{custom-style}
\begin{document}
\maketitlepage % if you want a full titlepage
\tableofcontents % if you want a TOC
\input{content/introduction} % your body text
\input{content/mainpart}
\input{content/conclusion}
\workscited % if you want a bibliography
\plagiat % if you want a plagiarism statement
\end{document}
The .gitignore
files for both TeX and Lilypond auxiliary files are copied from Github's .gitignore repository
The aquote
environment follows this StackExchange answer