Rpubs - Recognize proper LaTeX delimeters

Rpubs recognizes $/$$ as LaTeX delimiters, but not\( /) and \[ \], even though those are best practice, as per https://tex.stackexchange.com/questions/503/why-is-preferable-to. Is this something that can be addressed?

Thanks.

Hi @Avraham! Welcome!

Are you thinking about R Markdown files (which can be hosted in rendered form on RPubs)? The dollar signs in R Markdown aren’t actually directly LaTeX — they are a Pandoc extension to Markdown that allows equations to be identified (Pandoc is what’s doing the conversion from Markdown to other formats under the hood for most — but not all! — R Markdown output formats).

How the equations are output when rendered into another format (e.g., HTML, PDF via LaTeX, etc) depends on the output format (which makes sense, because you need different tools to put math into HTML than into a PDF). You can read about it here:
https://pandoc.org/MANUAL.html#math

If that doesn’t answer your question, then can you maybe provide an example of a specific case you’re thinking of where math wasn’t rendered as you expected?

Hi.

That's weird. I created a document which renders properly on this computer. Same for the presentation that I didn't see render properly before. Did anything change on the RPubs backend in the past few days?

Maybe the fault is on my end, as this is a different computer. Perhaps my firewall at home is blocking MathJax while my computer at work isn't? But that should affect $/$$ and \( \), \[ \] equally. Now I'm confused.

Thank you for the quick response!

Hmm, can you post the R Markdown source of that test document? Here’s how to format it so it doesn’t get garbled here:

FAQ: How to Format R Markdown Source

---
title: "LaTeX Delimiter Comparison"
author: "Avraham Adler"
date: "9/17/2019"
output: html_document
---

```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```

# Using $\LaTeX$ delimiters
 
The eigenvectors for the matrix comprise the eigenspace of the matrix when the 
zero vector is also included (Text, Definition EM, p. 377). This is equivalent 
to the null space of the matrix at the heart of the characteristic polynomial 
(Textbook, Theorem EMNS, p. 378), or \(\mathcal{E}_A(\lambda)=\mathcal{N}(A - \lambda I)\).

First let \(\lambda = 1\):
\[
\begin{aligned}
A - I_3 &=
\begin{bmatrix}
0 & 2 & 3\\
0 & 3 & 5\\
0 & 0 & 5
\end{bmatrix} \Rightarrow
\begin{bmatrix}
0 & 2 & 0\\
0 & 3 & 0\\
0 & 0 & 5
\end{bmatrix} \Rightarrow
\begin{bmatrix}
0 & 0 & 0\\
0 & 3 & 0\\
0 & 0 & 5
\end{bmatrix} \Rightarrow
\begin{bmatrix}
0 & 0 & 0\\
0 & \fbox{1} & 0\\
0 & 0 & \fbox{1}
\end{bmatrix}\\
\mathcal{E}_A(1)&=\mathcal{N}(A - I_3) =
\left\langle \left\{
\begin{bmatrix}
1\\
0\\
0
\end{bmatrix}\right\}\right\rangle
\end{aligned}
\]
Note that this is already a unit vector.

Next let \(\lambda = 4\):
\[
\begin{aligned}
A - 4I_3 &=
\begin{bmatrix}
-3 & 2 & 3\\
0 & 0 & 5\\
0 & 0 & 2
\end{bmatrix} \Rightarrow
\begin{bmatrix}
-3 & 2 & 3\\
0 & 0 & 1\\
0 & 0 & 0
\end{bmatrix} \Rightarrow
\begin{bmatrix}
-3 & 2 & 0\\
0 & 0 & 1\\
0 & 0 & 0
\end{bmatrix} \Rightarrow
\begin{bmatrix}
\fbox{1} & -\frac{2}{3} & 0\\
0 & 0 & \fbox{1}\\
0 & 0 & 0
\end{bmatrix}\\
\mathcal{E}_A(4)&=\mathcal{N}(A - 4I_3) =
\left\langle \left\{
\begin{bmatrix}
\frac{2}{3}\\
1\\
0
\end{bmatrix}\right\}\right\rangle
\end{aligned}
\]
The norm of this vector is \(\sqrt{\frac{13}{9}} = \frac{\sqrt{13}}{3}\) so the
corresponding unit vector would be:
\[
\left\langle \left\{
\begin{bmatrix}
\frac{2}{\sqrt{13}}\\
\frac{3}{\sqrt{13}}\\
0
\end{bmatrix}\right\}\right\rangle
\]

Lastly let \(\lambda = 6\):
\[
\begin{aligned}
A - 6I_3 &=
\begin{bmatrix}
-5 & 2 & 3\\
0 & -2 & 5\\
0 & 0 & 0
\end{bmatrix} \Rightarrow
\begin{bmatrix}
-5 & 0 & 8\\
0 & -2 & 5\\
0 & 0 & 0
\end{bmatrix} \Rightarrow
\begin{bmatrix}
\fbox{1} & 0 & -1.6\\
0 & \fbox{1} & -2.5\\
0 & 0 & 0
\end{bmatrix}\\
\mathcal{E}_A(6)&=\mathcal{N}(A - 6I_3) =
\left\langle \left\{
\begin{bmatrix}
1.6\\
2.5\\
1
\end{bmatrix}\right\}\right\rangle
\end{aligned}
\]

The norm of this vector is \(\frac{\sqrt{981}}{10}\) so the corresponding unit 
vector would be:
\[
\left\langle \left\{
\begin{bmatrix}
\frac{16}{\sqrt{981}}\\
\frac{25}{\sqrt{981}}\\
\frac{10}{\sqrt{981}}
\end{bmatrix}\right\}\right\rangle
\]

# Using Primitive $\TeX$ delimiters

The eigenvectors for the matrix comprise the eigenspace of the matrix when the 
zero vector is also included (Text, Definition EM, p. 377). This is equivalent 
to the null space of the matrix at the heart of the characteristic polynomial 
(Textbook, Theorem EMNS, p. 378), or $\mathcal{E}_A(\lambda)=\mathcal{N}(A - \lambda I)$.

First let $\lambda = 1$:
$$
\begin{aligned}
A - I_3 &=
\begin{bmatrix}
0 & 2 & 3\\
0 & 3 & 5\\
0 & 0 & 5
\end{bmatrix} \Rightarrow
\begin{bmatrix}
0 & 2 & 0\\
0 & 3 & 0\\
0 & 0 & 5
\end{bmatrix} \Rightarrow
\begin{bmatrix}
0 & 0 & 0\\
0 & 3 & 0\\
0 & 0 & 5
\end{bmatrix} \Rightarrow
\begin{bmatrix}
0 & 0 & 0\\
0 & \fbox{1} & 0\\
0 & 0 & \fbox{1}
\end{bmatrix}\\
\mathcal{E}_A(1)&=\mathcal{N}(A - I_3) =
\left\langle \left\{
\begin{bmatrix}
1\\
0\\
0
\end{bmatrix}\right\}\right\rangle
\end{aligned}
$$
Note that this is already a unit vector.

Next let $\lambda = 4$:
$$
\begin{aligned}
A - 4I_3 &=
\begin{bmatrix}
-3 & 2 & 3\\
0 & 0 & 5\\
0 & 0 & 2
\end{bmatrix} \Rightarrow
\begin{bmatrix}
-3 & 2 & 3\\
0 & 0 & 1\\
0 & 0 & 0
\end{bmatrix} \Rightarrow
\begin{bmatrix}
-3 & 2 & 0\\
0 & 0 & 1\\
0 & 0 & 0
\end{bmatrix} \Rightarrow
\begin{bmatrix}
\fbox{1} & -\frac{2}{3} & 0\\
0 & 0 & \fbox{1}\\
0 & 0 & 0
\end{bmatrix}\\
\mathcal{E}_A(4)&=\mathcal{N}(A - 4I_3) =
\left\langle \left\{
\begin{bmatrix}
\frac{2}{3}\\
1\\
0
\end{bmatrix}\right\}\right\rangle
\end{aligned}
$$
The norm of this vector is $\sqrt{\frac{13}{9}} = \frac{\sqrt{13}}{3}$ so the
corresponding unit vector would be:
$$
\left\langle \left\{
\begin{bmatrix}
\frac{2}{\sqrt{13}}\\
\frac{3}{\sqrt{13}}\\
0
\end{bmatrix}\right\}\right\rangle
$$

Lastly let $\lambda = 6$:
$$
\begin{aligned}
A - 6I_3 &=
\begin{bmatrix}
-5 & 2 & 3\\
0 & -2 & 5\\
0 & 0 & 0
\end{bmatrix} \Rightarrow
\begin{bmatrix}
-5 & 0 & 8\\
0 & -2 & 5\\
0 & 0 & 0
\end{bmatrix} \Rightarrow
\begin{bmatrix}
\fbox{1} & 0 & -1.6\\
0 & \fbox{1} & -2.5\\
0 & 0 & 0
\end{bmatrix}\\
\mathcal{E}_A(6)&=\mathcal{N}(A - 6I_3) =
\left\langle \left\{
\begin{bmatrix}
1.6\\
2.5\\
1
\end{bmatrix}\right\}\right\rangle
\end{aligned}
$$

The norm of this vector is $\frac{\sqrt{981}}{10}$ so the corresponding unit 
vector would be:
$$
\left\langle \left\{
\begin{bmatrix}
\frac{16}{\sqrt{981}}\\
\frac{25}{\sqrt{981}}\\
\frac{10}{\sqrt{981}}
\end{bmatrix}\right\}\right\rangle
$$

I figured out the problem; it was completely my fault. Somehow, my Privacy Badger settings on my home computer were blocking MathJax. It was happenstance that I used LaTeX delimiters at home, but checked the work of someone who used TeX delimiters at work. Changing my settings has both rendser just fine n my end. My apologies for the mistake.

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.