Siarhei Khirevich's site

# Tips on Writing a Thesis in LaTeX

## Biblatex customization

This section continues the discussion of the employed biblatex settings started previously. The package biblatex was activatedcompiling the document using biblatex with the options
below requires custom-numeric-comp.bbx and
custom-numeric-comp.cbx files; link to the last
one can be found in "Footnote citation" section
as

\usepackage[hyperref=true,
url=false,
isbn=false,
backref=true,
style=custom-numeric-comp,
citereset=chapter,
maxcitenames=3,
maxbibnames=100,
block=none]{biblatex}

and all except last package option are described in Biblatex section. The last option, block=none, controls the spacing between "blocks". In terms of biblatex, a "block" is usually (but not always) identical to the field of the bibliographic entry (such as title, author, year, and etc.). If you want to determine exact bounds of the blocks, you should check a .bbx file corresponding to the employed bibliographic style, and .bbx files can be found in the \$miktex_home_dir\tex\latex\biblatex\bbx directory. Employed citation stylewell, the code above activates not numeric-comp style but
its customized version, custom-numeric-comp — see
the next paragraph for details
numeric-comp uses numeric-comp.bbx file, and this file contains a few commands including \RequireBibliographyStyle{numeric}, which points to another *.bbx file, numeric.bbx. Again, \RequireBibliographyStyle{standard} in numeric.bbx points to the standard.bbx, where one can finally find bounds of blocks defined with \newblock command, and these bounds are specific for each bibliographic entry type (such as article, book, inproceedings, etc.), declared using \DeclareBibliographyDriver{entrytype}{...} command.

Second mandatory parameter of \DeclareBibliographyDriver{entrytype}{...} (group of commands enclosed by the second pair of curly brackets {...}) defines a punctuation and relative position of blocks, or, in other words, in which order authors, pages, publication year, etc. appear in the bibliography. I did change the default biblatex order of blocks, and for this purpose created custom-numeric-comp.bbx file containing edited version of default \DeclareBibliographyDriver{entrytype}{...} settings taken from standard.bbx. File custom-numeric-comp.bbx (can be placed in the directory of .tex file to be compiled) contains the only settings for entry types I used in my thesis. Appearance of each entry in the final document together with the corresponding entry fields from .bib file are given below:

1. article
@article{Maier2000,
author = {Maier, R. S. and Kroll, D. M. and Bernard, R. S. and Howington, S. E. and Peters, J. F. and Davis, H. T.},
doi = {10.1063/1.870452},
journal = {Physics of Fluids},
shortjournal = {Phys. Fluids},
pages = {2065--2079},
title = {Pore-scale simulation of dispersion},
volume = {12},
year = {2000}
}
2. book
@book{Giddings1965,
author = {Giddings, J. C.},
isbn = {0824712250},
publisher = {Marcel Dekker},
title = {Dynamics of chromatography: principles and theory},
year = {1965}
}
3. booklet
@booklet{BrioCartridges,
author = {Nanostream},
title = {Brio Cartridges},
}
4. inbook
@inbook{Weber1989,
author = {Weber, S. G. and Carr, P. W.},
title = {High Performance Liquid Chromatography},
editor = {Brown, P. R. and Hartwick, R. A.},
publisher = {John Wiley \& Sons},
chapter = {1},
year = {1989}
}
5. incollection
@incollection{Khirevich2010t,
author = {Khirevich, S. and Daneyko, A. and Tallarek, U.},
title = {Simulation of fluid flow and mass transport at extreme scale},
booktitle = {J\"ulich Blue Gene/P Extreme Scaling Workshop 2010},
editor = {Mohr, B. and Frings, W.},
address = {Forschungszentrum J\"ulich, J\"ulich Supercomputing Centre},
year = {2010}
}
6. inproceedings
@inproceedings{Frings2009,
address = {New York, NY, USA},
author = {Frings, W. and Wolf, F. and Petkov, V.},
booktitle = {Proceedings of the Conference on High Performance Computing Networking, Storage and Analysis},
title = {Scalable massively parallel I/O to task-local files},
year = {2009}
}
7. manual
@manual{IBM2005,
organization = {IBM Corporation},
title = {Engineering and Scientific Subroutine Library for Linux on POWER, Version 4 Release 2.2},
edition = {4},
year = {2005}
}
8. phdthesis
@phdthesis{Kuzmin2009,
author = {Kuzmin, A.},
school = {University of Calgary},
title = {Multiphase simulations with lattice Boltzmann scheme},
year = {2009}
}

In some cases the choice of the entry fields and block locations is not optimal: for example, Nanostream in booklet entry type should be described as organization (similar to IBM Corporation in manual) and not typeset with small capitals; appearance (order) of phdthesis entry fields in the document would look better as "Author, Title, Phd thesis. University, Country, Year". Hence, the citation scheme I used may be improved in this respect.

Going back to the biblatex customization, the settings in file custom-numeric-comp.bbx define mutual location of blocks and corresponding interblock punctuation (using \addcomma and \addperiod). In some cases adjustments for individual parts of the block may be desirable: for example, I did not specify issue number in case of article entry type (assuming that volume number will be enough), and did this redefining the standard biblatex journal+issuetitle macro (see bottom of custom-numeric-comp.bbx), which is used in \DeclareBibliographyDriver{entrytype}{...}. Three files containing all the necessary macroses are bbx\biblatex.def, standard.bbx, and lbx\english.lbx (located in miktex_home_dir\tex\latex\biblatex\bbx).

Edition number of the cited document is translated by biblatex into the ordinal number as

@book{Kernighan1988,
author = {Kernighan, B. W. and Ritchie, D. M.},
edition = {2},
...
}

where integer edition value 2 from .bib file is printed as "2nd". I have decided to typeset the text suffixes ("nd" in the example above) as superscripts, and did this creating .lbx file (such files contain biblatex language-specific/localization commands), custom-english-ordinal-sscript.lbx, where I placed the original formatting command taken from lbx/english.lbx with added biblatex wrapper \mkbibsuperscript{...}. After this custom-english-ordinal-sscript.lbx file was activatedbefore activation don't forget to copy
custom-english-ordinal-sscript.lbx
into the home directory of .tex file you compile
in the document preamble and the desired result was obtained:

\DeclareLanguageMapping{english}{custom-english-ordinal-sscript}

As you (probably :) see, spacing between the ordinal and "ed." is taken from the default biblatex version, and should be slightly reduced simply because superscript occupies less space. This was done placing the following command in the document preamble:

\DeclareFieldFormat{edition}%
{\ifinteger{#1}%
{#1\isdot}}

where I have added a simple modification to the standard biblatex macro edition (defined in biblatex.def), replacing non-breakable space ~ with its thin "breakable:)" version \addthinspace{}. Besides the space reduction, this modification may result in typesetting of the ordinal and "ed." on different text lines, and can be avoided using non-breakable thin space \addnbthinspace{}.

After adding the adjustments discussed above, biblatex produced record in the bibliography which looked like this (shown without the reference number in square brackets):

where green and blue text color denote web- and in-document hyperlinks, respectively, produced by default by biblatex and hyperref packages. It is common practice to apply different font styles to the text blocks forming the reference record in order to typographically differentiate them. I have modified the following aspects of the record above:

1. Author names were printed with small capitals, using the following commands in the document body (after \begin{document}):
% prints author names as small caps
\renewcommand{\mkbibnamefirst}[1]{\textsc{#1}}
\renewcommand{\mkbibnamelast}[1]{\textsc{#1}}
\renewcommand{\mkbibnameprefix}[1]{\textsc{#1}}
\renewcommand{\mkbibnameaffix}[1]{\textsc{#1}}

This group of commands has effect on author names (but not conjunction "and") which are located after it; in my thesis I have placed these commands directly before \printbibliography command resulting in small caps author names only in bibliography but not in the main text, which was done to avoid any additional visual emphasis (due to small caps) on the footnotes:

% main text
% bibliography
2. Period at the very end of a record (i.e., after “(See p. 62)”) was removed

% document preamble
% removes period at the very end of bibliographic record
\renewcommand{\finentrypunct}{}

assuming the basic bibliographic information ends after "2008", where actually last period has to appear.

3. Period after the doi code ("10.1039/b810688f" here) was removed to make easier selection of the code using mouse pointer and to avoid confusion where the code actually ends, because in some cases doi can be quite messy set of characters and it is difficult to understand if the period belongs to it:

Additionally, I have removed first letter capitalization of "See p…" (i.e., changed it to "see p…"). For these two purposes I have changed separator \newunitpunct which terminates each unit (units are similar to blocks discussed above, and their location defined by \newunit command can be found in the correspondingcustom-numeric-comp.bbx if biblatex
was activated as shown at the beginning
.bbx file):

\renewcommand{\newunitpunct}{\addspace\midsentence}

As you see, \newunitpunct separator was redefined with \addspace and \midsentence macro. While the latter prints nothing, it removes automatic period after each unit and automatic capitalization of the word following the unit marking end of each unit as "middle of sentence" (but not end of it). Hence, one should carefully check the result of this command for all entry types where \newunit macro is involved.

Felix Wenger suggested another way to remove capitalization of "See p…" — in his case the change of separator \newunitpunct produced unwanted results. The solution is to use the \lowercase command in the settings of biblatex in the document preamble:

\DefineBibliographyStrings{english}{%
backrefpage  = {\lowercase{s}ee p.}, % for single page number
backrefpages = {\lowercase{s}ee pp.} % for multiple page numbers
}
4. Further I have added comma and period after the journal title and titles of (in)book/thesis, respectively, while keeping the titles italic, and removed quotation around these titles:

\DeclareFieldFormat{journaltitle}{\mkbibemph{#1},} % italic journal title with comma
\DeclareFieldFormat[inbook,thesis]{title}{\mkbibemph{#1}\addperiod} % italic title with period
\DeclareFieldFormat[article]{title}{#1} % title of journal article is printed as normal text

Just two notes on the code above:

• Optional arguments (like [article] for the last \DeclareFieldFormat command) restricts scope of the command to the entries of corresponding type (i.e., last command will change title appearance of article type only).
• Using \addperiod (instead of ".") will not print (add) period after any punctuation mark while "." does it always; the same applies to \addcomma and ",". This becomes important if you have title entries entered as full sentences ending with period, or, for instance, abbreviated journal titlesabbreviated journal titles were stored in
shortjournal entry field of article
entry type, and used in footnote citation
scheme discussed in the next section
. Illustration (note the comma following two journal titles, abbreviated with and without period):

% footnote citation with \printfield{shortjournal},
% footnote citation with \printfield{shortjournal}\addcomma
5. The journal volume was made bold, and the following comma was replaced with semicolon:

% makes volume of journal bold and adds colon
\DeclareFieldFormat[article]{volume}{\textbf{#1}\addcolon\space}
6. I have removed pagination ("p."/"pp.") which is in my opinion completely unnecessary here due to the presence of number rangesome journals have only single page (or article)
number for each article (e. g. Physical Review),
but they occured in my thesis quite rare to keep
pagination enabled
("1801–1808" in the example) resulting in a straightforward identification of these two numbers as first and last pages of the cited document:

% removes pagination (p./pp.) before page numbers
\DeclareFieldFormat{pages}{#1}

The last figure shows the final appearance of a bibliography record of article entry type in the thesis.

If you likeI hope you came to the bottom of this
page not just by fast scrolling
the information presented on this web site, and would like to support development of this project you may consider buying me a coffee.