TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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

As stated in the original title of the thread, I would like to use a reference number inside a section name.

Actually, it is to refer using the structure like

\section{Data related to Figure~\ref{fig:XY}}

The MWE for what I want is:

\chapter{I want to use ref~\ref{c:First} here }\label{c:Second}
\section{Dummy section}
\section{Dummy section in new page}

I tried to run such file into LuaLaTeX several times, since I am using it for my actual project. The related line in log output is

LaTeX Warning: Reference `C:FIRST' on page 4 undefined on input line 16.

The PDF file is generated, but the chapter name in page 4 becomes


I tried to find a possible duplicate, but I didn't find. Thanks in advance.

share|improve this question
up vote 2 down vote accepted

The problem is that \MakeUppercase, that is used for the page headers, also converts the argument of \ref. A protected macro could be defined to prevent this:

\chapter{I want to use ref~\refcfirst\ here}
share|improve this answer
Thank you very much.It solved my issue. Just to complement, even if is sounds obvious (well, for me it wasn't at first): the robust declaration must be done before begin document. – AYHarano Jan 23 '13 at 17:35

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.