2016-01-12 30 views
2

的pandoc User's Guide国家(重点):如何在pandoc中使用latex宏?

对于比乳胶等输出格式,pandoc将解析乳胶\ newcommand和\ renewcommand定义和应用所产生的宏所有LaTeX的数学。因此,举例来说,下面将在所有输出格式,而不仅仅是乳胶工作:

\newcommand{\tuple}[1]{\langle #1 \rangle} 

$\tuple{a, b, c}$ 

胶乳产量,\ newcommand定义将被简单地原样传递到输出。

例如,使用该试验的文件:

\renewcommand{\vec}[1]{\mathbf{#1}} 

The gravitational force 

$$\vec{g}$$ 

The gravitational force 

$$\mathbf{g}$$ 

And with some code: 

~~~{.cpp .numberLines startFrom="1"} 
class A {}; 
~~~ 

<p>[1]{}</p> 
<p>The gravitational force</p> 
<p><br /><span class="math display">$$\vec{g}$$</span><br /></p> 
<p>The gravitational force</p> 
<p><br /><span class="math display"><strong>g</strong></span><br /></p> 
<p>And with some code:</p> 
<div class="sourceCode" startFrom="1"><table class="sourceCode cpp numberLines"><tr class="sourceCode"><td class="lineNumbers"><pre>1 
</pre></td><td class="sourceCode"><pre><code class="sourceCode cpp"><span class="kw">class</span> A {}; </code></pre></td></tr></table></div> 

pandoc test.md -o test.html结果转换它如果pandoc真的解析newcommandrenewcommand,为什么是胶乳源代码留在第一个HTML文件中g vector:

<p><br /><span class="math display">$$\vec{g}$$</span><br /></p> 

而另一胶乳方程限定载体成功转化成粗体信?

这是不一致吗?通过调用pandoc test.md --from markdown+latex_macros -o test.html启用latex_macros扩展时,结果相同。

+1

应该它不是'\ renewcommand {\ VEC} '而不是'\ renewcommand {vec}' – scoa

回答

2

我认为这是一个错字。本文档:

\renewcommand{\vec}[1]{\mathbf{#1}} 

The gravitational force 

$$\vec{g}$$ 

The gravitational force 

$$\mathbf{g}$$ 

And with some code: 

~~~{.cpp .numberLines startFrom="1"} 
class A {}; 
~~~ 

给出与预期输出pandoc test.md -o test.html(第2行和4是按预期相同:\vec已被定义为\mathbf

<p>The gravitational force</p> 
<p><br /><span class="math display"><strong>g</strong></span><br /></p> 
<p>The gravitational force</p> 
<p><br /><span class="math display"><strong>g</strong></span><br /></p> 
<p>And with some code:</p> 
<div class="sourceCode" startFrom="1"><table class="sourceCode cpp numberLines"><tr class="sourceCode"><td class="lineNumbers"><pre>1 
</pre></td><td class="sourceCode"><pre><code class="sourceCode cpp"><span class="kw">class</span> A {}; </code></pre></td></tr></table></div> 
相关问题