I am creating a short report with quarto in rstudio, rendering it to pdf. I use the quarto titlepages extension to create a title page with a logo and a background image. I can get everything to work except for the size of the title font.
I've been searching in the web for hours, and trying all approaches I could think off, but the font size of the title never changes...can someone give me a hint on what I am doing wrong?
This is my YAML:
---
title: "Effect of treatment on the species 1"
author: "Author 1 and Author 2"
date: ' `r paste("Date:",Sys.Date())`'
lang: gl
format:
titlepage-pdf:
documentclass: scrbook
titlepage: plain
titlepage-geometry:
- top=70mm
- bottom=30mm
- right=30mm
- left=30mm
titlepage-logo: "images/circularNegro.png"
titlepage-bg-image: "images/OsTres.png"
titlepage-theme:
elements: ["\\titleblock", "\\logoblock", "\\authorblock", "(biólogos colexiados)" ]
page-fontfamily: "Helvetica Neue"
page-align: center
title-fontsize: 30
title-align: center
title-space-after: 3cm
author-fontsize: 16
author-style: plain
logo-align: center
logo-size: 4cm
logo-space-after: 1cm
bg-image-location: "ULCorner"
bg-image-size: 21cm
pdf:
# Fonts
mainfont: Helvetica Neue
fontsize: 12pt
papersize: A4
margin-top: 25mm
margin-bottom: 25mm
margin-left: 25mm
margin-right: 25mm
toc: true
toc-depth: 2
toc-title: Táboa de contidos
editor: visual
---
I tried with title-fontsize: 30 and with title-style: "large" but none of them would change the font size. I also tried changing the document class from article, to scrartcl and scrbook. I did also simplify all the YAML and even remove completely the format: pdf: section of it, but title font size did never change. I finally tried to define title font size with CSS (which I do not know) by including the following chunk after the YAML (based on this question Change title size and color in Quarto (html output)):
```{css, echo=FALSE}
.title {
font-size: 24px;
font-family: "Helvetica Neue";
}
```
When I do that I get the following error:
Unable to locate an installed version of Python 3.
To my understanding, title-fontsize
option is not having any effect on the title font size. Because if we run the following,
---
title: "Effect of treatment on the species 1"
author: "Author 1 and Author 2"
date: last-modified
lang: gl
format:
titlepage-pdf:
documentclass: scrbook
titlepage: plain
titlepage-geometry:
- top=70mm
- bottom=30mm
- right=30mm
- left=30mm
titlepage-theme:
elements: ["\\titleblock", "\\logoblock", "\\authorblock", "(biólogos colexiados)" ]
page-align: center
title-fontsize: 50
title-align: center
title-space-after: 3cm
author-fontsize: 16
author-style: plain
keep-tex: true
---
And then checking the underlying intermediate tex file, we can see,
\newcommand{\titleandsubtitle}{
% Title and subtitle
{\fontsize{50}{60.0}\selectfont
{\Large{\nohyphens{Effect of treatment on the species 1}}}\par
}%
}
\newcommand{\titlepagetitleblock}{
\titleandsubtitle
}
Therefore, title font size is actually \Large
and our specified font size 50
is having no effect at all.
Therefore, one approach to this issue, could be using title-fontstyle
which takes tiny
, small
, large
, Large
, LARGE
, huge
, Huge` as font sizes.
---
title: "Effect of treatment on the species 1"
author: "Author 1 and Author 2"
date: last-modified
lang: gl
format:
titlepage-pdf:
documentclass: scrbook
titlepage: plain
titlepage-geometry:
- top=70mm
- bottom=30mm
- right=30mm
- left=30mm
titlepage-theme:
elements: ["\\titleblock", "\\logoblock", "\\authorblock", "(biólogos colexiados)" ]
page-align: center
title-fontstyle: Huge
title-align: center
title-space-after: 3cm
author-fontsize: 16
author-style: plain
---
Now the aforementioned Huge
, LARGE
, Large
etc. font sizes are LaTeX predefined font sizes. If you want to use custom font sizes other than those, you can define a new fontsize command and then pass it to title-fontstyle
option.
So we define a new font size command gigantic
with a font size 70 and use this in title-fontstyle: gigantic
.
---
title: "Effect of treatment on the species 1"
author: "Author 1 and Author 2"
date: last-modified
lang: gl
format:
titlepage-pdf:
documentclass: scrbook
include-in-header:
text: |
\newcommand{\gigantic}{\fontsize{70}{73}\selectfont}
titlepage: plain
titlepage-geometry:
- top=70mm
- bottom=30mm
- right=30mm
- left=30mm
titlepage-theme:
elements: ["\\titleblock", "\\logoblock", "\\authorblock", "(biólogos colexiados)" ]
page-align: center
title-fontstyle: gigantic
title-align: center
title-space-after: 3cm
author-fontsize: 16
author-style: plain
---
And lastly some remarks about your attempt of using CSS,
You can not use CSS to modify anything that will be rendered as pdf. You have to use either latex commands or pandoc options.
And you are facing that error, because you are using css chunk which quarto finds as the very first code chunk in the qmd file while rendering the document and as a consequence, Quarto will try to render this document using jupyter
which requires python installation. To avoid this problem, one need to use engine: knitr
. But again, you do not need a css chunk while rendering to pdf format at the first place.