0

There's a nice workaround for the titlesec/nameref conflict here but I'm finding it doesn't work for the memoir class. Below is my MWE that works for the book class.

\documentclass{book}
% \documentclass{memoir}

\usepackage{titlesec} \usepackage{hyperref} \makeatletter \newcommand\setcurrentname[1]{\def@currentlabelname{#1}} \newcommand{\labelledsection}[2]{\section*{#1}\setcurrentname{#1}\label{#2}} \makeatother

\begin{document}

\chapter*{Unnumbered Chapter}\setcurrentname{Unnumbered Chapter}\label{chap:unnumbered} \labelledsection{Unnumbered Section}{sec:unnumbered} Check \nameref{sec:numbered}.

\chapter{Numbered Chapter} \label{chap:numbered} \section{Numbered Section} \label{sec:numbered} Check \nameref{sec:unnumbered}.

\end{document}

The MWE generates text that correctly refs the section:

enter image description here

But if I switch to the memoir class it refs the chapter?:

enter image description here

  • 1
    well I wouldn't use titlesec with memoir. memoir has lots of own configuration options, and finding how who is changing what is a rather challenging. – Ulrike Fischer May 18 '23 at 15:04

0 Answers0