![](/img/trans.png)
[英]Knitr, RMarkdown: How to have Latex page break omitted in HTML Output
[英]In RMarkdown, how to include latex code when using an HTML or Word output
我有一個非常基本的問題。 我沒有在任何地方找到答案。 我擔心答案是否定的。
Using R Markdown, I would like to use LaTex code with an HTML or Word output.
一個非常簡單的 MVE:
我想執行以下代碼:
This text has been written with both \LaTeX{} and Rmd codes.
使用 LaTex/PDF output,沒問題。 我得到“此文本已使用 Latex 和 Rmd 代碼編寫。” (帶有漂亮的 LaTeX 標志!)
使用 HTML 或字 output,我得到“此文本已使用 Rmd 和 Rmd 代碼編寫。”
因此 LateX 代碼與非 LateX output 一起消失。
你知道有沒有辦法解決這個問題?
提前致謝,
埃里克
編輯:這是另一個使用簡單表的示例
\begin{table}[h]
\centering
\caption{A simple table}
\begin{tabular}{|l|c|c|}
\hline
a & b & c \\
d & e & f \\
\hline
\end{tabular}
\end{table}
如果您將 LaTeX output 放在美元符號之間,它將起作用。 在 HTML 中,如果您處於離線狀態,它將無法工作! :
This text has been written with both $\LaTeX{}$ and Rmd codes.
在 R Markdown 中,Pandoc 將 LaTeX 轉換為 Office 數學標記 (OMML)。 因此,您可以在 Word 中獲得 LaTeX output,但據我所知,您不會獲得徽標。
對於 Word 中的 LaTeX output,刪除反斜杠並添加美元符號,如下所示:
This text has been written with both $LaTeX{}$ and Rmd codes.
或者在反斜杠和 output 之間留一個空格:
This text has been written with both $\ LaTeX{}$ and Rmd codes
這是 Word 中生成的文檔的快照:
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.