How can I change the font size of the toc only when rendering an rmarkdown document as pdf?
I am only aware of the fontsize: parameter in the YAML, but it changes the font size of the whole pdf document. Is there any other parameter specific for the toc? Perhaps via .css file?
Thanks!
Using CSS will not affect the pdf output, CSS only affects those output formats that generate an HTML file as an output. You need to search for LaTeX commands or packages to make changes in pdf output.
And the package
tocloftpackage provides means of controlling the typographic design of the Table of Contents. From thetocloftdocumentation - section 2.3 Typesetting entries,tocloftprovides\cftXfontwhereXdenotes.partfor\parttitleschapfor\chaptertitlessecfor\sectiontitlessubsecfor\subsectiontitlessubsubsecfor\subsubsectiontitlesAnd you can use
\cftXfontto change the font size of table of contents texts.