2

Did someone already waste spend time to research the fllowing:

Which of the hundreds of the available csl files is closest to the bibtex style amsplain (or maybe just plain)?

I.e., ideally exactly the fields as in amsplain should be used, and the fields should be printed in the same order and in more or less the same style.

Note that many csl files seem to ignore the note entry, which would be important to me, but this can be fixed manually; but there might be other fields I am not aware of that might be missing as well? I would ignore the MRNUMBER entry anyway, btw; and it is not important whether URL is handled as in amsplain.

Remark: The reason I am interested in that is the following: I would like to convert bibtex bibliographies to html (using katex), with the output being close to the result I would get with latex and (for example) the amsplain bibstyle. It seems that pandoc would be a good tool for that. (And I might replace the printed url field with a hyperlink, so this will have to be handled seperately anyway.)

Update:

  • Thanks for the suggestion, but I do not want to use bibtex2html. While this is really very fast and robust and true to bibtex, cannot use it as I need katex compatible output. E.g., if I have $a+b$ somewhere in a title, then pandoc --katex --bibliography test.bib test.tex gives ...<span class="math inline">\(a+b\)</span>... which can then be efficiently used with katex to produce beautiful html. bibtex2html produces somehting like ...<em>a</em>+<em>b</em>....
  • Thanks for the linkt to the CSL editor etc. Indeed it seems quite managable to produce something reasonable there. Just for completeness I would like to mentioan another problem I ran into: pandoc-citeproc (which reads the bib file and prepares a pandoc-compatible format from it, before any CSL file comes into play) refuses to parse non-date year entries. As it seems ususal to abuse the bibtex year field with to appear or similar information, it seems that another workaround is required to preserve this infromation. (In my case, I might automatically duplicate every year bibfield to an originalyear field or similar; and then use the orginalyear in the CSL)
  • Wouldn't it be easier to use bibtex2html? bibtex2html -s amsplain bibliography.bib should give you a reasonably formatted bibliography.html – DG' Jan 28 at 11:10
  • Another way would be to search a CLS that isn't to far from the desired output (the online editor has a neat search by example feature) and modify to match your desired output. – DG' Jan 28 at 13:29
3

You can use bibtex2html to produce html output that is very close to the original.

Take this file mweb.tex as input:

\documentclass{article}
\begin{document}

\nocite{*}
\bibliographystyle{amsplain}
\bibliography{mweb}

\end{document}

And this sample bibliography (mweb.bib):

@article{einstein,
    author = "Albert Einstein",
    title = "{Zur Elektrodynamik bewegter K{\"o}rper}. ({German})
    [{On} the electrodynamics of moving bodies]",
    journal = "Annalen der Physik",
    volume = "322",
    number = "10",
    pages = "891--921",
    year = "1905",
    DOI = "http://dx.doi.org/10.1002/andp.19053221004",
    keywords = "physics"
}

@book{dirac,
    title = {The Principles of Quantum Mechanics},
    author = {Paul Adrien Maurice Dirac},
    isbn = {9780198520115},
    series = {International series of monographs on physics},
    year = {1981},
    publisher = {Clarendon Press},
    keywords = {physics}
}

@online{knuthwebsite,
    author = "Donald Knuth",
    title = "Knuth: Computers and Typesetting",
    url  = "http://www-cs-faculty.stanford.edu/~uno/abcde.html",
    addendum = "(accessed: 01.09.2016)",
    keywords = "latex,knuth"
}

@inbook{knuth-fa,
    author = "Donald E. Knuth",
    title = "Fundamental Algorithms",
    publisher = "Addison-Wesley",
    year = "1973",
    chapter = "1.2",
    keywords  = "knuth,programming"
}

And you will have this output:

enter image description here

Now execute bibtex2html:

$ bibtex2html -s amsplain -nobibsource -nokeywords -nolinks -nodoi -a mweb.bib

The output is quite close to the pdf:

enter image description here

With the option -nobib you can output a table containing only the citation entries, which look like this:

<tr valign="top">
<td align="right" class="bibtexnumber">
[<a name="einstein">2</a>]
</td>
<td class="bibtexitem">
Albert Einstein, <em>Zur Elektrodynamik bewegter K&ouml;rper. (German)
  [On the electrodynamics of moving bodies]</em>, Annalen der Physik <b>322</b>
  (1905), no.&nbsp;10, 891--921.

</td>
</tr>
  • Thank you for the answer; however I do not think that bibtex2html is suitable for my needs: It does not seem to play well with katex, and it creates a whole webpage (which I then would have to parse to cut out the citation, which does not seem very "stable") – Jakob Jan 29 at 7:25
  • @Jakob bibtex2html has the option -nodoc to generate only a table containing the citation entries, which can be easily processed further. Maybe you can integrate in your workflow. If not: There is always the possibility to create a custom CSL → editor.citationstyles.org/visualEditor – DG' Jan 29 at 13:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.