I am labeling a subsection with simply \label{labelname}
, and referring to it later in my document with \ref{labelname}
. However, at that point it doesn't print just the subsection number, e.g. 2.1
, but it prints the section number followed by the subsection number, like 2 2.1
. Can it be made to show the desired output?
Minimum example (using revtex4 class):
\documentclass[pre,12pt]{revtex4}
\renewcommand \thesection{\arabic{section}}
\renewcommand \thesubsection{\arabic{section}.\arabic{subsection}}
\renewcommand \thesubsubsection{\arabic{section}.\arabic{subsection}
\begin{document}
\section{Section 1}
\subsection{Subsection 1}
\label{subsection1}
Some text.
\section{Section 2}
Previously seen in \ref{subsection1}
\end{document}
Best Answer
The file
revtex4.cls
contains the linesso the representation for a cross-references to a subsection will be typeset as the upper-case alphabetic representation for the
subsection
counter prepended by the counter for sections and a thin space:Since you have redefined
\thesubsection
to explicitly include thesection
counter, you'll get this counter duplicated. To prevent this, you can redefine\p@subsection
; for example to suppress the prefix and keep just the representation for thesubsection
counter you could say:A complete example:
A similar redefinition of
\p@subsubsection
will have to be done, since the class does