2

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}

enter image description here

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?

3
  • 2
    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).
    – moewe
    Mar 13 '19 at 11:20
  • @moewe Correct! how anti-climactic. I should have thought about newlines!
    – kabanus
    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...)
    – moewe
    Mar 13 '19 at 11:23
5

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}

enter image description here

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.