首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >多行数学在Quarto中失败

多行数学在Quarto中失败
EN

Stack Overflow用户
提问于 2022-11-23 15:23:54
回答 1查看 42关注 0票数 2

Quarto 1.2.269,Pandoc2.19.2,XeTeX 3.141592653-2.6-0.999994

index.qmd

代码语言:javascript
复制
---
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

代码语言:javascript
复制
project:
  type: book

book:
  title: "MRE"
  chapters:
    - index.qmd

format:
  epub:
    toc: true  # whatever

然后尝试渲染..。

代码语言:javascript
复制
$ 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中使用用例环境或多行数学?

注意:这适用于项目类型网站,但不适用于项目类型手册。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2022-11-23 17:33:42

您可以尝试将其封装在LateX环境中,例如equationalign (在PDF和HTML中都可以使用)

代码语言:javascript
复制
\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输出:

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/74549226

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档