Skip to content

Customizable Template

Philip Cooksey edited this page Feb 1, 2020 · 2 revisions

Customize Publications

The default style for each entry can be specified explicitly using the below template system in you html code.

BibTex Template

BibTeX template defines what each entry will look like when printed.

  <div class="bibtex_template">
  </div>

Print

To print values use the name of a bibtex entry, e.g., year, in the class of an html element. The example below shows how the year can be printed within the bibtex_template.

  <div class="bibtex_template">
    <span class="year"></span>
  </div>

If-else

Check if an entry value year exist before printing the value in the inner span (hidden otherwise). Also check if an entry value doesn't exist !year before printing. This is a simple way of having an if else statement in the bibtex_template.

<span class="if year"><span class="year"></span>,</span>
<span class="if !year">Missing the year,</span>

Operators

Checking for equality would utilize ==, e.g., entrytype == value. The value is case sensitive when determining the equality.

<span class="if BIBTEXTYPEKEY==ARTICLE">Article</span>
<span class="if BIBTEXTYPEKEY==BOOK">Book</span>

Checking or would utilize ||:

<span class="if entrykey1 || entrykey2">Text</span>

Checking and would utilize multiple ifs:

<span class="if entrykey1">
  <span class="if entrykey2">Text</span>
</span>

BibTeX Template Example:

<div class="bibtex_template">
  <div class="if author" style="font-weight: bold;">
    <span class="if year">
      <span class="year"></span>, 
    </span>
    <span class="author"></span>
    <span class="if url" style="margin-left: 20px">
      <a class="url" style="color:black; font-size:10px">(view online)</a>
    </span>
  </div>
  <div style="margin-left: 10px; margin-bottom:5px;">
    <span class="title"></span>
  </div>
</div>

BibTex Structure

BibTeX structure allows for sorting and grouping of entries placed into the templates div (increases run time).

<div class="bibtex_structure">
  <div class="templates"></div>
</div>

Group or sort values along with adding extra information describing information type (string, number, date) and sorting property (ASC, DESC). BibTeX entries that do not contain the grouping value (ex. year) will be added to "Other Publications" at the end of the grouping.

<div class="group year" extra="ASC number"></div>
<div class="sort title" extra="DESC string"></div>

class='group (bibtexkey)'
clase='sort (bibtexkey)'

extra='(ASC|DESC) string'
extra='(ASC|DESC) number'
extra='(ASC|DESC) date'

BibTeX Structure Example:

<div class="bibtex_structure">
  <div class="group year" extra="ASC number">
    <div class="group journal" extra="ASC string">
        <div class="templates"></div>
      </div>
    </div>
  </div>
</div>

Custom Group Headers

Use class='title' within the group div. The example below demonstrates using h2 headers rather than the default h1.

<div class="bibtex_structure">
  <div class="group year" extra="ASC number">
    <h2 class="title"></h2>
    <div class="templates"></div>
  </div>
</div>

Academic Style

Custom sections for grouping your bibtex file by their type class="sections bibtextypekey". Define as many section divs within by their respective types (ex: article). Then create a title for each section as the first element in the section div. You can also use the | to include multiple types for a particular section. Example below demonstrates how to add custom sections and sort by year in descending order:

<div class="bibtex_structure">
  <div class="sections bibtextypekey">
    <div class="section article">
      <h1>Refereed Articles</h1>
      <div class="sort year" extra="ASC number">
        <div class="templates"></div>
      </div>
    </div>
    <div class="section book">
      <h1>Books</h1>
      <div class="sort year" extra="ASC number">
        <div class="templates"></div>
      </div>
    </div>
    <div class="section inproceedings">
      <h1>Conference and Workshop Papers</h1>
      <div class="sort year" extra="ASC number">
        <div class="templates"></div>
      </div>
    </div>
    <div class="section misc|phdthesis|mastersthesis|bachelorsthesis|techreport">
      <h1>Other Publications</h1>
      <div class="sort year" extra="ASC number">
        <div class="templates"></div>
      </div>
    </div>
  </div>
</div>

For more information on the additional capabilities check out the extras.

Clone this wiki locally