# get rid of subsubsection in paragraph reference

In a revtex4 document I have: a section (arabic), a subsection (letter) and a paragraph (roman). I do not have any subsubsection.

I use the command \label to refer to the paragraph. When in the text I use the command \ref to refer to the paragraph I get something that looks like: "1A0I". "1" refers to section, "A" to subsection, "0" to subsubsection (that I do not have) and "I" (roman) to paragraph.

How can I drop the subsubsection numbering? I would like something like "1AI".

• Welcome to TeX.SE! Why do you omit the subsubsection level and jump directly down to paragraphs? Also post a compilable document, not only descriptions – user31729 Oct 19 '17 at 16:40
• this is an error in your input document, you should use \subsubsection not \paragraph. – David Carlisle Oct 19 '17 at 21:10

The reason for this is to ensure having \paragraphs with all the higher-level sectional units. However, there may be occasions where you want the formatting provided by \paragraph without having any \subsubsections within your document.

In order to achieve this deviation from the regular referencing scheme, you need to update the prefix @ddition for the paragraph counter. This prefix is added (in front of the regular counter representation) whenever you set a \label for that counter. In many cases, the prefix representation (\p@<cntr> for the counter <cntr>) is empty, but not with revtex4.

The example below updated \p@paragraph to remove the \subsubsection numbering:

\documentclass{revtex4}

\usepackage{lipsum}

\renewcommand{\thesection}{\arabic{section}}
\renewcommand{\thesubsection}{\Alph{subsection}}
\renewcommand{\theparagraph}{\Roman{paragraph}}

\makeatletter
% Default "parent" label associated with \paragraph:
% \def\p@paragraph{\thesection\,\thesubsection\,\thesubsubsection\,}
\def\p@paragraph{\thesection\,\thesubsection\,}% ...removed \thesubsubsection\,
\makeatother

\begin{document}

See Paragraph~\ref{par:mypar}.

\section{A section}\lipsum[1]
\subsection{A subsection}\lipsum[2]
\paragraph{A paragraph}\label{par:mypar}\lipsum[3]

\end{document}


For reference, from the LaTeX 2e Sources (section 22.1 Environment Counter Macros; own emphasis added below):

An environment foo has an associated counter defined by the following control sequences:

\c@foo
Contains the counter's numerical value. It is defined by \newcount\foocounter.

\thefoo
Macro that expands to the printed value of \foocounter. For example, if sections are numbered within chapters, and section headings look like

Section II-3 The Nature of Counters


then \thesection might be defined by:

\def\thesection
{\@Roman{\c@chapter}-\@arabic{\c@section}}


\p@foo
Macro that expands to a printed 'reference prefix' of counter foo. Any \ref to a value created by counter foo will produce the expansion of \p@foo\thefoo when the \label command is executed. See file ltxref.dtx for an extension of this mechanism.

\cl@foo
List of counters to be reset when foo stepped. Has format \@elt{countera}\@elt{counterb}\@elt{counterc}.