I created a command containing a list of bib files separated by a comma and a space. Then, I give this command to \bibliography, which produce no bibliography.

If I create the same list but only separated by comma (without space), the bibliography is produced.

Here is a MWE:

    \newcommand{\PathBaseBib}{./biblioA.bib, ./biblioB.bib} % this is not working
    %\newcommand{\PathBaseBib}{./biblioA.bib,./biblioB.bib} % this (without space) is working

    \cite{Knuth81} \cite{Lamport94}


So I would like to understand why this simple space make fail the command \bibliogrpahy. And for esthetic reasons, I wonder if it is possible to correct this and so feed \bibliography with a command containing a list with spaces.

  • You shouldn't have to specify the extension .bib in the argument of \bibliography. What happens if you run \newcommand{\PathBaseBib}{biblioA,biblioB}?
    – Mico
    Feb 1 at 17:52
  • From my tests, both are working / not working with spaces. But I admit that I never know when using or not use extensions. So \newcommand{\PathBaseBib}{biblioA,biblioB} will work since there is no space but \newcommand{\PathBaseBib}{biblioA, biblioB} will not.
    – R. N
    Feb 1 at 17:59

1 Answer 1


Since \bibdata, which is written in the aux file, doesn't want spaces in its argument because of how BibTeX reads its input, the standard \bibliography command does \zap@space, but this fails if the argument is a macro.

You can fix this as follows:


\xpatchcmd{\bibliography}{\zap@space #1}{\expandafter\zap@space\expanded{#1}}{}{}

\newcommand{\PathBaseBib}{./biblioA, ./biblioB} % this is not working



\cite{Knuth81} \cite{Lamport94}



This will be written in the .aux file:

\gdef \@abspage@last{1}

and you see that the space has been removed.

Beware that adding .bib to the files is not allowed generally. Only MiKTeX allows it, but it shouldn't.

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.