clearfield ateverycitekey producing spaces

As the title suggests, using this MCVE:

\documentclass{article}
\usepackage{filecontents}
\usepackage[style=verbose-ibid,backend=bibtex]{biblatex}
\AtEveryCitekey{
\clearfield{location}
\clearfield{publisher}
}

\begin{filecontents}{the.bib}
@article{label,
title = {Best paper ever},
author = {Best author in universe},
location = {Earth},
publisher = {fiend},
date = {0000},
}
\end{filecontents}
\bibliography{the}

\begin{document}
Why the heck is there a space:\cite{label}?
\end{document}


Produces a space between : and the word "Best" from the author field. This space is increased per field cleared. You can verify this space is gone by commenting out the ATEveryCitekey command. This also happens for a numeric cite - the square brackets have additional spacing within.

My current fix is to manually \hspace the citation backwards, but this has to be done for every citation as they are a bit differently indented depending on the bibliographic content!

How do I get \clearfield to stop spacing things?

• Add % to the end of lines in \AtEveryCitekey. See tex.stackexchange.com/q/7453/35864 for an in-depth explanation why that is necessary (also tex.stackexchange.com/q/40946/35864). Mar 13 '19 at 11:20
• @moewe Correct! how anti-climactic. I should have thought about newlines! Mar 13 '19 at 11:22
• Sorry, that the solution is not more exciting. ;-) Do we close this as a duplicate or do you want an answer? (Ah, I see Steven was quicker than me...) Mar 13 '19 at 11:23

I just added % at the end of the \AtEveryCitekey lines, to prevent stray spaces from being introduced.

\documentclass{article}
\usepackage{filecontents}
\usepackage[style=verbose-ibid,backend=bibtex]{biblatex}
\AtEveryCitekey{%
\clearfield{location}%
\clearfield{publisher}%
}

\begin{filecontents}{the.bib}
@article{label,
title = {Best paper ever},
author = {Best author in universe},
location = {Earth},
publisher = {fiend},
date = {0000},
}
\end{filecontents}
\bibliography{the}

\begin{document}
Why the heck is there a space:\cite{label}?
\end{document}


• Yup, thanks, this is it. I did not think about how spacing affect commands. Mar 13 '19 at 11:23