Open N0rbert opened 2 years ago
From https://slides.yihui.org/xaringan/#16
The source code of a LaTeX math expression must be in one line, unless it is inside a pair of double dollar signs, in which case the starting
$$
must appear in the very beginning of a line, followed immediately by a non-space character, and the ending$$
must be at the end of a line, led by a non-space character;
That said, I think there may be an issue in xaringan, because putting the \begin{equation} ... \end{equation}
all on one line didn't work for me as expected.
---
title: "Latex Cases"
output:
xaringan::moon_reader:
seal: false
---
**Doesn't work...**
\begin{equation}
\begin{cases}
\Delta_{0}=0,3\Delta_{1}+0,3\Delta_{0} \\
\Delta_{1}-5=0,2\Delta_{1}-0,2\Delta_{0}
\end{cases}
\end{equation}
$$\begin{equation}
\begin{cases}
\Delta_{0}=0,3\Delta_{1}+0,3\Delta_{0} \\
\Delta_{1}-5=0,2\Delta_{1}-0,2\Delta_{0}
\end{cases}
\end{equation}$$
**I thought this would work according to xaringan docs**
\begin{equation}\begin{cases}\Delta_{0}=0,3\Delta_{1}+0,3\Delta_{0} \\ \Delta_{1}-5=0,2\Delta_{1}-0,2\Delta_{0}\end{cases}\end{equation}
**This does work!**
$\begin{equation}\begin{cases}\Delta_{0}=0,3\Delta_{1}+0,3\Delta_{0} \\ \Delta_{1}-5=0,2\Delta_{1}-0,2\Delta_{0}\end{cases}\end{equation}$
This is the same bug as reported here: https://stackoverflow.com/q/67076613/559676 The bug was from here (nested math environments don't work): https://github.com/yihui/xfun/blob/ca981bf7873b679d58873921069214ab37e13047/R/markdown.R#L95-L101
The workaround is to join \begin{cases}
and \end{cases}
with other lines like this:
\begin{equation}
\begin{cases}\Delta_{0}=0,3\Delta_{1}+0,3\Delta_{0} \\
\Delta_{1}-5=0,2\Delta_{1}-0,2\Delta_{0}\end{cases}
\end{equation}
Below is the minimal reproducible example:
It uses Cases inside Equation environment. Rendering is successful for PDF -
but Xaringan does not render it
Details about system:
By filing an issue to this repo, I promise that
xfun::session_info('xaringan')
. I have upgraded all my packages to their latest versions (e.g., R, RStudio, and R packages), and also tried the development version:remotes::install_github('yihui/xaringan')
.I understand that my issue may be closed if I don't fulfill my promises.