Skip to content

Formatting Authors

Philip Cooksey edited this page Mar 18, 2020 · 6 revisions

Customized Formatting

A detailed understanding on how bibtex processes names can be found here, but for the most part that will be unnecessary.

A name consists of four components: First (for a first name), von (for a particle), Last (for a last name), and Junior (for a suffix).1

These four components are:

<span class="first"></span> <!-- <span class="first_initial"></span> -->
<span class="von"></span>
<span class="last"></span>
<span class="junior"></span>

These four components can be added inside the author span to create various formatting styles. The first_initial component is used to print only the initials of the first name. Note: not all four components needed to be added. If none are added a default behavior for formatting is used and the names will be printed out as they appear in the bib file.

Example (von Last, Jr., First):

<div class="bibtex_template">
     <span class="author"><span class="von"></span> <span class="last"></span><span class="junior">, </span><span class="first">, </span></span>
</div>

Span Formatting

The value (of any of the four components) is added to the end of any text already in the span. The class value remains the same which can be useful when using CSS to format particular parts of names (probably rare but possible. See section below!).

<span class="first">, </span> 
=
<span class="first">, Name</span> 

Attribute bibtex-js-rif (remove if first)

This attribute checks that some author element was printed before otherwise anything inside the span is erased. The example below shows how the the space in the last span is removed when the author of a bib entry only has a last name.

<!-- Author only has a last name: LastName -->
<span class="first"></span><span class="last" bibtex-js-rif> </span>
=
<span class="last" bibtex-js-rif>LastName</span>
<!-- So the space was removed because "last" was first element printed -->

Conjunction Formatting

The conjunction used for the final author in a list of authors can be specified as shown:

<span class="author" conjunction=", and"></span>
or 
<span class="author" conjunction=" et"></span>
or
<span class="author" conjunction=" und"></span>

CSS Formatting

The entire author's name is surrounded by a span with the full author's name in the class attribute. This is very useful for added css formatting to particular author within the bibtex entries.

Example: First Last:

<span class="author"><span class="last"></span></span><span class="first">, </span></span>
=
<span class="author"><span class="First Last"><span class="last">Last</span><span class="first">, First</span></span></span>

CSS can then used to underline and increase the font of any occurrence of the class First Last.

[class="First Last"] {
  font-size: 20px;
  text-decoration: underline;
}

The individual components of each name can be formatted in a similar fashion if needed.

Limit Authors (et al.)

In the class="author" span add the attribute max with the maximum number of authors to print. An appropriate et al. will be added at the end of long author lists. Example:

<div class="bibtex_template">
     <span class="author" max="1"></span>
</div>

Clickable Authors

Adding clickable links around individual authors is as easy as adding <a> around the inner components of the author span. Below is an example that highlights the flexibility of this approach by using the search abilities of BibTex-js within the onclick attribute of the <a> element. Once clicked, the webpage will only show bibtex entries that contain that particular author's name.

<!-- Note: Spacing out for clarity normally keep all your span elements on the same line -->
<div class="bibtex_template">
  <div class="if author">
    <span class="author">
      <a onclick="(new BibTeXSearcher()).searcher(this.innerText || this.textContent, true)">
        <span class="first"></span><span class="last"> </span>
      </a>
    </span>
  </div>
</div>

References

  1. Hufflen, Jean-Michel. “Names in Bib TEX and Ml Bib.” (2006).