17

I've tried searching and can't find this anywhere, but sorry if it's been asked before.

I'm using the memoir class to write a thesis using LaTeX (which I'm fairly new to) and I've got a section in my appendix with some solutions to an equation, so I've titled the section using

\section{Solutions to equation in section~\ref{sec:xxxxx}}

This displays as it should at the start of the section, so the cross-reference isn't broken, but in the header at the top of odd pages the reference doesn't work; it prints as

A.2. SOLUTIONS TO EQUATION IN SECTION ??

I can't find any way to fix this, short of manually changing it using %\sectionmark{} or removing the cross-reference.

Can anyone give me some suggestions?

Edit: It turns out the hyperref package is causing the problems (if I disable that package it works). I need hyperlinks to external websites in the document so I can't disable the hyperref package. I'm looking for solutions online but I'd appreciate any help in the meantime.

EDIT BY LOCKSTEP: Here's a MWE showing the problem. Note that the problem is not related to the memoir class -- it also shows up with article (if one uses \pagestyle{headings}).

\documentclass{memoir}

\usepackage{hyperref}

\begin{document}

\section{foo}\label{sec:foo}

\cleardoublepage

\section{Solutions to equation in section~\ref{sec:foo}}

\end{document}​
James
  • 421
  • 1
    The following example works for me (compile two times!): \documentclass{memoir}\begin{document}\section{foo}\label{sec:foo}\cleardoublepage\section{Solutions to equation in section~\ref{sec:foo}}\end{document}​ – lockstep Feb 24 '13 at 13:03
  • I tried that and it worked, so I gradually added in the packages that I'm using in my thesis and it turns out hyperref is causing the problems (if I disable that package it works). I need hyperlinks to external websites in the document so I can't disable the hyperref package. I'm looking for solutions online but I'd appreciate any help in the meantime. – James Feb 24 '13 at 14:55
  • It looks like it's linked to the fact that the default headers in the memoir class use all uppercase characters - changing the label to uppercase seems to fix it and will be sufficient for me. Thanks for the help with tracking this down! – James Feb 24 '13 at 15:05
  • 1
    I can't self answer yet (needs to be eight hours after my post as I have fewer than 10 reputation points) so I'll add my solution to my orignal post for now. – James Feb 24 '13 at 15:22
  • I forgot about the self-answer limit. Please be sure to revisit tex.sx in a few days and add a self-answer then -- it's not only about my potential upvote, but about maintaining the proper Q+A format (i.e., questions and answers in separate posts). – lockstep Feb 24 '13 at 15:25
  • I don't see how http://tex.stackexchange.com/questions/84487/hyperref-within-hyperref relates to this question. I am not using hyperref and still had this problem. The \nouppercaseheads answer below fixed it. – flamingpenguin Feb 25 '16 at 17:30

1 Answers1

15

It seems to be linked to the fact that the default headers in the memoir class use all uppercase characters - changing the label to uppercase fixes it. Another option is to use \nouppercaseheads to change the headers so they are no longer uppercase.

James
  • 421
  • 7
    This is really crazy! Thank you. I had the same problem. It seems to happen whenever ref is used in section titles that are uppercase. To clarify for anyone else. Change your label from \label{sec:foo} to \label{SEC:FOO}. This solves the problem despite how odd it is. – passerby51 Jan 30 '15 at 23:10