我应该使用哪种技术将我的 Latex 文档转换为 html 文档
我想编写一个小程序将 TeX 文件转换为 HTML。我想解析文档并将宏(内置的,当然还有我自己的)转换为 HTML 片段。这是我的要求:
- 预定义规则(例如
begin{itemize} \item text \end{itemize}
=>
)text
< br/> - 定义自己的CSS样式
- 转换公式的能力(提取公式,将它们加载到图像创建器中,然后保存jpg/png)
- 易于维护和简洁
我知道有几种技术,但是我不太清楚哪一个最适合我。以下是我脑海中浮现的技术:
- Ruby(I/O 很简单,通过 webrat 进行公式化加载)、
- XML XSLT(我不认为我只需要开销)
- perl(有很多库,但我不知道)非常熟悉它)
- bash (我使用 sed 并惊讶于使用正则表达式是多么容易)
- Latex2html ...(这些转换器对我不起作用,它们不给我解析的自由)
任何建议,欢迎提示和评论。
感谢您抽出宝贵的时间,伙计们。
I want to write a little program that transforms my TeX files into HTML. I want to parse the documents and turn the macros (the build-in and of course my own) into HTML pieces. Here are my requirements:
- predefined rules (e.g.
begin{itemize} \item text \end{itemize}
=><br> <p>text </p> <br/>
) - defining own CSS style
- ability to convert formulars (extract the formulars, load them in an imagecreator and then save the jpg/png)
- easy to maintain and concise
I know there are several technologies out there, but I don't exactly know which is the best for me. Here are the technologies which flow into my mind
- Ruby (I/O is easy, formular loading via webrat),
- XML XSLT (I don't think that I need just overhead)
- perl (there are many libs out there but I'm not quite familiar with it)
- bash (I worked with sed and was surprised how easy it was to work with regular expressions)
- latex2html ... (these converters won't work for me and they don't give me freedom in parsing)
Any suggestions, hints and comments are welcome.
Thanks for your time, folks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
看看 pandoc 此处。它也可以安装在 linux 或 os x 上。虽然它不会执行您的自定义宏。我见过的唯一可以很好地处理自定义宏的东西是 tex4ht,但要真正正常工作,您需要生成 .DVI 文件。如果您有大量的自定义宏,那么编写自己的转换器将花费大量时间。即使您只有几个自定义宏,它仍然会很痛苦。祝你好运!
have a look at pandoc here. it can also be installed on linux or os x. Though it won't do your custom macros. The only thing I've seen that can do a decent job with custom macros is tex4ht, but to really work well you need to be producing .DVI files. If you have a ton of custom macros, writing your own converter is going to take an ass load of time. Even if you only have a few custom macros, it's still going to be a pain. good luck!
六:TeX
七:Haskell
(我放弃了说服 SO 从 6 开始对列表进行编号的尝试)。
Six: TeX
Seven: Haskell
(I gave up trying to persuade SO to start numbering my list from 6).