我如何从* .Rmd的HTML输出中获取带边框的(LaTeX数学)排版矩阵? [英] How do I get (LaTeX math) typeset matrix with borders in HTML output from *.Rmd?
问题描述
以下rmarkdown
在编译为PDF(通过LaTeX)时可以正常工作,但在编译为HTML(通过Markdown)时不能正常工作.
The following rmarkdown
works fine when compiling to PDF (via LaTeX), but not when compiling to HTML (via Markdown).
PDF(通过LaTeX)
---
title: "test"
author: "Maximilian Held"
output: pdf_document
documentclass: memoir
---
(@matrix-test2) $$
\bordermatrix{
~ & Petra & Ingrid \cr
Petra & 1 & 0 \cr
Ingrid & 0 & 1 \cr
}
$$
HTML(通过Markdown)
---
title: "test"
author: "Maximilian Held"
output: html_document
documentclass: memoir
---
(@matrix-test2) $$
\bordermatrix{
~ & Petra & Ingrid \cr
Petra & 1 & 0 \cr
Ingrid & 0 & 1 \cr
}
$$
收益
这是怎么回事,这是谁的目的(Pandoc?Markdown?MathML?)
What's up with that and on whose end is this (Pandoc? Markdown? MathML?)
推荐答案
knitr ,通常用于使用 Pandoc 将RMarkdown转换为HTML/PDF(来自LaTeX)/DOCX. Pandoc是将Markdown转换为HTML和LaTeX的好工具,并允许您在Markdown内部使用LaTeX数学环境,例如
knitr, the tool normally used to convert RMarkdown to HTML/PDF (from LaTeX)/DOCX, uses Pandoc. Pandoc is a nice tool to convert Markdown to HTML and LaTeX and allows you to use LaTeX math environments inside Markdown, e.g.
$a x^2 + b x + c = 0$
或
$$a x^2 + b x + c = 0$$
或
\begin{equation}
a x^2 + b x + c = 0
\end{equation}
已由Pandoc正确转换. Pandoc还支持amsmath
,这是一种非常流行的LaTeX数学软件包. 不幸的是,Pandoc不支持您发现的所有(La)TeX命令/环境.
are properly converted by Pandoc. Pandoc also supports the amsmath
, a very popular LaTeX package for math. Unfortunately, Pandoc doesn't support all (La)TeX commands/environment as you discovered.
在与Pandoc合作时,我总是做的就是尽量简化事情.在您出现的情况下,我将使用普通表而不是矩阵.
What I always do when working with Pandoc is try to keep things simple. In the case you present, I would use normal tables instead of a matrix.
这篇关于我如何从* .Rmd的HTML输出中获取带边框的(LaTeX数学)排版矩阵?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!