# Different labels for subsection titles and references

I am constructing my thesis, and am using a variant of the report class. I have chapters, sections, subsections, and subsubsections in places. When reading the text, having a long string of numbers, letters, and roman numerals in the title for subsections and subsubsections is unpleasant-looking. I would prefer these titles to just have the relevant subsection or subsubsection title, and do so using:

\renewcommand\thesubsection{\Roman{subsection}}


(Depending on how things end up looking, I may include the section counter, but I'll definitely strip off the chapter counter.) However, when I make a reference to the subsection or subsubsection, I would much prefer the entire string of numbers to be used, otherwise the reference is poorly defined. Can anyone comment on how to do this?

Here is a minimal example.

\documentclass{report}

\begin{document}

\renewcommand\thesection{\arabic{chapter}.\arabic{section}}
\renewcommand\thesubsection{\Roman{subsection}}

\chapter{Chapter}

\section{Section}

\subsection{Subsection}\label{subsection}

\noindent I have the subsections labelled in Roman in the title, because 1.1.I would just be long.
\\

\noindent Here is a reference to the subsection: (\ref{subsection})
\\

\noindent I would like references to the subsection to be (1.1.I), however.

\end{document}

-

Redefine \p@subsection (the prefix using for the references to subsections):

\documentclass{report}

\renewcommand\thesection{\arabic{chapter}.\arabic{section}}
\renewcommand\thesubsection{\Roman{subsection}}
\makeatletter
\renewcommand\p@subsection{\thesection.}
\makeatother

\begin{document}

\chapter{Chapter}

\section{Section}

\subsection{Subsection}\label{subsection}

\noindent I have the subsections labelled in Roman in the title, because 1.1.I would just be long.

\noindent Here is a reference to the subsection: (\ref{subsection})

\end{document}


By the way, never use the combination \\ + blank line; this will generate underfull boxes warnings.

-
Wow, that was incredibly fast. Many thanks :-) – Jolyon Aug 18 '12 at 22:14

References can automatically be prefixed by \p@<counter>, see example:

\documentclass{report}
\usepackage{parskip}

\renewcommand\thesection{\arabic{chapter}.\arabic{section}}
\renewcommand\thesubsection{\Roman{subsection}}

\makeatletter
\renewcommand*{\p@subsection}{\thesection.}
\makeatother

\begin{document}
\chapter{Chapter}

Here is a reference to the subsection: \ref{subsection}

\section{Section}

\subsection{Subsection}\label{subsection}

\end{document}


Result:

-
Thank you. Basically the same answer as above, and works a charm :-) Does the * in renewcommand* do anything significant? – Jolyon Aug 18 '12 at 22:20
Yes, written at the same time. \(re)newcommand with star is the same as \def, without star it is \long\def. Here the difference is not important (without arguments). – Heiko Oberdiek Aug 19 '12 at 3:58