【3.5】pandoc
一、介绍
之所以把Pandoc单列,是因为它支持的格式简直太多了,尤其是Latex与MS Word(必须是docx格式)之间的转化,另外还有上面提到的rtf,html,odt,mathml,pdf,等。Pandoc支持中文字符,可运行于多种操作系统,更新非常快,而且免费。全部操作在命令行下运行。常用命令有: Latex转Docx:pandoc -s a.tex -o b.docx Docx转Latex:pandoc -s a.docx -o b.tex 更多格式和选项请阅读手册。
注:
- Docx转Latex:对公式和表格的支持都比较好。公式必须用Word自带的公式编辑器产生,MathType编写的公式不认(不过,MathType自身可以输出Latex公式)
- Latex转Docx:对公式的支持比较好;转化表格的功能有限,仅支持最简单的表格,如果自定义列宽,合并单元格等,就无法识别
官网介绍:http://pandoc.org/getting-started.html#step-6-converting-a-file
下载
mac下载
brew isntall pandoc
转换
pandoc test1.md -f markdown -t html -s -o test1.html
The filename test1.md tells pandoc which file to convert. The -s option says to create a “standalone” file, with a header and footer, not just a fragment. And the -o test1.html says to put the output in the file test1.html. Note that we could have omitted -f markdown and -t html, since the default is to convert from markdown to HTML, but it doesn’t hurt to include them.
tanqianshan[Desktop]$ pandoc growthwise.tex -t latex -o growthwise_2.pdf
pandoc: pdflatex not found. pdflatex is needed for pdf output.
TeX Live
下载的mactex
http://www.tug.org/mactex/mactex-download.html
wget -c http://tug.org/cgi-bin/mactex-download/MacTeX.pkg
安装后的程序路径:/Library/TeX/texbin
参考资料
