1

I tried to change the size of the title of a Quarto PDF document (scrartcl class) without success.

This is what I tried. Per the KOMA-script documentation section 3.6 (page 58), and as mentioned here, the commands for modifying the appearance of several elements are \setkomafont, \addtokomafont, and \usekomafont. However, section 3.7 (page 68) states:

Note that for the main title, \huge will be used after the font switching element title. So you cannot change the size of the main title using \setkomafont or \addtokomafont.

Based on the scrartcl class code, I created a patch in the preamble to change the title size (from \huge to \small to see the effect easily):

\usepackage{xpatch}
\makeatletter
  \xpatchcmd{\maketitle}{\usekomafont{title}{\huge \@title \par}}{\usekomafont{title}{\small \@title \par}}
\makeatother

Here is the problem: the patch did not work with a Quarto PDF document when added through the include-in-header option. However, this approach worked perfectly on a basic .tex file compiled through RStudio.

Something is happening inside Quarto's processing that is preventing to get the wanted effect and I have not figured it out yet. I would appreciate any help in getting the change I need either by using this approach or a better one.

Thanks,

Hector

MWE's

Quarto file

---
title: "The Title"
author: "Author"
pdf-engine: xelatex
format:
  pdf: 
    keep-tex: true
    documentclass: scrartcl
    include-in-header:
      text: |
        \usepackage{xpatch}
        \makeatletter
        \xpatchcmd{\maketitle}{\usekomafont{title}{\@title \par}}{\usekomafont{title}{\small \@title \par}}
        \makeatother
        
        \setkomafont{author}{\small}
---

## Quarto

Quarto enables you to weave together content and executable code into a finished document. To learn more about Quarto see <https://quarto.org>.

Output: Quarto output pdf screenshot

LaTeX file

\documentclass[titlepage]{scrartcl}

\usepackage{xpatch}
\makeatletter
  \xpatchcmd{\maketitle}{\usekomafont{title}{\huge \@title \par}}{\usekomafont{title}{\small \@title \par}}
\makeatother

\setkomafont{author}{\small}

\title{The Title}
\authorss{Author}

\begin{document}

\maketitle

\end{document}

Output: LaTeX output pdf screenshot

Software used

  • OS: macOS (Ventura 13.5.1)
  • R v4.3.1
  • RStudio v13.5.1 (via Homebrew)
  • Quarto v1.3.450 (via Homebrew)
  • TinyTeX package v0.46
  • Document Class: scrartcl 2023/07/07 v3.41 KOMA-Script document class (article)
shafee
  • 15,566
  • 3
  • 19
  • 47
hspitia
  • 13
  • 2

1 Answers1

1

Just add the latex command for different font size before the title text.

---
title: \small The Title
author: "Author"
pdf-engine: xelatex
format:
  pdf: 
    keep-tex: true
    documentclass: scrartcl
    include-in-header:
      text: |
        \setkomafont{author}{\small}
---

## Quarto

Quarto enables you to weave together content and executable code

smaller title text in quarto pdf output

shafee
  • 15,566
  • 3
  • 19
  • 47
  • Thanks for your quick answer! Although it works nicely, and I will use it in the meantime, I would like a less visible solution since this is a template that will be used by other people who do not have a LaTeX background (I'll wait a little before accepting your answer). Thanks again. – hspitia Aug 24 '23 at 13:51
  • By "less visible solution" do you mean that you do not want to put latex command directly in the title? In that case, I guess you can configure a lua filter that will create an option in yaml, suppose `title-size: small`, and then add the `\small` automatically just before the title when rendering the document. – shafee Aug 24 '23 at 15:03
  • Thanks again, @shafee. I'll try your suggestion. – hspitia Aug 28 '23 at 16:39