TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I stumbled upon these two spacing errors (marked with red numbers): enter image description here

I guess the first space is not really an error, but simply English spacing (\nonfrenchspacing). Can it be turned off (without changing the language)? \frenchspacing does not seem to have an effect on the references.

But I don't understand where the second spacing error is coming from. Has anyone got a clue?

Here is the code:


\usepackage[style=apa, backend=biber,doi,url]{biblatex}

@article {Thomas1975,
  author = {Thomas, Ewart and Weaver, Wanda},
  title = {Cognitive processing and time perception},
  journal = {Attention, Perception, \& Psychophysics},
  issn = {1943-3921},
  pages = {363--367},
  volume = {17},
  doi = {10.3758/BF03199347},
  year = {1975}




Without beamer (\documentclass{article}) everything looks fine:

enter image description here

share|improve this question
There is no foobar key in your literature.bib – Seamus May 24 '12 at 14:28
The second space is definitely a spurious space. But I'm not sure about the first. That might not be an error. (I can't select only half the space…) – Seamus May 24 '12 at 14:33
Does the second space appear without beamer? – PLK May 24 '12 at 14:44
Without beamer everything is fine. – deboerk May 24 '12 at 14:56
@JosephWright The spurious space after the title goes away if you remove \newblock\usebeamercolor[fg]{bibliography entry note} in \apptocmd{\abx@macro@title} from beamerbaselocalstructure.sty. The standard styles don't appear to have this problem, though. – Audrey May 24 '12 at 15:17
up vote 7 down vote accepted

The spacing and punctuation issues are associated with patches beamer applies to biblatex bibliography macros for changing colours within bibliography items. These can be found in beamerbaselocalstructure.sty.

Extra whitespace in the first problem is associated with \usebeamercolor. This can be resolved by issuing biblatex's \unspace.

To solve the second problem we can set punctuation before changing the colour. This will suppress any spurious punctuation generated by \newunit or \setunit in the existing drivers and bibliography macros.

Here are some revised patches demonstrating these ideas. A new patch for the labeltitle bibliography macro handles the case where author-year styles use label or labeltitle as a fallback for labelname.

        \usebeamercolor[fg]{bibliography entry author}}{}{}
       {\ifboolexpr{ test {\ifcsundef{abx@field@label}}
          and test {\ifcsundef{abx@field@labeltitle}} }{}{\let\bbx@tempa\labelnamepunct}}{}{}
        \bbx@tempa\newblock\unspace\usebeamercolor[fg]{bibliography entry title}}{}{}
        \newblock\unspace\usebeamercolor[fg]{bibliography entry note}}{}{}}

Instead of editing the beamer style file, you can modify the existing patches just after \begin{document}.


  {\ifboolexpr{ test {\ifcsundef{abx@field@label}}
     and test {\ifcsundef{abx@field@labeltitle}} }{}{\let\bbx@tempa\labelnamepunct}}{}{}
  {\newblock\usebeamercolor[fg]{bibliography entry title}}
  {\bbx@tempa\newblock\unspace\usebeamercolor[fg]{bibliography entry title}}{}{}
  {\newblock\usebeamercolor[fg]{bibliography entry note}}
  {\newblock\unspace\usebeamercolor[fg]{bibliography entry note}}{}{}

Here's your entry printed with some different bibliography margins.

enter image description here

The patches appear to give the desired effect for standard biblatex styles, but thorough testing is needed. The solution doesn't resolve issues for a few (hopefully edge) cases in biblatex-apa. These include entries that don't have any data to form a label (i.e. labelname, label, labeltitle and labelyear all missing) and biblatex-apa's overriding of useeditor and friends per-entry option settings (e.g. britannica in the above document).

Unresolved issues are probably worse for some other contributed styles. Surely beamer can't account for all of them. Perhaps the best approach is to have style authors tailor the patches as needed.

share|improve this answer
I'll take a look at this. Note that \usebeamercolor does not add any space per se: it's the whatsit that is the issue. – Joseph Wright May 25 '12 at 9:29
@Audrey: I tried to apply your patch, but I couldn't make it work. I looked at the related question you linked and removed the first two lines with their corresponding curly brackets. Then I put the code right behind \begin{document} between \makeatletter and \makeatother. The code caused no error, but made no change either. Could you perhaps give an example of how to apply your patch on my example given above? Thank you! – deboerk May 25 '12 at 9:31
@JosephWright OK. I corrected the sentence, but feel free to edit it further to clarify. – Audrey May 25 '12 at 13:46
@deboerk Inside the document, you have to work with the edits made from the existing patches. I added an example. – Audrey May 25 '12 at 13:47

The problem here is one that I suspected could occur: adding beamer colours to bibliographies is something of a hack, and is more risky with biblatex than with traditional BibTeX styles.

When adding to biblatex styles, we have to target the drivers 'during' the formatting: with traditional BibTeX, it's essentially done 'after' the formatting. That's an issue because the formatting produced by biblatex depends on the output, but the colour-control inserts affect that. For example, the standard biblatex set up is

    test {\iffieldundef{title}}
    test {\iffieldundef{subtitle}}

whereas for the apa style it's


The important line here is \setunit{\addspace}: it will insert a space 'after' the current material. Unfortunately, the colour code is seen as 'output' by biblatex (there is a whatsit in the output stream, which prevents biblatex 'seeing' what is going on).

Now, the question is what to do about this. I'm not sure there is a general fix, as the appropriate place to insert the colour code depends on the biblatex driver in use. So perhaps the best thing that can be done is to offer an option not to add in any colours.

share|improve this answer
I would appreciate an option to turn off colors for the references. At the moment I always have to adjust the beamer theme and color everything black. – deboerk May 25 '12 at 9:20

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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