在降价文档中,预期的输入标记语言为(r)markdown。您不应期望pandoc能够自动识别任意混合的标记语言。 LaTeX数学标记只能用于降价文档,因为有rmarkdown extension来处理它。
但是,仍然可以在rmarkdown文档中使用类似问题中显示的LaTeX表。我在this answer中演示了“逆”(RNW文件中的降价表)。请注意,这是一种相当实验性的方法,在其他情况下可能会失败。
tex2markdown功能背后的想法被解释为here。
---
output: html_document
---
# My document
This is `rmarkdown`.
This table is converted from LaTeX:
```{r, results = "asis", echo = FALSE, message = FALSE}
library(knitr)
tex2markdown
writeLines(text = texstring,
con = myfile
texfile
cat(readLines(texfile), sep = "\n")
unlink(c(myfile, texfile))
}
textable
\\begin{table}[]
\\centering
\\caption{Food order}
\\begin{tabular}{| l | l |}
\\hline
Hamburgers & 3 \\\\
Hot dogs & 2 \\\\ \\hline
\\end{tabular}
\\end{table}
"
tex2markdown(textable)
```
---
Time for *lunch*.
并非所有LaTeX功能都可以转换为HTML,但对于简单的任务,这应该可行。请注意,反斜杠需要通过额外的反斜杠进行转义。
这主要是概念证明。对于生产,使用RNW文档中的LaTeX表和RMD文档中的降价表!