简体   繁体   English

将TEX文件转换为PDF或DOCX?

[英]Convert TEX files to PDF or DOCX?

I'm using Doxygen to build an API library from C# source code. 我正在使用Doxygen从C#源代码构建API库。 Doxygen generates a library of TEX files. Doxygen生成一个TEX文件库。

My client has asked for a PDF version of this API library so I need to convert the TEX file library into a single PDF or DOCX. 我的客户要求提供此API库的PDF版本,因此我需要将TEX文件库转换为单个PDF或DOCX。

I've been looking into tools such as LyX, OpenOffice, and ProText but still haven't found a solution. 我一直在研究LyX,OpenOffice和ProText等工具,但仍然没有找到解决方案。

All suggetions welcome. 所有建议都欢迎。

The simplest way to get pdf files is to use pdflatex. 获取pdf文件的最简单方法是使用pdflatex。 Any TeX installation will include it, including MikTeX and TeXLive, the two major Windows implementations. 任何TeX安装都将包含它,包括两个主要Windows实现的MikTeX和TeXLive。 The conversion is perfect by definition because pdflatex is a standard LaTeX compiler. 根据定义,转换是完美的,因为pdflatex是标准的LaTeX编译器。

Other methods include dvi2pdf, dvi2ps followed by ps2pdf, etc. But these involve an additional step. 其他方法包括dvi2pdf,dvi2ps,然后是ps2pdf等。但这些还包括一个额外的步骤。

To get a docx file is trickier. 获取docx文件比较棘手。 There are a range of tex to word converters. 有一系列tex到word转换器。 I've used Tex2Word with reasonable success, although there is always a deal of tidying up to do. 我已经使用了Tex2Word取得了合理的成功,尽管总有一些整理工作要做。 Other tools are discussed here . 这里讨论其他工具。 Whatever you use, you will probably need to convert to doc first, and then to docx, as I don't think any of the conversion tools produce direct docx output. 无论你使用什么,你可能需要首先转换为doc,然后转换为docx,因为我认为任何转换工具都不会产生直接的docx输出。

Why not just compile the .tex documents with LaTeX? 为什么不用LaTeX编译.tex文档? On windows use MiKTeX and TeXnicCenter. 在Windows上使用MiKTeX和TeXnicCenter。 I'm not sure how much formatting you will need to add, but give the document a standard preamble, and compile. 我不确定你需要添加多少格式,但是给文档一个标准的序言,然后编译。 You can output PDF. 您可以输出PDF。

EDIT : Further note... the package tex4ht on miktex works pretty well, as long as your latex markup is fairly standard. 编辑 :进一步注意...... miktex上的包tex4ht工作得很好,只要你的乳胶标记是相当标准的。 tex4ht will dump into html, openoffice, and a bunch of other stuff. tex4ht将转储到html,openoffice和其他一些东西。 If you can get it into html, you can take it into word (i've found that this works better than going straight to openoffice). 如果你可以把它变成html,你可以把它变成单词(我发现这比直接进入openoffice更好)。

After some time of research, I stepped across that nice free converter tool that amongst others creates you a .docx file out of a .tex file. 经过一段时间的研究,我跨过了那个不错的免费转换工具,其中包括.tx文件中的.docx文件。 Check it out: 看看这个:

Pandoc - a universal document converter . Pandoc - 通用文档转换器

See their Example Page for demos. 有关演示,请参阅其示例页面

To convert .tex to .docx, use: 要将.tex转换为.docx,请使用:

pandoc -s example.tex -o example.docx

which will give you a quite satisfying output depending on your expectations. 根据您的期望,这将给您一个非常令人满意的输出。 It also converts equations to regular word equations, although not every symbol properly. 它还将方程转换为常规单词方程,但并非每个符号都适当。

texi2pdf将执行此功能。

Try using DVIPS with the -Ppdf option. 尝试将DVIPS与-Ppdf选项一起使用。 Many Tex distributions include it. 许多Tex分发包括它。

Doxygen也会生成rtf输出,word2007很乐意转换为pdf或docx。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM