# Missing Semi-colons for Citation via BibLaTeX

I'm writing my first LaTeX document using Texmaker v5.0.2 and Windows 10.

I'm using bibLaTeX to do my references, which must be in APA 6th edition. The closest style to APA built in bibLaTeX I could find is authoryear, as per my preamble:

\documentclass[11pt, twoside]{article}

%document foramtting
\usepackage[margin = 2.5cm]{geometry}

%math packages
\usepackage{amsfonts,mathtools,amssymb, amsthm}
\numberwithin{equation}{subsection}
\usepackage{xfrac}

\usepackage[none]{hyphenat}
\usepackage{gensymb}
\usepackage{changepage}
\usepackage{xcolor}

%Figure and table packages
\usepackage{booktabs,caption}
\usepackage[flushleft]{threeparttable}
\usepackage{graphicx}
\usepackage{float}
\usepackage{tabularx}

%Referencing package
\usepackage[
backend=biber,
citestyle = authoryear-comp,
bibstyle = authoryear,
url = true,
doi = true,
natbib = true
]{biblatex}

%math foramtting
\newtheorem{theorem}{Theorem}[section]
\newtheorem{lemma}[theorem]{Lemma}
\newtheorem{corollary}{Corollary}[theorem]
\theoremstyle{definition}
\newtheorem{definition}{Definition}
\renewcommand{\baselinestretch}{1.3}
\renewcommand{\arraystretch}{1.5}


This works just fine for citations outside of figure captions and the bibliography. However, for citations within figure captions, the semi-colons are not appearing in the compiled PDF document.

Here's an example of one of my source code figure captions:

\begin{figure}[t] \label{fig1}
\begin{center}
\fbox{ \includegraphics{Figures/Figure-1-with-text.png} }
\end{center}
\caption{Bla bla bla. Created using \citep{DrawGraph,PaintThreeD}.}
\end{figure}


And here's what it looks like in the PDF document: -

"Figure 1: Bla bla bla. Created using (Kummer, n.d. Microsoft, 2017)."

Any ideas?

Regards,

A LaTeX Novice

• The closest style to APA is biblatex-apa. Use it as style=apa instead of citestyle = authoryear-comp, bibstyle = authoryear, url = true, doi = true,. Generally, it is a good idea to use a short caption for captions with citations: \caption[Bla bla bla]{Bla bla bla. Created using \citep{DrawGraph,PaintThreeD}.}. – moewe Jul 20 '18 at 5:07
• Unfortunately I can not reproduce your issue with the code you have posted so far. Please post a complete, yet minimal document that reproduces the problem with as little code as possible. This is sometimes called an MWE (I've just been asked to write a minimal example, what is that?). To make sure that the code you posted can be compiled and gives the output you think, please test it in a new, empty directory before you submit the code. – moewe Jul 20 '18 at 5:11
• @moewe I tried the style = apa but I get "Undefined control sequence" errors for citations that have multiple arguments, e.g. \citep{DrawGraph,PaintThreeD}. I'll get an MWE done ASAP. – Harrison O Jul 20 '18 at 6:41
• Delete the auxiliary files and try again. You will need to tell us which control sequence is undefined. Have a look at my answer before you provide an MWE. Maybe I already guessed correctly. But please consider providing a complete MWE in the future when you post your question and not on request. – moewe Jul 20 '18 at 6:42
• Please ask a new question for the new issue. The question about the semicolon is a different one and (I believe) has been answered. If you have a problem with biblatex-apa that is a different issue. So please open a new question. Please include the relevant content of your .bib file, otherwise we can not reproduce the output you see. – moewe Jul 20 '18 at 7:04

First off: This answer involves a bit of crystal ball gazing. Please post a complete, yet minimal document that other people can copy, paste and compile without further ado for questions like this in the future. See I've just been asked to write a minimal example, what is that?, How to write a MWEB (Minimal working example with Bibliography)? and Why does TeX require such elaborate MWE:s.

If you want to follow APA style, you should definitely consider using biblatex-apa. biblatex-apa is to my knowledge the most comprehensive implementation of the APA citation and bibliography style for LaTeX.

Please keep in mind that biblatex-apa has to do hard work to implement requirements of the APA. This means that the code of the style is quite complex and that it can be extremely difficult to modify its behaviour even for things that "should be easy". So only use biblatex-apa if you follow APA style or a very lightly modified version of APA style.

In general biblatex does not swallow a semicolon between two citations. Neither in the \caption nor anywhere else.

\documentclass[british]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{babel}
\usepackage{csquotes}
\usepackage{graphicx}
\usepackage{duckuments}

\usepackage[style=authoryear, backend=biber]{biblatex}

\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@book{appleby,
author  = {Humphrey Appleby},
title   = {On the Importance of the Civil Service},
}
\end{filecontents}

\begin{document}
\cite{appleby,sigfridsson}

\begin{figure}
\centering
\includegraphics{example-image-duck}
\caption{A duck. Created by \cite{appleby,sigfridsson}}
\end{figure}

\printbibliography
\end{document}


I happened to come across this old question of yours: \cite{} via apacite package not working. And the code you posted there could explain what you are seeing here.

The entry without year is written as

@online{DrawGraph,
author      = {Kummer, J.},
year        = {n.d.},
title       = {Draw Function Graph},
url         = {https://rechneronline.de/function-graphs/},
lastchecked = {2018-01-05},
}


And indeed the MWE

\documentclass[british]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{babel}
\usepackage{csquotes}

\usepackage[style=authoryear, backend=biber]{biblatex}

\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@book{appleby,
author  = {Humphrey Appleby},
title   = {On the Importance of the Civil Service},
}
@online{DrawGraph,
author      = {Kummer, J.},
year        = {n.d.},
title       = {Draw Function Graph},
url         = {https://rechneronline.de/function-graphs/},
lastchecked = {2018-01-05},
}
\end{filecontents}

\begin{document}
\cite{appleby,sigfridsson}

\cite{DrawGraph,sigfridsson}
\end{document}


reproduces the issue

What is happening here? biblatex has a very sophisticated mechanism to avoid double punctuation. Some (many?) languages have rules that forbid two punctuation marks to follow each other except in specific situations. You will never see ,. or ;. in those languages. The . has two meanings in some languages: (1) it signifies the end of a sentence (a full stop or period, .) or (2) it marks an abbreviation (a dot, in the following shown as * to avoid confusion with the sentence-ending .). A full stop normally can not occur together with other punctuation: .,, .; as well as ,. and ;. are ruled out. The abbreviation dot can occur in some of these combinations: *,, *; are OK, but *. is normally suppressed to only give ..

The double role of . is not only a problem for the explanation above, it also is one for biblatex. biblatex does not know which of the two roles a . that you type in plays. Is it a full stop or a dot? biblatex solves this by always assuming a . is a sentence-ending full stop. Full stops can be turned into abbreviation dots if necessary with \isdot.

That means that the n.d. in your year field ends in a full stop. biblatex then suppresses the undesired double punctuation .; to only ..

The solution here is simple. Leave out the year field if there is no date and let biblatex handle it. biblatex automatically adds 'n.d.' (or a localised version of that string) if no date is present. If you have a dot in a string that is recognised as a full stop you can either add \isdot to tell biblatex the period is a dot

n.d.\isdot


or use a biblatex to immediately typeset a dot

n.d\adddot