如何最好地编写针对 HTML 和 PDF 的文档?

发布于 2024-07-10 18:16:52 字数 1830 浏览 8 评论 0 原文

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(16

痕至 2024-07-17 18:16:52

对于记录代码,我还推荐 Sphinx。 ReStructured Text 很好,因为它可读并且以纯文本形式进行了一些标记,并且可以很好地转换为 html 和 pdf。 对于某些事情我仍然喜欢 LaTeX。 我和我的妻子使用 LaTeX 写圣诞信,并通过普通邮件寄出。 pdf 版本非常精美,有两栏、页眉和页脚。 html 版本更简单。 我用plastex转换。 示例如下:
http://fedibblety.com/annualReports

我认为任何二进制格式(Word)都不适合10 年后您可能想阅读的任何类型的文档。 这是 LaTeX 的优点之一。

For documenting code, I also recommend Sphinx. ReStructured Text is nice because it is readable and somewhat marked up in plaintext, and can do a nice job converting to html and to pdf. I still like LaTeX for certain things. My wife and I use LaTeX to write our christmas letter, which we mail out via snail mail. The pdf version is pretty fancy, with two columns, and headers and footers. The html version is simpler. I convert with plastex. Examples here:
http://fedibblety.com/annualReports

I don't think any binary format is a good choice (Word) for any sort of document that you might like to read 10 years from now. That is one of the nice things about LaTeX.

月下伊人醉 2024-07-17 18:16:52

是的,LaTeX 到 HTML 的转换器过去很糟糕(您可能尝试过 LaTeX2HTML),但最近它们变得更好了。 Tex4ht 是高度可配置的,并生成漂亮的 XHTML+CSS 。 另请参阅其他转换器

如果您愿意在其中书写,您还可以使用 Docbook。 有从 DocBook 到 HTML 和 LaTeX(或直接到 PDF)的转换器; 后者的一个示例是 dblatex

请参阅这篇文章:LaTeX 与 Docbook

Yes, LaTeX-to-HTML converters used to suck (you've probably tried LaTeX2HTML), but of late they've got better. Tex4ht is highly configurable, and produces nice XHTML+CSS. See also other converters.

You can also use Docbook, if you can bear to write in it. There are converters from DocBook to both HTML and LaTeX (or to PDF directly); an example of the latter is dblatex.

See this post: LaTeX vs Docbook.

極樂鬼 2024-07-17 18:16:52

经过多年的痛苦和几次错误的开始,我即将重新审视这一点,并且我将给予 Sphinx 尝试一下。 它可以从重构文本生成HTML或LaTeX。

我希望它是一个比完整的 DocBook 更“轻量”的选择,但具有许多优点。

After many years of anguish and several false starts, I'm about to revisit this, and I'm going to give Sphinx a try. It can generate HTML or LaTeX from ReStructured Text.

I'm hoping it will be a much "lighter" option than full DocBook, but with many of the advantages.

罗罗贝儿 2024-07-17 18:16:52

您可以退后一步,使用 DocBook 之类的东西,并通过 LaTeX 和 HTML 直接从 DocBook 文件渲染为 PDF。 或者,Adobe Technical Communication Suite (Framemaker) 将允许您将文档单一来源为 PDF 和 HTML。 请参阅此帖子了解概要各种技术文档系统。

You could take a step back and use something like DocBook and render to PDF via LaTeX and HTML straight from the DocBook files. Alternatively, Adobe Technical Communication Suite (Framemaker) will let you single-source a document to PDF and HTML. See this posting for a rundown on various technical documentation systems.

木緿 2024-07-17 18:16:52

这是个人选择,但 Latex 理论上是完美的,但在实践中却很痛苦。 我在需要时使用 VS.NET HTML 编辑器 + 原始 HTML 编辑。

所以我认为使用 WSIWYG HTML 编辑器是最好的选择。 您始终可以使用简单的工具将其转换为 PDF,并且在需要高级功能时始终可以编辑 HTML。 当您需要时,也可以更轻松地将其放到网上。

这就是我管理软件文档的方式,并且对我来说效果很好。

This is a personal choice but Latex in theory is perfect however in practice it's pain-in-the-arse. I'm using VS.NET HTML editor + raw HTML edit when I need it.

So I think using an WSIWYG HTML editor is best choice. You can always use a simple tool to convert it to PDF, and you can always edit HTML when you need something advanced. Also it's easier to put online when you need.

That's how I'm managing my software documentations and works fine for me.

≈。彩虹 2024-07-17 18:16:52

PlasTeX 看起来像是一个不错的 Latex-to-html 转换器,尽管我自己还没有尝试过。

我的朋友 Rob Felty 写了一篇博客文章赞扬它的优点:
http://blog.robfelty .com/2008/03/19/finally-a-better-latex-to-html-converter/

PlasTeX looks like a nice latex-to-html converter, though I haven't tried it myself.

My friend Rob Felty wrote a blog post extolling its virtues:
http://blog.robfelty.com/2008/03/19/finally-a-better-latex-to-html-converter/

数理化全能战士 2024-07-17 18:16:52

AsciiDoc 看起来是一个有趣的可能性。

AsciiDoc looks like an interesting possibility.

好久不见√ 2024-07-17 18:16:52

了解 EPUB 格式。 它的电子书格式。 http://en.wikipedia.org/wiki/EPUB

Read about EPUB format. Its e-book format. http://en.wikipedia.org/wiki/EPUB

那伤。 2024-07-17 18:16:52

由于提到 Asciidoc 的答案在示例上有些简短,以下是您正在寻找的一些内容用于:

  • 使用 Asciidoc
  • A pdf powerman.name/doc/asciidoc" rel="nofollow">cheatsheet 并排显示 Asciidoc 标记和 html 结果。
  • 使用 Asciidoc 完成的出版物列表,包括 O'Reilly 书籍和 git 文档 (查看用户刻度的两端)。

Since the answer mentioning Asciidoc was somewhat short on examples, here are some of the things your are looking for:

  • A pdf generated with Asciidoc
  • A cheatsheet with a side by side of the Asciidoc markup and the html result.
  • A list of publications done using Asciidoc, including O'Reilly books and the git documentation (to see both ends of the user scale).
虫児飞 2024-07-17 18:16:52

我不确定乳胶是否真的是最好的工具。 您在使用通常的 Latex 到 html 转换器时遇到的麻烦就表明了问题所在:html 很简单,不如 Latex 那样富有表现力。

如果您坚持使用 Latex 到 html,请注意使用可以合理转换的有限子集。

I'm not sure that latex is really the best tool for this. The trouble you're having with the usual latex to html converter is indicative of the problem: html is simple not as expressive as latex.

If you insist on latex to html, take care to use a limited subset that can convert reasonably.

世界如花海般美丽 2024-07-17 18:16:52

我过去使用过TeXinfo,它做得很好。 下面是一个示例:http://yootles.com/api。 但我更愿意坚持使用 LaTeX,而不是使用其他语言。

I've used TeXinfo in the past and it does a good job. Here's an example: http://yootles.com/api. I'd prefer to stick with LaTeX though instead of use another language.

风为裳 2024-07-17 18:16:52

如果一切都失败了,您可以使用 LaTeX 到 XML 转换器并编写一个简单的 XSLT 样式表将其转换为 HTML,或者创建一个 CSS 样式表并将其直接附加到 XML 文件。

If everything else fails you could grab an LaTeX to XML converter and write a simple XSLT stylesheet to convert it to HTML, or create a CSS style sheet and attach it to the XML file directly.

凡间太子 2024-07-17 18:16:52

我们一直在使用 WebWorks ePublisher (www.webworks.com),它提供多种单一源格式(我们使用 Word)以及输出为多种输出格式的能力(我们输出为 Adob​​e PDF 和在线帮助 (.CHM) 。

We've been using WebWorks ePublisher (www.webworks.com) which offers both multiple single-source formats (we are using Word) and the ability to output to many output formats (we output to Adobe PDF and Online Help (.CHM).

翻了热茶 2024-07-17 18:16:52

我们在一个涉及 Eclipse 软件的学术项目中遇到了这个问题,我们使用 plastex 将 Latex 转换为 HTML 和 Eclipse Help。 让它发挥作用相当困难,但最终结果看起来非常好。 您可以在此处查看所有三个版本:

http://handbook.event-b.org/

此外,由于这是一个开放项目,因此代码(构建脚本)可用。 我们有一个持续构建系统(Jenkins),当签入新的 Latex 时,它会重建所有内容。这特别好,因为贡献者不需要在他们的系统上安装工具链。 他们只是签入新的 Latex 并在服务器上检查 HTML 是否正确生成。 资料来源:

http: //sourceforge.net/p/rodin-b-sharp/svn/HEAD/tree/trunk/Handbook/org.rodinp.handbook.feature/

最好,迈克尔

We were facing this problem in an academic project that involved Eclipse software, and we used plastex to convert Latex to HTML and Eclipse Help. Getting it to work was quite difficult, but the end result looks really nice. You can see all three versions here:

http://handbook.event-b.org/

Further, as this is an open project, the code (build scripts) are available. We have a continuous build system (Jenkins) that rebuilds everything when new Latex is checked in. This is particularly nice, as contributors don't need to install the toolchain on their systems. They just check in the new Latex and check on the server whether the HTML was produced correctly. Sources:

http://sourceforge.net/p/rodin-b-sharp/svn/HEAD/tree/trunk/Handbook/org.rodinp.handbook.feature/

Best, Michael

天气好吗我好吗 2024-07-17 18:16:52

我没有足够的观点来评论,但为了支持 plastex 答案,这里是更新的 plastex 示例链接:

http://robfelty.com/2008/03/19/finally-a-better-latex-to-html-converter

I don't have enough points to comment, but to bolster the plastex answer, here is the updated plastex example link:

http://robfelty.com/2008/03/19/finally-a-better-latex-to-html-converter

放肆 2024-07-17 18:16:52

乳胶? 严重地? 我不知道学术界以外的人还在使用它。 我会选择 HTML,您可以从网络浏览器将其另存为 PDF。 如果您确实需要一些高级的排版内容,请使用 Word - 它有一种保存为 HTML 的方法(可能不像人们想要的那么干净),并且您可以使用免费插件(可单独下载)另存为 PDF 。

哦,我不会费心去使用像 InDesign 这样的东西——它们太过分了。 另外,不必费心购买 Acrobat Professional - 有无数的免费解决方案可用。

LaTeX? Seriously? I wasn't aware anyone outside academia still used it. I'd go with HTML, which you can save as PDF from the web browser. If you really must have some advanced typographic stuff, go with Word instead - it has a way to save to HTML (probably not as clean as one would like), and you can save as PDF with a free plug-in (downloadable separately).

Oh, and I wouldn't bother using things like InDesign - they are overkill. Also, don't bother paying for Acrobat Professional - there is a zillion free solutions available.

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