General description of the issue
I have an appendix whose section names have to be identical to the names of sections of the main part of the dissertation. Therefore I used the \nameref command of the package nameref.
[...]
\mainmatter
\section{My section name}
\label{mySection}
[...]
\appendix
\section{\nameref{mySection}}
[...]
This works. However, the header of the left page in the book class is supposed to display the name of the first section of the page. When using \nameref, the header displays ?? instead of the section name. Why does it behave so? How can I get around that?
Simple example
As an example, create a new file main.tex containing
\documentclass[10pt,a4paper]{book}
\usepackage{nameref}
\begin{document}
\section{Alice in wonderland}
\label{section:alice}
\pagebreak
a %Dummy text otherwise calling \pagebreak twice only skips one page
\pagebreak %Need to skip two pages, not just one because only the header of the left page of the book class displays the section name, not the one of the right page
%\section{Alice in wonderland} %Writes the header correctly
\section{\nameref{section:alice}} %Header shows "??"
\end{document}
Compile with pdflatex main.tex.
On the top of the third page, the header displays 0.2 ?? instead of 0.2 ALICE IN WONDERLAND.

\nameref{SECTION:ALICE}which does not exist. Dirty fix: write the label in UPPER case. If you look in the log, this is exactly what LaTeX warns. – daleif Feb 12 '18 at 09:55\nameref{}command… Anyway, thanks for linking to those other questions, that's helpful! – Gael Lorieul Feb 12 '18 at 10:26memoirclass, you are using the book class which does not support\nouppercaseheads. But I do recommend using thememoirclass (but then again I'm biased) – daleif Feb 12 '18 at 10:46