R Markdown docx输出中的dcase?

时间:2019-05-06 16:10:14

标签: r ms-word latex r-markdown

R Markdown docx输出是否不支持dcases

编织到pdf_document时,下面的tinytextest.Rmd会产生预期的输出。但是当编织到word_document时。我得到一个错误。该错误表明根本不了解dcases。我读对了吗?

如果不支持dcasescases是我的最佳选择吗?我在下面添加了更多示例。 cases看起来不错。但请注意,即使cases*也会令人窒息。

tinytextest.Rmd

---
title: "TinyTeX Test"
author: "Me"
date: "5/3/2019"
header-includes:
- \usepackage{mathtools}
output: 
  word_document: default
  pdf_document: default
---

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

\[
f(x) =
\begin{dcases*}
1                 & for \(x=0\) \\
\log(x) & for \(x \neq 0\),
\end{dcases*}
\]

错误输出

[WARNING] Could not convert TeX math '
  f(x) =
  \begin{dcases*}
  1                 & for \(x=0\) \\
  \log(x) & for \(x \neq 0\),
  \end{dcases*}
  ', rendering as TeX:
  f(x) =
         ^
  unexpected "d"
  expecting white space or "Bmatrix", "Vmatrix", "align", "alignat", "aligned", "alignedat", "array", "bmatrix", "cases", "eqnarray", "equation", "flalign", "flaligned", "gather", "gathered", "matrix", "multline", "pmatrix", "smallmatrix", "split", "vmatrix"

Output created: tinytextest.docx

tinytextest.docx

enter image description here

将更多乳胶示例添加到tinytextest.Rmd

\[
f(x) =
\begin{dcases*}
1                 & for \(x=0\) \\
\log(x) & for \(x \neq 0\),
\end{dcases*}
\]

\[
f(x) =
\begin{dcases}
1                 & \mathrm{for\,} x=0 \\
\log(x) & \mathrm{for\,} x \neq 0,
\end{dcases}
\]

\[
f(x) =
\begin{cases*}
1                 & for \(x=0\) \\
\log(x) & for \(x \neq 0\)
\end{cases*}
\]

\[
f(x) =
\begin{cases}
1                 & \mathrm{for\,} x=0 \\
\log(x) & \mathrm{for\,} x \neq 0
\end{cases}
\]

tinytextest.docx以及其他示例

enter image description here

0 个答案:

没有答案