How can I configure my R Markdown document to use the textmacros
MathJax extension for HTML rendering (knitting)? I was unsuccessful in trying to apply the instructions provided at https://docs.mathjax.org/en/latest/input/tex/extensions/textmacros.html in a include: in_header:
file specified in my YAML header.
I'm using RStudio 2022.12.0 Build 353 (version available in my workplace).
Context
My goal is to get similar rendering with LaTeX text commands (e.g., \text{}
or \texttt{}
) whether I Knit to PDF or Knit to HTML with MathJax. E.g., while $\texttt{my\_var}$
renders to my_var
in PDF, it renders to my\_var
in HTML with MathJax by default. Using the textmacros
extension would (supposedly) render it to my_var
.
Note: HTML rendering with webtex
works fine in this case, but I'd like to have the option to use mathjax
as well.
Thanks for your help.