I declare sections and subsections as such in my document:
\section{1}
\label{sec:1}
\subsection{a}
\label{sec:1a}
These are formatted using the titlesec package to display "Problem 1" and "Part a" respectively.
When I reference a given subsection using the \ref{label}
command, it displays something like 1.1
, which are clearly the values of the section/subsection counters. What I want however, is to display something like 1a
in references, where the1
and the a
respectively take their values from the section/subsection names. I have tried using the nameref package to do this, but it only displays the a
part, and there doesn't seem like a way to have the name of the section (containing the subsection) printed as well.
Any suggestions are welcome — either in raw LaTeX, modifying \nameref
, or using some other package.
Best Answer
With my comment in mind, here's a patch for
\nameref
which will combine the names of two sectioning levels:I hope it is clear that this is not very general, but it answers your exact question. It sould be possible to generalize it further.
Edit
Patch when
titlesec
is used...