Pandoc:从Markdown生成可编译的.tex [英] Pandoc: generate compilable .tex from markdown

查看:120
本文介绍了Pandoc:从Markdown生成可编译的.tex的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经开始使用Markdown编写Latex PDF,到目前为止,我对它所带走的样板数量印象深刻.

I have started using Markdown to write my Latex PDFs, and so far I am impressed by the amount of boilerplate it takes away.

但是,我发现Markdown不如Tex富有表现力,因此在某些情况下,我想用Markdown编写文档,转换为tex,然后添加一些仅Latex的内容,然后再转换为PDF.

However, I find Markdown not as expressive as Tex, and therefore in some situations would like to write the document in Markdown, convert to tex, then add some Latex-only stuff and only then convert to PDF.

但是,使用Pandoc将.md转换为.tex不会产生可编译文件:它仅包含文件的主体,而不包含文档设置".

However, converting .md to .tex with Pandoc does not yield an compilable file: it only contains the body of the file, not the "document setup".

例如以下.md文件:

```haskell
data Expr = I Int
```

转换为:

\begin{Shaded}
\begin{Highlighting}[]
\KeywordTok{data} \DataTypeTok{Expr} \FunctionTok{=} \DataTypeTok{I} \DataTypeTok{Int}
\end{Highlighting}
\end{Shaded}

很明显,这缺少一些东西,例如文档类,文档开始和导入的包.有什么方法可以生成完整的文件,而不仅仅是正文?否则,谁能至少告诉我从Shaded,Highlighting,KeywordTok,DataTypeTok和FunctionTok命令中提取了哪些软件包?然后我可以自己添加这些导入.

Obviously this is missing some stuff like the document class, start of document and the imported packages. Is there any way to generate this complete file instead of just the body? Or if not, can anyone at least tell me what package the Shaded, Highlighting, KeywordTok, DataTypeTok and FunctionTok commands are pulled from? Then I can add these imports myself.

推荐答案

Pandoc默认情况下会创建小片段.使用--standalone(或-s)命令行标志对其进行调用以获取完整的文档.

Pandoc creates small snippets by default. Invoke it with the --standalone (or -s) command line flag to get a full document.

这篇关于Pandoc:从Markdown生成可编译的.tex的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆