-
Notifications
You must be signed in to change notification settings - Fork 6
Closed
Description
I have to use a class with titlesec and unnumbered sections, but I want to (name)reference a section, which does not work. After some debugging I found out that the issue originates from titlesec.
I don't really understand what it does, but at the titleformat directive, the documentation says "Both 〈label 〉 and 〈sep〉 are ignored in starred versions of sectioning commands".
Is it possible to use unnumbered namerefs ant titlesec at the same time?
Thanks,
MWE:
\documentclass[12pt]{article}
\usepackage[T1]{fontenc}
\usepackage{hyperref}
\usepackage{titlesec}
\titleformat{\section}[hang]
{\usefont{T1}{qhv}{b}{n}}
{}
{0em}
{\hspace{-0.4pt}\Large \thesection\hspace{0.6em}}
\titleformat{name=\section,numberless}[hang]
{\usefont{T1}{qhv}{b}{n}}
{}
{0em}
{\hspace{-0.4pt}\Large}
\begin{document}
\section*{Unnumbered section}
\label{sec:un}
Some text
\section{Numbered section}
\label{sec:n}
Some text, ref unnumbered (\nameref{sec:un}) and numbered (\ref{sec:n}, \nameref{sec:n})
\end{document}N.B.: hyperref implicitly includes nameref package, that provides \nameref.
Metadata
Metadata
Assignees
Labels
No labels