Rmarkdown: how to get yaml scalar untransformed in latex template

For a discussion of a similar problem see this earlier post.

I wrestled with this problem four years ago, and you can find my results here.

It is possible to pass YAML variables to pandoc to be filtered by an external program before begin passed back to pandoc for further processing. This was necessary because while pandoc’s API exposes a serialization of the abstract syntax tree (AST) that it uses to internally represent the source document or transformation into the target document and allows free access to anything in the yaml fore matter for use in a document template, the functionality to directly access the yaml fields for anything else is suppressed.

At least that was the case then.

You can add a style sheet to be read in with the other YAML fore matter and park the variables there.