3

I'll ask my question first, then give some background for those who are interested:

I would like to know if there is a command in html that will automatically generate a bibliography from a .bib file? This means that throughout the text, i would add something like <cite name="Jones2010">, and then at the bottom of the html (or css) file, I would write something like <makebib file="biblist.bib", format="APA">, and a bibliography would be generated using my .bib file, and formated according to the APA style. The functionality would be quite similar to footnotes, except that each footnote is populated according to some script that extracts the information from (essentially) an xml file and outputs the content in the desired format. It is not difficult to imagine somebody creating a tool to do just that, however, my google search skills have not enabled me to find such a tool. It is easy to find tools that convert bib files to html or xml, but that is not sufficient for my needs. I do not desire to publish my entire bib file online. Rather, for each document that I generate, I want several of the entries in the bib file to be included as footnotes. Any pointers will be greatly appreciated.

Now, the reason behind the question:

I have recently begun switching from writing all my manuscripts using latex to writing them using html/css. The advantages of this approach are fast: only 1 file for versioning (instead of .dvi, .ps, .aux, .blg, etc.), it is much smaller to share, other people can edit the html file and compile it much more easily, it is more configurable to my tastes, easier to read on screen, etc. The disadvantage for me, however, is that while I've been writing in latex for years, I've only just begin using html and css for scientific document creating. The main impetus for the switch was MathJaX, which enables me to to embed latex equations in my html files, and therefore, allows me to combine the advantages of latex with the advantages of css. I imagine that nearly all my colleagues will switch away from latex to this simpler format, assuming a few remaining issues get resolved, like ease of creating bibliographies.

Many thanks.

4

4 回答 4

1

过去,我使用 XSLT 和 BibTeX 完成了这项工作。概括地说,步骤是

  1. 使用某种约定或其他方式标记您的文档:我使用过<span class='citation'>Smith99</span>
  2. 编写一个 XSLT 脚本,将该文件转换为.aux包含\citation命令的文件
  3. 将 BibTeX 与.bst吐出 HTML 而不是 LaTeX 的文件一起使用
  4. 使用另一个 XSLT 脚本(或相同的,以不同的模式)将参考书目拉入

它并不像听起来那么繁琐,但你可以看看我是如何在谷歌代码上做到的。特别是,参见structure.xsltplainhtml.bst

如果有更直接的方法,我很想听听。

于 2011-02-06T21:22:25.857 回答
1

你问的是不可能的,除非你指定 html/css 你真的是指 html/css/php 或 html/css/python 或其他包含实际编程语言的组合,而不仅仅是一种标记语言。

我理解你的动机,我很想改用 html 而不是乳胶!但是,我怀疑基于 html 的解决方案将涉及在顶部添加大量额外处理以整理书目等,以至于当您完成所有工作时,复杂性将开始接近 LaTeX 的复杂性。

我很高兴被证明是错误的!

于 2011-02-05T23:28:28.160 回答
0

您可以使用bibtex2htmlhtml.bib文件创建参考书目。这个包接受一系列命令行参数并从 BibTeX 源中提取信息并输出带有标记的文件。 html

据我所知,您无法html像 LaTeX\cite命令那样读取和解析文档,但是有几种方法可以指示您想要的参考。我发现最简单的方法是只维护我在手稿中使用的 BibTeX 密钥的文本文件,然后使用该--citefile选项调用它。还有一个名为 include 的工具bib2bib将接受搜索命令。

这是一个非常灵活的包,有很多选择,所以它适用于很多情况。例如,您可以让它<html>从输出文件中省略标题,以便您可以直接粘贴到现有html文档中。

该文档很有用,但请务必查看 pdf 文档文件和手册页。

于 2012-01-12T01:18:48.100 回答
0

到目前为止,这两个答案都有些正确,尽管并不完全符合您的要求。部分问题在于,问题的措辞不一定有意义。

HTML 只是标记;你需要一些东西来处理标记,无论是 python、php、ruby 等。

而且您可能想用 XML(或 XHTML)而不是 HTML 来编写。

XSLT 可能对您有用(一旦它在 XML 中),但请记住,定义一组规则的 XSLT 文档。您将获得一个 XSLT 引擎来针对您的 XML 文档应用您的 XSLT 规则。

于 2011-02-08T12:34:54.990 回答