# Punctuation after institution and recognizing thesis type in biblatex

I have two problems. I am trying to conform to the bibliography style for a thesis of my university. I decided to switch to biblatex+biber, since .bbl style files are a mystery to me.

I want to create a thesis format that looks like this:

But what I get after a lot of tweaking is this:

Note that my results ends in a comma. It should be a punctuation, as in the first image.

I am using authoryear style and have tried editing the format of the institution with \DeclareFieldFormat. But it does not seem to matter what I do. This will not affect the formatting of the institution field and its trailing comma.

I noticed that thesis is formatted in standard.bbx using the journal+location+date macro. This adds a \addcomma\addspace after the institution. That explains my result. (I suppose it is expecting a date after that)

My first question is, how do I change this to a punctuation mark wheen it is not followed by a date, without affecting any other type that actually should have a comma?

My second question is related to this example.

There are two types of thesis defined in biblatex: mathesis and phdthesis. In my bibfile the type of thesis is specified, both in the entry type field (as in bibtex) and in the type field of the entry. How can I make biblatex check which type it is and print custom text for each? It should be Diss. for phd and Masters thesis for the other. There is also a third one: Licentiate. I suppose I can make that distinguishable as well if I can make biblatex check the type field. But how do I do that? Right now it is simply printing what is in the type field.

My tex skills are not very profound.

This is a MWE of the file I used to create my bibliography:

\documentclass[12pt,a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage{csquotes}
\usepackage[backend=biber,style=authoryear,mincitenames=1,maxcitenam>es=2,maxbibnames=999,%
uniquename=false,uniquelist=false,firstinits=true,sorting=nyt,url=fa>lse,isbn=false,doi=false,%
dashed=false]{biblatex}
\DeclareNameAlias{sortname}{last-first}
\AtEveryBibitem{%
\clearfield{note}%
}
\renewcommand*{\bibinitdelim}{}
\DeclareFieldFormat[article,inbook,incollection,inproceedings,patent,thesis,unpublished]{title}{#1\isdot}
\DeclareFieldFormat
[thesis]
{title}{\mkbibemph{#1\isdot}}
\DeclareFieldFormat[thesis]{pages}{}
\addbibresource{test.bib}
\author{Minime}
\begin{document}
\parencite{Ahlgren2003LCAogras} MasterThesis
\printbibliography
\end{document}


And this is the test.bib file:

@Thesis{Ahlgren2003LCAogras,
Title   = {Environmental impact of chemical and mechanical weed control in agriculture : a comparing study using life cycle assessment methodology},
Author  = {Ahlgren, Serina},
School  = {Swedish University of Agricultural Sciences, SLU},
Year    = {2003},
Address = {Uppsala},
Type    = {Masters thesis},
ISSN    = {1101-0843},
Pages   = {57},
Publisher = {Institutionen för lantbruksteknik},
Url     = {http://www-mat21.slu.se/publikation/pdf/LCAogras.pdf},
Volume  = {2003:05}
}

• You will find that the field publisher is ignored for thesis types. If you also want to mention the department (I assume that is what "Institutionen för lantbruksteknik" is), you will have to cram it into the school field. A volume for thesis is also ignored. – moewe Aug 16 '15 at 8:34
• I know. I have a lot of of superfluous information in my bibliography entries just for the sake of finding the information easily myself, not for printing. – niclas ericsson Aug 16 '15 at 8:50

## 1 Answer

Your first problem comes because you use

\DeclareFieldFormat[thesis]{pages}{}


To delete the pages field. This results in biblatex not printing the pages field, but thinking it did print the field, seriously messing up punctuation tracking, as you see.

A better solution is to use

\AtEveryBibitem{%
\clearfield{note}%
\ifentrytype{thesis}
{\clearfield{pages}}
{}
}


Note that in your example, the problem is that you wrote Pages = {57}, while I'm sure what you actually wanted was pagetotal = {57},.

pagetotal is for "[t]he total number of pages of the work", while pages is for "One or more page numbers or page ranges. If the work is published as part of another one, such as an article in a journal or a collection, this field holds the relevant page range in that other work. It may also be used to limit the reference to a specific part of a work (a chapter in a book, for example).", pp. 21-22 of the biblatex documentation

If you decide to use pagetotal here and want to get rid of that field for all types, go with

\AtEveryBibitem{%
\clearfield{note}%
\clearfield{pagetotal}%
}


If you only want it purged for @thesis, you want

\AtEveryBibitem{%
\clearfield{note}%
\ifentrytype{thesis}
{\clearfield{pagetotal}}
{}
}


For your second question.

You can make use of the three predefined keywords (as explained on p. 216)

mathesis An expression equivalent to the term ‘Master’s thesis’.

phdthesis The term ‘PhD thesis’, ‘PhD dissertation’, ‘doctoral thesis’, etc.

candthesis An expression equivalent to the term ‘Candidate thesis’. Used for ‘Candidate’ degrees that have no clear equivalent to the Master’s or doctoral level.

These can be redefined via

\DefineBibliographyStrings{english}{
phdthesis= {Diss\adddot},
}


You can then define your own keyword for licentiate (if it does not fit candthesis) simply by

\NewBibliographyString{licentiate}{
\DefineBibliographyStrings{english}{
licentiate = {Licentiate thesis},
}


If biblatex cannot find a fitting bibstring for what you fed into the type field, it will just print whatever you wrote.

MWE

\documentclass[12pt,a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage{csquotes}
\usepackage[backend=biber,style=authoryear,mincitenames=1,maxcitenames=2,maxbibnames=999,%
uniquename=false,uniquelist=false,firstinits=true,sorting=nyt,url=false,isbn=false,doi=false,%
dashed=false]{biblatex}

\DeclareNameAlias{sortname}{last-first}

\renewcommand*{\bibinitdelim}{}

\DeclareFieldFormat[article,inbook,incollection,inproceedings,patent,thesis,unpublished]{title}{#1\isdot}

\DeclareFieldFormat
[thesis]
{title}{\mkbibemph{#1\isdot}}

\AtEveryBibitem{%
\clearfield{note}%
\clearfield{pagetotal}%
}

\usepackage{filecontents}
\begin{filecontents*}{\jobname.bib}
@Thesis{Ahlgren2003LCAogras,
Title   = {Environmental impact of chemical and mechanical weed control in agriculture : a comparing study using life cycle assessment methodology},
Author  = {Ahlgren, Serina},
School  = {Swedish University of Agricultural Sciences, SLU},
Year    = {2003},
Address = {Uppsala},
Type    = {mathesis},
ISSN    = {1101-0843},
pagetotal   = {57},
Url     = {http://www-mat21.slu.se/publikation/pdf/LCAogras.pdf},
}
@Thesis{fjae,
Title   = {Unsteady simulations of the turbulent flow in the exhaust system of an {IC}-engine for optimal energy utilization},
Author  = {Johan Fjällman},
School  = {KTH Mechanics},
date    = {2013-06},
Address = {Stockholm},
Type    = {licentiate},
Url     = {http://www.diva-portal.org/smash/get/diva2:624491/FULLTEXT01.pdf},
}
@thesis{geer,
author       = {de Geer, Ingrid},
title        = {Earl, Saint, Bishop, Skald~-- and Music},
type         = {phdthesis},
institution  = {Uppsala Universitet},
date         = 1985,
subtitle     = {The {Orkney Earldom} of the Twelfth Century. {A} Musicological
Study},
location     = {Uppsala},
}
@Thesis{stap,
Title   = {Debian Code Search},
Author  = {Michael Stapelberg},
School  = {Fakultät für Informatik, Hochschule Mannheim},
date    = {2012-12-19},
Address = {Mannheim},
Type    = {BSc Thesis},
Url     = {https://codesearch.debian.net/research/bsc-thesis.pdf},
}
\end{filecontents*}

\addbibresource{\jobname.bib}

\NewBibliographyString{licentiate}{
\DefineBibliographyStrings{english}{
phdthesis= {Diss\adddot},
licentiate = {Licentiate thesis},
}

\begin{document}
\parencite{Ahlgren2003LCAogras,fjae,geer,stap}
\printbibliography
\end{document}


MWE

Here

• @moeve Thankyou, that solved the punctuation issue. There are so many subtle details to learn about biblatex, I haven't got half of them yet. Maybe I should have posted two separate questions. Now I can only mark one as best solution (provided someone answers the second one). That was stupid. – niclas ericsson Aug 16 '15 at 8:28
• @niclasericsson Yes it is always better to ask one question at a time, but I have also tried to answer the second question. Have a look at the edit. I will have to be off now, but maybe I might even add pictures later.... – moewe Aug 16 '15 at 8:31
• Beautifull. That was clear and solved both my problems. I did however have to change \clearfield{pages}to \clearfield{pagetotal} to avoid the pagenumbers from appearing, since they are different field types. Just mentioning for others that may bump in to this. – niclas ericsson Aug 16 '15 at 8:46
• @niclasericsson Chances are you never want the pagetotal field to make an appearance, not just for thesis, so you might as well go with \AtEveryBibitem{% \clearfield{note}% \clearfield{pagetotal} } (modulo line break) – moewe Aug 16 '15 at 9:51