1 Tips and Trick to write your Thesis in Quarto
Below are some tips and tricks that I needed to use alongside the regular Quarto settings, which were unfortunately not enough to fully format my thesis just like how I wanted. I had to scour the internet and stackoverflow alongside some latex documentation, and I hope this will help someone one day. Or else it serves as a nice little documentation for future usage.
3 Cross-references
3.1 Automatically bold cross-reference (Figure, Table #)
Instead of using (**Figure \ref{figure:stuff}**)
, use \cref{figure:stuff}
which will automatically put “Figure” or “Table” or something else as appropriate.
To add automatic bold, add to the preambule :
header-includes:
- \usepackage[capitalise,noabbrev, nameinlink]{cleveref} # Allows \cref{} to cite latex table as "Table 3"
# Specify which cross-reference should automatically be bolded : Tables and Figures
# Use \cref{} ; For some reason this only works with this exact disposition :
# Only #1, nameinlink and each of the reference specified. namelink + #1#2#3 would give an error.
- \crefdefaultlabelformat{#2\textbf{#1}#3} # <-- Only #1 in \textbf
- \crefname{table}{\textbf{Table}}{\textbf{Tables}}
- \Crefname{table}{\textbf{Table}}{\textbf{Tables}}
- \crefname{figure}{\textbf{Figure}}{\textbf{Figures}}
- \Crefname{figure}{\textbf{Figure}}{\textbf{Figures}}
The parameter nameinlink
could be removed, but it allows the link to span both the number and the cross-referenced material (Table + #) and not just the number, which I find more practical.
3.2 Add your table of content to the pdf bookmark
The generated pdf document has a convenient bookmark function for ease of navigation. The bookmark automatically includes pandoc headers, except your table of content.
Add the bookmark package to include headers, and then use the following command:
header-includes:
- \usepackage{setspace} # Example of another package used. This syntax will not work with only one package.
- \usepackage{bookmark}
% Add the command just before the toc.
\pdfbookmark[section]{\contentsname}{toc}
% Next command is to rename the table of content
\renewcommand{\contentsname}{Table des matières}
\tableofcontents{}
\newpage
3.3 Cross-Reference showing the section number instead of figure
Well that’s simple:
Move
\label{fig: hasse}
after\caption{Hasse diagram}
since\caption
has to come before\label
. This applies to figures and tables in general. I would not use spaces in label names. Also note Gonzalos comment regarding\centering
.
Instead of the center environment you could use the command right after \begin{figure}[htbp]; the environment adds extra vertical space which (in most cases) is undesired – Gonzalo Medina
3.4 How to set subfigure to uppercase
Use \renewcommand{\thesubfigure}{\Alph{subfigure}}
in your preamble.
3.5 Continuous figure numbering
If you want something like Figure 1, Figure 2 instead of Figure 1.1, Figure 1.2, you need to use the following latex command :
\counterwithout{figure}{chapter}
- \counterwithout{figure}{section} -
This is working for me, using scrreport as the document class (KOMA class).
3.5.1 Explanation :
Changing the numbering of (e.g.) figures involves two modifications:
Redefining whether or not the figure counter will be reset whenever the chapter/section counter is incremented;
Redefining the “appearance” of the figure counter (), i.e., removing (or adding) the chapter/section prefix.
\counterwithout{somecounter}{anothercounter}
\counterwithout{somecounter}{anothercounter}
removes the link between somecounter
and anothercounter
so that they are independent. For any pair of counters, you can switch between using \counterwithout
and \counterwithin
, as the following example shows for the example
and section
counters—you can open this example in Overleaf using the link provided below the code.
4 Lists of figures and tables
4.1 Remove a section from your table of contents in pandoc
You need to combine .unlisted with .unnumbered to achieve this, as stated in Pandoc documentation.
(I have looked inside the Pandoc documentation however and I have no idea where that is stated).
Also, I discovered it was literally marked in the Quarto documentation itself !
# Abstract {.unnumbered .unlisted}
# Acknowledgements {.unnumbered .unlisted}
# Chapter 1
4.2 Suppress a biblatex field in the bibliography
Can be used only in the preamble:
If you compile your bibliography with biber, simply add:
header-includes:
# Define a command to remove the "note" field from the bibliography
- \AtEveryBibitem{\clearfield{note}}
4.3 Delete the biber cache
If for some unknown reason, you’re trying to generate your bibliography and Quarto hits you with
generating bibliography
Couldn't load any math lib(s), not even fallback to Calc.pm at C:\Users\Minh-Anh\AppData\Local\Temp\par-4d696e682d416e68\cache-5e43119d746c745befc6eda076997d4ff7d8b07a\19c9b262.pm line 25.
etc.
Go to the specified file path and delete the folders. What a headache.
Also, biber --cache
shows you where it is (and if it’s bugged, you’ll be greeted with this awesome bug error).
5 Bibliography
5.1 Include an organization name in citeproc
Just include double brackets around your {{organization}} and citeproc will format correctly.
@article{IOM.2011.org,
year = {2011},
title = {{Dietary Reference Intakes for Calcium and Vitamin D}},
author = {{Institute of Medicine}},
journal = {The National Academies Press},
doi = {10.17226/13050},
pages = {1115},
keywords = {}, }