Pandoc:从降价输入生成一个 html 嵌入 Latex 方程
Pandoc : generate a html embedding Latex equation from markdown input
我正在尝试使用 pandoc 将包含 Latex 方程式的降价文件转换为 Html 文件。
我在文件 test.md
中尝试了以下语法:
$$ \frac{1}{2} = 0.5 \neq \sqrt{2} $$
并且我使用
调用了 pandoc
pandoc test.md -o test.html --mathjax
正如 this answer 中所指出的那样。生成的 test.html
文件包含一行
<p><span class="math">\[ \frac{1}{2} = 0.5 \neq \sqrt{2} \]</span></p>
并且在使用网络浏览器打开 test.html
时,屏幕上的输出是乱七八糟的
\[ \frac{1}{2} = 0.5 \neq \sqrt{2} \]
而不是漂亮的 "latex-compiled" 方程。
我错过了什么?
P.S。我正在使用 pandoc 1.12.2.1
生成的 test.html
文件不是 "complete",因为只生成了 html 的 body,而不是 header。但是,必须在 header 中链接 mathjax 才能很好地显示等式。
要生成带有 <html>
<head>
和 <body>
标签的 "complete" html 文件,pandoc 的 --standalone
(又名 -s
) 必须使用选项
pandoc --standalone test.md -o test.html --mathjax
更多详情
使用调用
pandoc --standalone test.md -o test.html --mathjax
生成以下 test.html
文件
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Style-Type" content="text/css" />
<meta name="generator" content="pandoc" />
<title></title>
<style type="text/css">code{white-space: pre;}</style>
<script src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"></script>
</head>
<body>
<p><span class="math">\[ \frac{1}{2} = 0.5 \neq \sqrt{2} \]</span></p>
</body>
</html>
(注意 <script>
标签链接到 <head>
部分中的 mathjax)
而调用
pandoc test.md -o test.html --mathjax
生成一个仅包含 single-line
的文件
<p><span class="math">\[ \frac{1}{2} = 0.5 \neq \sqrt{2} \]</span></p>
我正在尝试使用 pandoc 将包含 Latex 方程式的降价文件转换为 Html 文件。
我在文件 test.md
中尝试了以下语法:
$$ \frac{1}{2} = 0.5 \neq \sqrt{2} $$
并且我使用
调用了 pandocpandoc test.md -o test.html --mathjax
正如 this answer 中所指出的那样。生成的 test.html
文件包含一行
<p><span class="math">\[ \frac{1}{2} = 0.5 \neq \sqrt{2} \]</span></p>
并且在使用网络浏览器打开 test.html
时,屏幕上的输出是乱七八糟的
\[ \frac{1}{2} = 0.5 \neq \sqrt{2} \]
而不是漂亮的 "latex-compiled" 方程。
我错过了什么?
P.S。我正在使用 pandoc 1.12.2.1
生成的 test.html
文件不是 "complete",因为只生成了 html 的 body,而不是 header。但是,必须在 header 中链接 mathjax 才能很好地显示等式。
要生成带有 <html>
<head>
和 <body>
标签的 "complete" html 文件,pandoc 的 --standalone
(又名 -s
) 必须使用选项
pandoc --standalone test.md -o test.html --mathjax
更多详情
使用调用
pandoc --standalone test.md -o test.html --mathjax
生成以下 test.html
文件
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Style-Type" content="text/css" />
<meta name="generator" content="pandoc" />
<title></title>
<style type="text/css">code{white-space: pre;}</style>
<script src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"></script>
</head>
<body>
<p><span class="math">\[ \frac{1}{2} = 0.5 \neq \sqrt{2} \]</span></p>
</body>
</html>
(注意 <script>
标签链接到 <head>
部分中的 mathjax)
而调用
pandoc test.md -o test.html --mathjax
生成一个仅包含 single-line
的文件<p><span class="math">\[ \frac{1}{2} = 0.5 \neq \sqrt{2} \]</span></p>