我应该使用哪种技术将我的 Latex 文档转换为 html 文档

发布于 2024-09-04 23:05:51 字数 596 浏览 2 评论 0原文

我想编写一个小程序将 TeX 文件转换为 HTML。我想解析文档并将宏(内置的,当然还有我自己的)转换为 HTML 片段。这是我的要求:

  • 预定义规则(例如 begin{itemize} \item text \end{itemize} =>

    text

    < br/>
  • 定义自己的CSS样式
  • 转换公式的能力(提取公式,将它们加载到图像创建器中,然后保存jpg/png)
  • 易于维护和简洁

我知道有几种技术,但是我不太清楚哪一个最适合我。以下是我脑海中浮现的技术:

  1. Ruby(I/O 很简单,通过 webrat 进行公式化加载)、
  2. XML XSLT(我不认为我只需要开销)
  3. perl(有很多库,但我不知道)非常熟悉它)
  4. bash (我使用 sed 并惊讶于使用正则表达式是多么容易)
  5. 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

  1. Ruby (I/O is easy, formular loading via webrat),
  2. XML XSLT (I don't think that I need just overhead)
  3. perl (there are many libs out there but I'm not quite familiar with it)
  4. bash (I worked with sed and was surprised how easy it was to work with regular expressions)
  5. 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

梦在深巷 2024-09-11 23:05:51

看看 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!

北城半夏 2024-09-11 23:05:51

六:TeX

七:Haskell

(我放弃了说服 SO 从 6 开始对列表进行编号的尝试)。

Six: TeX

Seven: Haskell

(I gave up trying to persuade SO to start numbering my list from 6).

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文