Gae*_*eul 4 html markdown latex pandoc
我正在尝试使用 pandoc 将包含 Latex 方程的降价文件转换为 Html 文件。
我在文件中尝试了以下合成器test.md:
$$ \frac{1}{2} = 0.5 \neq \sqrt{2} $$
Run Code Online (Sandbox Code Playgroud)
我调用 pandoc 使用
pandoc test.md -o test.html --mathjax
Run Code Online (Sandbox Code Playgroud)
正如这个答案中所指出的那样。生成的test.html文件包含单行
<p><span class="math">\[ \frac{1}{2} = 0.5 \neq \sqrt{2} \]</span></p>
Run Code Online (Sandbox Code Playgroud)
当test.html使用网络浏览器打开时,屏幕上的输出有点
\[ \frac{1}{2} = 0.5 \neq \sqrt{2} \]
Run Code Online (Sandbox Code Playgroud)
而不是一个很好的“乳胶编译”方程。
我错过了什么?
PS 我正在使用 pandoc 1.12.2.1
test.html生成的文件并不“完整”,因为只生成了 html 的正文,而不是标题。但是,必须在标题中链接 mathjax 才能很好地显示方程。
要生成带有<html> <head>和<body>标签的“完整”html 文件,必须使用pandoc 的--standalone(又名-s)选项
pandoc --standalone test.md -o test.html --mathjax
Run Code Online (Sandbox Code Playgroud)
使用调用
pandoc --standalone test.md -o test.html --mathjax
Run Code Online (Sandbox Code Playgroud)
生成以下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>
Run Code Online (Sandbox Code Playgroud)
(注意本节中<script>链接到 mathjax的标签<head>)而调用
pandoc test.md -o test.html --mathjax
Run Code Online (Sandbox Code Playgroud)
生成仅包含单行的文件
<p><span class="math">\[ \frac{1}{2} = 0.5 \neq \sqrt{2} \]</span></p>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1786 次 |
| 最近记录: |