How to use MathJax in Slidify?
Asked Answered
P

0

6

It seems that all that need to do is to claim widget: mathjax in the title page. But I can't get the formulas correctly rendered. Anything missing? Thank you.

enter image description here

UPDATE: I checked the final index.html, and found that many "*"'s have become <em> or </em>. It seems that slidify is mixing the * in LaTeX and the * in markdown.

Here is my LaTeX snippet:

\begin{align*}
&\begin{bmatrix}
\mathbf{y}\\
y_*
\end{bmatrix}
=\mathcal{N}\left(0,\begin{bmatrix}
K & K_*\\
K_*^T & K_{**}
\end{bmatrix}\right)\\
\Longrightarrow & y_*|\mathbf{y}\sim\mathcal{N}\left(K_*K^{-1}\mathbf{y},K_{**}-K_*K^{-1}K_*^T\right)\\
\Longrightarrow & \overline{y_*}=K_*K^{-1}\mathbf{y}
\end{align*}

which is converted to

<li>Inference
$$\begin{align<em>}
&amp;\begin{bmatrix}
\mathbf{y}\
y_</em>
\end{bmatrix}
=\mathcal{N}\left(0,\begin{bmatrix}
K &amp; K<em>*\
K</em><em>^T &amp; K_{</em><em>}
\end{bmatrix}\right)\
\Longrightarrow &amp; y_</em>|\mathbf{y}\sim\mathcal{N}\left(K<em>*K^{-1}\mathbf{y},K</em>{*<em>}-K<em>*K^{-1}K</em></em>^T\right)\
\Longrightarrow &amp; \overline{y<em>*}=K</em><em>K^{-1}\mathbf{y}
\end{align</em>}$$</li>
</ul>

UPDATE 2: I substituted the &#95; for _ and &#42; for *, as well as \\ for some \. And it looks quite good now:

$$\\begin{align&#42;}
&\\begin{bmatrix}
\mathbf{y}\\\\
y&#95;&#42;
\\end{bmatrix}
=\mathcal{N}\left(0,\begin{bmatrix}
K & K&#95;&#42;\\\\
K&#95;&#42;^T & K&#95;{&#42;&#42;}
\\end{bmatrix}\right)\\\\
\Longrightarrow & y&#95;&#42;\big|\mathbf{y}\sim\mathcal{N}\left(K&#95;&#42;K^{-1}\mathbf{y},K&#95;{&#42;&#42;}-K&#95;&#42;K^{-1}K&#95;&#42;^T\right)\\\\
\Longrightarrow & \bar{y}&#95;&#42;=K&#95;&#42;K^{-1}\mathbf{y}
\\end{align&#42;}$$
Pincushion answered 12/12, 2012 at 0:0 Comment(9)
I will check this out. Slidify uses the markdown package to convert markdown into html. I have never used \begin{align*} in my equations and am not sure what breaks it. I will check and post back if I have an answer.Eugeniusz
I am unable to reproduce your error. Here is a slide deck using the math you used rpubs.com/ramnathv/slidify-mathjax. It is rendering nicely for me.Eugeniusz
@Eugeniusz , just now the ^s turn into <sup>s, which didn't happen yesterday. I think it is because the command options(markdown.extensions = c("no_intra_emphasis", "tables", "fenced_code", "autolink", "strikethrough", "lax_spacing", "space_headers", "latex_math")) has not been executed when my RStudio starts up. So am I missing some options? Thank you.Pincushion
I am not sure what is happening at your end. I tried your equations and they work fine for me. Post an issue on github with more details about your sessionInfo() and I can take a look.Eugeniusz
@Ramnath: The link you posted doesn't render well in my browser, either: see screenshot (let's see how long it's available...)Dung
That is interesting that Chrome is not rendering the Math for you correctly on the same site. I am puzzled.Eugeniusz
@Eugeniusz - still happening with the latest github release - ^ and * get converted into <em> and <sup> tags.Furze
Post your sessionInfo() on the github repo for slidify. I checked just now and it works perfectly for me.Eugeniusz
@Eugeniusz - pastebin.com/apgT9tkK - will post an issue as soon as I get to my desk.Furze

© 2022 - 2024 — McMap. All rights reserved.