# Using babel and cleveref causes unnecessary horizontal space in header

## Update

This bug has been fixed with version 0.18.9 of cleveref, which is currently on ctan.

## Question

Babel and cleveref do not seem to work flawlessy together when they share the same language option. In the MWE, the output of Some text\leftmark in the main text should be equal to Some text1 Chapter, but there is an extra space in front of 1 Chapter. In the header, this has the effect that its text is not inline with the body text. Interestingly, this problem disappears when babel uses another language option, eg. english.

## MWE

\documentclass{scrbook}

\usepackage[spanish]{babel}
\usepackage[spanish]{cleveref}

\begin{document}
\chapter{Chapter}
\clearpage
\noindent Some text\leftmark
\end{document}

-

It's a bug in cleveref. If I change line 4516 of cleveref.sty from

4516   \PackageInfo{cleveref}{loaded spanish' language definitions}


into

4516   \PackageInfo{cleveref}{loaded spanish' language definitions}%


the space disappears.

This is common with all the other languages and should require a bug fix.

As a temporary workaround you can say

\documentclass{scrbook}

\usepackage[spanish]{babel}
\usepackage[spanish]{cleveref}

\usepackage{etoolbox}
\AtBeginDocument{
\patchcmd{\extrasspanish}
{\PackageInfo {cleveref}{loaded spanish' language definitions} }
{}{}
}

\begin{document}

\chapter{Chapter}
\clearpage

\noindent Some text\leftmark

\end{document}


Really minimal example

\documentclass{article}

\usepackage[spanish]{babel}
\usepackage[spanish]{cleveref}

\begin{document}
X\foreignlanguage{spanish}{X}X
\end{document}


The output, without the correction, is

X XX

With the correction it is

XXX

-
Thanks for the quick help egreg. I am going to report the author this bug, if you haven't already done so. –  maetra Jan 29 '13 at 17:13
@maetra Please, do. –  egreg Jan 29 '13 at 17:15
According to the author, this bug should be fixed in the next release of cleveref. –  maetra Jan 31 '13 at 12:48