# Thin space in bibliography not working with amsmath loaded (biblatex + IEEE style)

Related to GitHub plk / biblatex issue #910.

\documentclass{article}

\usepackage{amsmath}

\usepackage[style=ieee]{biblatex}

\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@Article{A,
title = {A\,b c},
}
\end{filecontents}

\begin{document}
Text~\cite{A}.
\printbibliography
\end{document}


Apart from the incorrect output, compilation with MiKTeX ends with errors: Missing number, treated as zero. \end, Illegal unit of measure (pt inserted). \end.

Can someone provide an idea what to do to allow the usage of thin spaces (\,) in bibliographic titles in documents like the example above?

• This must surely be a bug in biblatex/biber. Have you reported it at this site? – Mico Aug 14 at 0:39
• In the meantime, prefixing \, with \protect, and thus writing the field as title = {A\protect\,b c},, should keep you in business. – Mico Aug 14 at 0:44
• Using \addnbthinspace also works. I agree that biblatex-ieee shouldn't do this though. Interesting, the standard biblatex numeric style works with \,, so it must be something to do with biblatex-ieee. – David Purton Aug 14 at 0:48
• Bug reported as Issue #910. – Peter Aug 14 at 2:21
• Just to notice, some other entry types, for example, @Book, seem to be unaffected by this issue. – Peter Aug 14 at 2:31

biblate-ieee applies \MakeSentenceCase* to titles of some (but not all) entry types. @articles get their title sentence-cased, but @books don't, that explains the observation in the comments.

\MakeSentenceCase is a very complex and fragile macro since string manipulation is somewhat tricky in LaTeX. In particular \MakeSentenceCase performs quite a lot of expansions and tries to iterate through the string one character at a time.

Standard LaTeX defines \, as a robust macro, but amsmath defines

\renewcommand{\,}{\tmspace+\thinmuskip{.1667em}}


which means that \, can be expanded (once) and is not robust (its expansion is robust). This expansion causes some issues in the machinery of \MakeSentenceCase and produces the error you see.

There are several ways to work around this issue.

1. Make \, robust again. Issue

\renewrobustcmd{\,}{\tmspace+\thinmuskip{.1667em}}


after you've loaded amsmath. (Note that \renewrobustcmd needs etoolbox, which in the MWE is loaded by biblatex, so this line should come after loading both amsmath and biblatex.)

2. \protect this \, in the .bib file (as suggested by Mico in the comments)

@article{A,
title = {A\protect\,b c},
}

3. Use a different command that is still protected (as suggested by David Purton in the comments), for example biblatex's \, equivalent \addnbthinspace.

@article{A,
}

4. You can always 'hide' parts of the string from \MakeSentenceCase with curly braces.

@article{A,
title = {A{\,}b c},
}


works, but I'm not sure if I would recommend it.

Here is an MWE to test the solutions without biblatex-ieee.

\documentclass{article}

\usepackage{amsmath}
\usepackage[style=numeric]{biblatex}

\DeclareFieldFormat{titlecase}{\MakeSentenceCase*{#1}}

\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@article{A,
title = {A\,b c},
}
\end{filecontents}