# How to get chapter numbers to work in sections with memoir pagestyle{headings} and using babel?

I have a very strange behavior which I have managed to get boil downed into this minimal example. It's probably a bug report for either memoir or babel developers (where should that be sent?) but I thought I should ask here if anyone can help me to get this working. The problem can be seen in page five of the generated document:

I was expecting "Regarding chapter 1" but got "Regarding chapter ??". If I removed the babel package it seems to work... But I need it. Is there other solutions?

\documentclass{memoir}
\usepackage[greek, english]{babel}
\usepackage{lipsum}

\begin{document}
\chapter{Lorem}
\label{one}
\lipsum[1-5]

\lipsum[1-3]
\section{Regarding chapter~\ref{one}}
\lipsum[1-5]

\end{document}

-
I realize that the heading of the question probably is quite long. Feel free to make it better if you see an easy way! (I don't...) –  jonalv Aug 8 '11 at 15:38
Did you compile your document twice? –  Gonzalo Medina Aug 8 '11 at 15:43
This isn't specific to memoir; it happens also with the book class, so it's mainly a babel issue. –  Alan Munn Aug 8 '11 at 15:44
That's interesting. So babel is the problem then. I thought the headings pagestyle was a memoir thing so I didn't bother trying the book class. Is there a workaround though? –  jonalv Aug 8 '11 at 15:53

If you look at the console log, you will find that the error reported is that the label ONE is undefined. Yet your label is one. This shows that the problem is that the label is being converted with \MakeUppercase or its equivalent before the reference is being resolved. A partial solution is to wrap the reference in \lowercase, or make the label all uppercase. I've gone for the latter in the following example.

\documentclass{memoir}

\usepackage[greek, english]{babel}
\usepackage{lipsum}

\begin{document}
\chapter{Lorem}
\label{ONE} % make label uppercase
\lipsum[1-5]

\lipsum[1-3]
\section{Regarding chapter~\ref{ONE}}
\lipsum[1-5]

\end{document}

-

It's caused by the way of using uppercase heading, it affects the reference. An easy workaround would using capital letter labels for cross-references where you know they will be used in capitalized text. You will see it if you write \label{ONE} and later

\section{Regarding chapter~\ref{ONE}}


Surely it can be repaired. Though I recommend not using all caps text but for example \scshape instead.

-