Pandoc fails to render valid LaTeX macro definitions from markdown (and R markdown)
问题 In R, I have character objects that contain LaTeX macro definitions. The challenge is to use these objects in R Markdown documents, so that the macro definitions are rendered correctly when the .Rmd files are converted to LaTeX (and then to PDF). It is a challenge because Pandoc (v2.9.1 and 2.9.2) fails to render some macro-generating code correctly, even when that code is valid LaTeX. Here is a minimal example. First, consider this Rmd file: --- title: "Rendering LaTeX Macros from R Objects"