The general Idea
The idea is to convert a .md
note into a PDF using a LaTeX template. The variables for formatting and metadata are defined in the YAML frontmatter of the Markdown file (referred to as âPropertiesâ in Obsidian) and passed to the LaTeX template to generate the final PDF document. After downloading the templates, you need to customize both.
For Example:
If you look in the .latex template, every Instance of $name$
will display what you put into the yaml-frontmatter. E.g.: name : "Mary"
will display Mary on every instance of $name$
in the .latex template. The same goes for all variables. I know this seems like a long ass page, but the actual changes you have to make are not that many.
Obsidian Properties / Frontmatter-Template
Use the template and donât copy it frome here, unless some lines that will specifically marked.
- One of the downloaded files is the YAML frontmatter.
- you can add / delete variables - do the edits in the
.latex
accordingly. This means at best if you decide to not use$date$
that you also comment-out the corresponding lines in the.latex
(by putting a % in front.)
This is the frontmatter-template.md you get from the download:
---
title: Title
subtitle: Subtitle, if needed
shorttitle: paper xyz
name: same
surname: surname
semester: semester xyz
seminar: title seminars
professor: Prof. Dr. XYZ
address: Behind-the-Moon-Str. 20, Germany
email: XYZ@googlemail.com
matrikel: "0190" = registration number
studiengang: Field of Study
modul: XY
pruefungsnr: XY
abgabedatum: 10000 b.c.
toc: "true" = table of contents
university: University XY
institute: Institut XY
---
\pagebreak
# Bibliographie
\pagebreak
you can change the
\pagebreak with \newpage
Now you can just save this as a .md template and insert it when needed. I suggest you change the variables that wonât change in your template directly so you minimize future efforts.
LaTeX - Template
Now the interesting part. So basically you could use every LaTeX template, but you would need some heavy editing as well. So the Templates you can use with the least effort are the ones from Eisvogel and mine which we will customize in the following part.
The Template consists of:
- Title page
- Table of contents, if you with (by setting the property true/false)
- Body (includes the Bibliography)
- Legal notices
Everything with %-Sign are Comments, and the changes you have to make are marked with % Change so you could technically also search for that and edit quickly if you know latex.
I will discuss the setup of the template in order of the Template, so you can follow along with your file and set everything up - what you need to change is marked in the heading.:
Resource-Paths (Change this)
line 69-73
Same Path as your folder for pictures, and you can add more if you want, just follow the shown syntax:
% Resource Paths % Change 1: Resource Path/s
\graphicspath{
{I:/Vault/Path/To/Pictures}
%{I:/Vault2/Path/To/Pictures2}
}
You can have multiple folders, and-or set up the template for multiple vaults.
Language (Change this)
line 82
- you obv. set this to your language ;)
\setmainlanguage{german}
Geometry (Document margins - optional)
line 85
My institute wants a right side margin of 6cm ⊠But i set all to 3cm default, and you can change to your needs!
\geometry{top=3cm, bottom=3cm, left=3cm, right=3cm}
Line-spacing (optional )
line 92
- Spacing between lines ⊠is not calculated like word, just up or down it on your taste.
\setstretch{1.56}
Titlepage:
Position of the uni-Logo / optional change to normal text (optional)
line 178
\begin{textblock*}{6cm}(13cm,2cm) % Width: 6cm, Position (x=13cm, y=2cm)
\includegraphics[width=6cm]{uni.png}
\end{textblock*}
if you donât want to use a logo and rather type the information of your University in the frontmatter and have the infos as Text on the title page, replace the above with:
\begin{textblock}{6}(7.8,1.3) % Width 6cm, x=7.8cm, y=1.25cm
\raggedleft
\textbf{$university$}\\
{$institute$}
\end{textblock}
Title and Subtitle (optional)
line 190-196
% Title and subtitle centered
\begin{textblock*}{10cm}(5cm,11cm)
\begin{center}
\textbf{\Huge $title$}\\[0.5cm]
\textbf{\Large $subtitle$}\\
\end{center}
\end{textblock*}% Title and subtitle centered
\begin{textblock*}{10cm}(5cm,11cm)
\begin{center}
\textbf{\Huge $title$}\\[0.5cm]
\textbf{\Large $subtitle$}\\
\end{center}
\end{textblock*}
Change \Huge and \Large to change size of the headings, for detailed explanation, see the âReference Guideâ on Overleaf
Author Info (change)
line 202â213
% Author info bottom left
\begin{flushleft}
\textbf{$name$ $surname$}\\
$address$\\
$email$\\
Student ID: $matrikel$\\
Degree Program: $studiengang$\\
Module: $modul$\\
Exam No.: $pruefungsnr$\\
Submission date: $abgabedatum$\\
\end{flushleft}
\end{titlepage}
The Commented out
(in the actual .latex) you can comment back in or change, here as well as in the frontmatter!
Legal Notice (change)
line 256-307
Now the legal notice is also automated. This means the Title will be generated in, as well as your name, date, and whatever else you have defined in the frontmatter. This will also include your Signature; find your signature or make one and name it sig.png
- put it in the resource folder you have defined earlier.
If you donât want a signature displayed, delete the two instances of this code starting line 273 as well as in line 305:
\begin{textblock*}{3cm}(8cm,24.5cm)
\includegraphics[width=5cm]{sig.png}
\end{textblock*}
Now you can delete this section as a whole or change the Text to match the requirements of your institute. You need to change it because itâs a translated German legal notice as an example and not viable for your use!
Remember that if you delete the bottom part of the .latex template, the document still has to end with:
\end{document}
Legal Notice:
\newpage % Declaration of independence and other declarations
\section*{Statutory Declaration}
\addcontentsline{toc}{section}{Statutory Declaration}
I hereby declare on oath that I have completed the present paper
with the title \newline \newline
\textbf{$title$,} \newline $subtitle$ \newline \newline
independently and without unauthorized assistance. I have
used no sources or aids other than those specified. For the case
that the work is additionally submitted on a data carrier, I declare
that the written and electronic forms are completely identical. The
work has not been submitted to any other examination authority in
the same or similar form. \newline\newline
Stuttgart, $date$ \newline
$name$ $surname$
\begin{textblock*}{3cm}(10cm,15cm) % Width: 6cm, Position (x=10cm, y=23cm) % Signature 1
\includegraphics[width=5cm]{sig.png}
\end{textblock*}
\clearpage
\renewcommand{\thepage}{B} % Replaces the page number with "B"
\newpage Second Legal Notice
% Legal Notice (Instruction)
\section*{Instruction}
\addcontentsline{toc}{section}{Instruction}
\textbf{Withdrawal of examination entitlement}
\begin{enumerate}
\item Falsifying others' work or other attempts at deception may lead to the withdrawal of examination entitlement.
\item In serious cases, the right to a repeat examination may also be forfeited.
\end{enumerate}
\section*{§ 156 Criminal Code: False Statutory Declaration}
Whoever falsely makes a statutory declaration before an authority competent to receive such declarations or falsely testifies while referring to such a declaration shall be punished with imprisonment of up to three years or a fine.
\section*{§ 161 Criminal Code: Negligent False Statutory Declaration}
\begin{enumerate}
\item If one of the acts designated in §§ 124 to 156 has been committed by negligence, imprisonment of up to one year or a fine shall be imposed.
\item The offender shall be exempt from punishment if he or she corrects the false statement in time. The provisions of § 155 paragraphs 2 and 3 apply accordingly.
\end{enumerate}
\textbf{I have taken note of the above instruction.}
Stuttgart, $date$ \newline
$name$ $surname$
\begin{textblock*}{3cm}(8cm,24.5cm) % Width: 6cm, Position (x=10cm, y=24.5cm) % Signature 2
\includegraphics[width=5cm]{sig.png}
\end{textblock*}
\end{document}
Continue with: 5) Table of Contents - TOC