简体   繁体   English

pdflatex文件转换为html

[英]pdflatex document to html

I need to convert a bunch of pdflatex only documents (because of graphics-- .pdf's jpgs & pngs) to html. 我需要将一堆仅pdflatex的文档(由于图形-.pdf的jpgs和pngs)转换为html。 tex4ht is giving a bunch of garbage output. tex4ht提供了很多垃圾输出。 the documents are built using the \\input command. 使用\\ input命令构建文档。 Is there anything I can do to help tex4ht with a pdflatex document? 我可以做些什么来帮助tex4ht处理pdflatex文档? I've looked at many converters (pandoc, hevea, tth, latex2rtf) but none of them can include my figures well. 我看过许多转换器(pandoc,hevea,tth,latex2rtf),但没有一个能很好地包含我的数据。 Is tex4ht my best bet? tex4ht是我最好的选择吗?

您可以编写使用tex4ht的\\ HCode宏来重新定义\\ includegraphics(或其他任何内容),以便它们发出适当的html代码。

The sl2h program that ships with noweb is a terrible hack (I wouldn't wish it on my worst enemy), but you can do this job with it. noweb附带的sl2h程序是一个可怕的hack(我不希望我遇到的最大敌人),但是您可以使用它来完成这项工作。 I have used it to prepare handouts for my classes. 我用它来为我的课准备讲义。 If you find yourself in extremis you can use horrible tricks like this: 如果您发现自己处于极端状态 ,则可以使用以下可怕技巧:

\ifhtml
  \begin{center}
  \includegraphics{address.png}
  \end{center}
\else
  \begin{center}
  \includegraphics[scale=0.5]{address.eps}
  \end{center}
\fi

(As you can probably tell, I don't use pdflatex; I use plain latex.) But hacks like this work, and the figures do get included. (您可能会说,我不使用pdflatex;我使用普通的乳胶。)但是像这样的黑客程序确实包含在内。 I think they would all have to be PNG or JPEG, however; 我认为它们都必须是PNG或JPEG。 I'm pretty sure that sl2h does not know how to convert a PDF figure to an image for a web page.) 我非常确定sl2h不知道如何将PDF图形转换为网页图像。)

Converting from LaTeX to html is tricky and not well documented in my opinion. 从LaTeX转换为html是棘手的,在我看来还没有很好的文档记录。 Have you taken a look at Texmaker at http://www.xm1math.net/texmaker/ ? 您是否在http://www.xm1math.net/texmaker/上浏览过Texmaker? It's free and it offers an integrated LaTeX to html conversion tool. 它是免费的,并且提供了一个集成的LaTeX到html转换工具。

I use tex2html, which I like better than latex2html. 我使用的是tex2html,它比latex2html更好。 It seems to work pretty well. 看来效果很好。

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

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