In a package, I have several vignettes that use mathematical notation, like:
This vignette illustrates the ideas behind solving systems of linear equations of the form $\mathbf{A x = b}$
where
- $\mathbf{A}$ is an $m \times n$ matrix of coefficients for $m$ equations in $n$ unknowns
- $\mathbf{x}$ is an $n \times 1$ vector unknowns, $x_1, x_2, \dots x_n$
- $\mathbf{b}$ is an $m \times 1$ vector of constants, the "right-hand sides" of the equations
When I compile the vignette using R Studio (Ctrl+Shift+K), it renders properly in the HTML file, whether viewed in the R Studio viewer or the browser.
Yet, when the package is submitted to CRAN, and the vignettes are built there from the source package, the math is not rendered properly, but appears as markup,
Is there something I need to add to my YAML header so that vignettes built outside of R Studio will render mathematics properly? Currently, I use just a standard header:
---
title: "Solving Linear Equations"
author: "Me"
date: "`r Sys.Date()`"
output: rmarkdown::html_vignette
vignette: >
%\VignetteIndexEntry{Solving Linear Equations}
%\VignetteEngine{knitr::rmarkdown}
%\VignetteEncoding{UTF-8}
---
The generated pandoc
command from R Studio is
"C:/Program Files/RStudio/bin/pandoc/pandoc" +RTS -K512m -RTS linear-equations.utf8.md --to html --from markdown+autolink_bare_uris+ascii_identifiers+tex_math_single_backslash --output pandoc8141d044063.html --smart --email-obfuscation none --self-contained --standalone --section-divs --template "C:\R\R-3.2.5\library\rmarkdown\rmd\h\default.html" --css "C:\R\R-3.2.5\library\rmarkdown\rmarkdown\templates\html_vignette\resources\vignette.css" --mathjax --variable "mathjax-url:https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" --highlight-style pygments
Perhaps I need to add a YAML option corresponding to --self-contained
or --standalone
?