所以我希望有一个简单的HTML、Word和PDF输出到一个静态的R标记文档。它在下面。
这个脚本与Word和HTML很好地结合在一起。但是针织到pdf会给出以下错误。
! Package amsmath Error: \begin{align} allowed only in paragraph mode.
Error: LaTeX failed to compile pdfissuesdoubeldollar.tex. See
https://yihui.org/tinytex/r/#debugging for debugging tips. See
pdfissuesdoubeldollar.log for more info现在,我可以把这两个$$,它将做的PDF和HTML编织,但Word只是跳过了方程式。只使用一美元也没有帮助,这也有公式不能在页面居中的问题。
有一些解决方法,比如制作word文件,然后使用acrobat或将word文件另存为PDF。但我正在尝试自动化编织大约130个文件,而不必维护两个单独的文件。不需要维护单独的文件是我从MSWord迁移到Rmarkdown的唯一主要原因。我愿意有一个有条件的R脚本和没有美元,但我如何才能捕获它是针织到哪种输出格式,我怎么做呢?任何帮助都将不胜感激。
下面的Rmarkdown脚本
output:
pdf_document:
toc: no
toc_depth: '4'
html_document:
toc: yes
toc_depth: 4
toc_float: yes
theme: readable
word_document:
toc: no
toc_depth: '4'
{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
$$\begin{align} \in_{a} &= \frac{\text{Approximate Error}}{\text{Present Approximation}}\\ &= \frac{- 0.3830}{9.8800}\\ &= - 0.0388\end{align}$$发布于 2021-03-22 02:32:43
通常,对于LaTeX方程,我总是使用\begin{split}而不是\begin{align}。
https://stackoverflow.com/questions/66735819
复制相似问题