使用 html/css,我想在网站底部自动生成参考书目,类似于 Latex 的 \bibliography 命令
我会先问我的问题,然后为感兴趣的人提供一些背景知识:
我想知道 html 中是否有一个命令可以自动从 .bib 文件生成参考书目?这意味着在整个文本中,我会添加类似 的内容,然后在 html(或 css)文件的底部,我会编写类似 < code>
现在,问题背后的原因是:
我最近开始从使用 Latex 编写所有手稿切换到使用 html/css 编写它们。这种方法的优点是速度快:只有 1 个文件用于版本控制(而不是 .dvi、.ps、.aux、.blg 等),共享时要小得多,其他人可以编辑 html 文件并编译它更容易,它更适合我的口味,更容易在屏幕上阅读,等等。然而,对我来说缺点是,虽然我已经用 Latex 编写了很多年,但我才刚刚开始使用 html 和 css科学文档创建。切换的主要动力是 MathJaX,它使我能够将 Latex 方程嵌入到我的 html 文件中,因此,使我能够将 Latex 的优点与 css 的优点结合起来。我想几乎所有的同事都会从乳胶转向这种更简单的格式,假设一些剩余的问题得到解决,比如易于创建参考书目。
非常感谢。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
你所要求的是不可能的,除非当你指定 html/css 时,你真正的意思是 html/css/php 或 html/css/python 或其他一些包含实际编程语言的组合,而不仅仅是标记语言。
我理解你的动机,我很想切换到 html 而不是 Latex!然而,我怀疑基于 html 的解决方案会涉及到在顶部添加太多额外的处理来整理参考书目等,以至于当您解决所有问题时,复杂性将开始接近 LaTeX 的复杂性。
我很高兴在这一点上被证明是错误的!
What you're asking isn't possible, unless when you specify html/css you really mean html/css/php or html/css/python or some other combination that includes an actual programming language, rather than just a markup language.
I understand your motivation, I'd love to switch to html instead of latex! However, I suspect an html-based solution would involve so much extra processing added on top to sort out bibliographies etc that the complexity would start approaching that of LaTeX by the time you got it all worked out.
I'd be pleased to be proven wrong on this!
我过去曾使用 XSLT 和 BibTeX 完成此操作。概括地说,这些步骤是
Smith99
\itation
命令的.aux
文件.bst
文件,该文件输出 HTML 而不是 LaTeX它并不像听起来那么繁琐,但你可以看看 我是如何在谷歌代码上做到的。特别是,请参阅
structure.xslt
和plainhtml.bst
。如果有更直接的方法,我很想听听。
I've done this, in the past, using XSLT and BibTeX. In outline, the steps are
<span class='citation'>Smith99</span>
.aux
file with\citation
commands in it.bst
file which spits out HTML rather than LaTeXIt's not quite as fiddly as it sounds, but you can look at how I did it on google code. In particular, see
structure.xslt
andplainhtml.bst
.If there's a more direct way, I'd be quite interested to hear about it.
到目前为止,这两个答案都有些正确,尽管不完全符合您的要求。部分问题在于,这个问题的措辞不一定有意义。
HTML 只是标记;你需要一些东西来处理标记,可以是python、php、ruby等。
而且你可能想用XML(或XHTML)而不是HTML编写。
XSLT 可能适合您(一旦采用 XML 格式),但请记住,XSLT 文档定义了一组规则。您将获得一个 XSLT 引擎来对 XML 文档应用 XSLT 规则。
Both answers so far are somewhat correct, although not quite what you were asking for. Part of the problem is that the question as it's phrased doesn't necessarily makes sense.
HTML is just markup; you need something to process the markup, be it python, php, ruby, etc.
And you probably want to write in XML (or XHTML), not HTML.
XSLT may work for you (once it's in XML), but remember, an XSLT document that defines a set of rules. You would get an XSLT engine to apply your XSLT rules against your XML document.
您可以使用 bibtex2html。该包采用一系列命令行参数并从 BibTeX 源中提取信息并输出带有
html
标记的文件。据我所知,你无法让它像 LaTeX
\cite
命令一样读取和解析html
文档,但有几种方法可以指示你想要的引用。我发现最简单的方法是维护我在手稿中使用的 BibTeX 键的文本文件,然后使用--citefile
选项调用它。还有一个名为bib2bib
的工具,可以执行搜索命令。这是一个非常灵活的包,有很多选项,因此它可以在很多情况下使用。例如,您可以让它从输出文件中省略
标头,以便您可以直接粘贴到现有的
html
文档中。该文档很有用,但请务必查看 pdf 文档文件和手册页。
You can create an
html
bibliography from a.bib
file using bibtex2html. This package takes a series of command line arguments and extracts the info from the BibTeX source and outputs a file withhtml
markup.As far as I know you cannot get it to read and parse the
html
document like the LaTeX\cite
command but there are several ways to indicate the references you want. I find that the easiest way is to just maintain a text file of the BibTeX keys I use in my manuscript and then call this using the--citefile
option. There is also a tool calledbib2bib
included that will take search commands.It is a very flexible package and there are a lot of options so it works in a lot of situations. For example you can get it to omit the
<html>
headers from the output file so that you can directly paste into an existinghtml
document.The documentation is useful but make sure you look at the pdf documentation file and the man pages.