Skip to content
Philip Cooksey edited this page Jul 19, 2020 · 20 revisions

Installing BibTeX-js

Load BibTeX-js by add one of following to your html code (standard or minified):

<script type="text/javascript" src="https://cdn.jsdelivr.net/gh/pcooksey/bibtex-js@1.0.0/src/bibtex_js.js"></script>
<!-- Or include minified version -->
<script type="text/javascript" src="https://cdn.jsdelivr.net/gh/pcooksey/bibtex-js@1.0.0/src/bibtex_js.min.js"></script>

Place BibTeX file link(s) into <bibtex> tag(s) or insert bibtex text into a (hidden) textarea with id="bibtex_input". They will all be combined together if you use multiple inputs:

<bibtex src="test.bib"></bibtex>
<bibtex src="text1.bib"></bibtex>

<textarea id="bibtex_input" style="display:none;">
@book{book1,
  author = "Donald Knuth",
  title = "Concrete Mathematics"
}
</textarea>

Output will be displayed in the element with id="bibtex_display", add this to HTML:

<div id="bibtex_display"></div>

That's it!

Unless you want to only display a few bibtex entries. Then see the next section.

If you would like finer control or search abilities check out the last section.

Selecting BibTeX Entries

Use the class attribute instead of id for multiple displays. Select entries based on any BibTeX field, i.e, author, title, or our custom field like bibtexkey, see additional BibTeX fields. The value is interpreted as a regex expression letting the selection criteria be very open ended.

Format:

<div class="bibtex_display" field_name="regex expression"></div>

Examples:

Include all BibTeX keys you want displayed with bibtexkey="key1|key2|...|keyN":

<div class="bibtex_display" bibtexkey="sammet2003programming|bauer1998ubersetzung"></div>
<div class="bibtex_display" bibtexkey="parr1995antlr"></div>
<div class="bibtex_display" bibtexkey="wiki:chomskyh|sammet2003programming|parr1995antlr"></div>

Select only certain authors to be displayed:

<div class="bibtex_display" author="Tim Smith"></div>
<!-- or use regex `|` to search for all types -->
<div class="bibtex_display" author="Tim Smith|Smith, T.|Smith, Tim"></div>
<!-- or use regex to limit the display to first author -->
<div class="bibtex_display" author="^(Tim Smith)"></div>

Unless you want to get fancy

Customize how publications are displayed using templates.

Search entries, hide certain bibtex entries, additional bibtex variables, and more with extra functionality.

Clone this wiki locally