Hi,
If you define some YAML parameters, such as:
---
output: pdf_document
title: "This is my title"
---
The title text gets passed to the $title$ variable in the TeX template.
So if I am writing additional TeX to include when rendering my document, there are a couple options. You can write TeX that should be in the header (in_header), before the body (before_body), or after the body (after_body).
I am wondering if the YAML parameters are also passed to the additional TeX files. Currently, it doesn't seem that they do. For example, I have a preamble.tex file containing the following code:
% add a header
\usepackage{fancyhdr}
\pagestyle{fancy}
\fancyhf{}
\rhead{$title$}
And my R Markdown looks like:
---
title: "My amazing title"
output:
pdf_document:
includes:
in_header: preamble.tex
---
The rendered PDF has a header line, but the right-aligned text is literally title, not the actual title defined in the YAML meta-data.