I am using Quarto inside RStudio to create a book project. The output will be a pdf/LaTeX file. Quarto originally puts the Table of Content just after the title page. But I need to put the abstract, preface and acknowledgements first before the Table of Contents. How can I change this sequence? Is it possible to change this sequence using _quarto.yml
file or do I need to change it through LaTeX?
You can do this using template-partials
To do that you need to create a before-body.tex
file as a partial latex template and put all the necessary latex code that will go before the table of contents, list of figures, list of tables, and rest of the document.
before-body.tex
$if(has-frontmatter)$
\frontmatter
$endif$
$if(title)$
\maketitle
$endif$
\newpage
%----------------------------------------------
% Abstract
%----------------------------------------------
\begin{center}
\Large{Abstract}
\end{center}
\vspace*{\baselineskip}
This is the Abstract part
\newpage
%----------------------------------------------
% Preface
%----------------------------------------------
\begin{center}
\Large{Preface}
\end{center}
\vspace*{\baselineskip}
This is the Preface part
\newpage
%----------------------------------------------
% Acknowledgement
%----------------------------------------------
\begin{center}
\Large{Acknowledgement}
\end{center}
\vspace*{\baselineskip}
This is the acknowledgement part
\newpage
Then to add this template, use the template-partials
option in _quarto.yml
_quarto.yaml
project:
type: book
book:
title: "Quarto book"
author: "Shafee"
date: "7/31/2022"
chapters:
- index.qmd
- intro.qmd
format:
pdf:
toc: true
documentclass: scrreprt
template-partials:
- before-body.tex
Also, create the partial file named exactly as before-body.tex
, since per the documentation,
Note that the name of the partial files is important. You choose which portion of the template to replace by providing a partial with that name.