Quarto 1.2.269,Pandoc2.19.2,XeTeX 3.141592653-2.6-0.999994
index.qmd
---
title: "Why do I get a warning and failure to convert?"
---
This works:
$$
a = \pi r^2
$$
These do not:
$$
a_n = \begin{cases}
3n + 1 & \text{ if } n \text{ is odd} \\
n / 2 & \text{ otherwise}
\end{cases}
$$
$$
1 + 2 = 3 \\
3 + 2 = 5
$$_quarto.yml
project:
type: book
book:
title: "MRE"
chapters:
- index.qmd
format:
epub:
toc: true # whatever然后尝试渲染..。
$ quarto render
pandoc
to: epub
output-file: MRE.epub
toc: true
number-sections: true
default-image-extension: png
metadata
crossref:
chapters: true
title: MRE
[WARNING] Could not convert TeX math
a_n = \begin{cases}
3n + 1 & \text{ if } n \text{ is odd } \\
n / 2 & \text{ otherwise }
\end{cases}
, rendering as TeX
[WARNING] Could not convert TeX math
1 + 2 = 3 \\
3 + 2 = 5
, rendering as TeX:
1 + 2 = 3 \\
^
unexpected control sequence \\
expecting "%", "\\label", "\\tag", "\\nonumber" or whitespace
Output created: _book/MRE.epub...and的结果如下所示:

我做错了什么?如何在Quarto中使用用例环境或多行数学?
注意:这适用于项目类型网站,但不适用于项目类型手册。
发布于 2022-11-23 17:33:42
您可以尝试将其封装在LateX环境中,例如equation或align (在PDF和HTML中都可以使用)
\begin{equation*}
a_n = \begin{cases}
3n + 1 & \text{ if } n \text{ is odd} \\
n / 2 & \text{ otherwise}
\end{cases}
\end{equation*}
\begin{align*}
1 + 2 = 3 \\
3 + 2 = 5
\end{align*}例如,这里作为HTML输出:

https://stackoverflow.com/questions/74549226
复制相似问题