Math mode in SVG

\(\require{cancel}\) \(\require{boldsymbol}\)

This is a quick tip on rendering math mode in SVG. You need to create a chunk like the following.

```{r,svgexample, fig.cap="SVG output with some math expressions.", fig.ext="svg", engine.opts=list(dvisvgm.opts = "--font-format=woff"), engine="tikz"}
\usetikzlibrary{positioning}
\begin{tikzpicture}[every node/.append style={draw, minimum size=0.5cm}]
\node [draw=none] (X) at (0,0) {$X_{\alpha}$};
\node [draw=none] (Y) at (2,0) {$Y_{\beta}$};
\node [draw=none] (Z) at (1,1) {$Z_{\beta}$};
\path [-latex] (X) edge (Y);
\draw [-latex] (Z) edge (Y);
\draw [-latex] (Z) edge (X);
\end{tikzpicture}
SVG output with some math expressions.

Figure 1: SVG output with some math expressions.

```
Figure 2 shows how the chunk should look like.
A screenshot of the chunk to avoid any confusion.

Figure 2: A screenshot of the chunk to avoid any confusion.

And that’s it!