I'm looking for ways to add variables (or LaTeX macros) to the YAML header or soon after such that they can be used in external `.tex` files that are a part of my (modularised) report.

**My `.rmd` file**

```
---
output:
  pdf_document:
    latex_engine: xelatex
    includes:
      before_body: some.tex
params:
  cat: "Felix"
  numb: 14
---

# chapter
Oh my \textbf{`r params$cat`}. 
$x = `r 2*params$numb`^2$

<!-- Trying again to get the parameter -->
\input{some.tex}

```

**My `some.tex` file:**

```
`r params\$cat`

```

**Output**

[![enter image description here](https://i.stack.imgur.com/j72Y3.png)](https://i.stack.imgur.com/j72Y3.png)

**Hoped-for output**

I want to be able to somehow pass the variables from the YAML header (or even just below it) to be used by LaTeX so that all important and regularly updated parameters can be viewed and changed in one place.