2

I have document with sections and subsections.

Problem is this one. When I use

Sec. \ref{x}

to reference subsection 1.1, of \label{x}, I get result

Sec 1 1.1

Ho to get correct

Sec 1.1

?

Coding here

\documentclass[aps]{revtex4-1}
\renewcommand{\thesection}{\arabic{section}}
\renewcommand{\thesubsection}{\thesection.\arabic{subsection}}
\renewcommand{\thesubsubsection}{\thesubsection.\arabic{subsubsection}}
 \begin{document}
\section{My section}
\label{abc}
I wanna Sec\ref{def123}.
\subsection{\label{def123}My subsection}
\end{document}
3

the revtex aps style does not prefix the subsection numbers with the section number in the heading, so it adds it in references.

\documentclass[aps]{revtex4-2}
%\renewcommand{\thesection}{\arabic{section}}
%\renewcommand{\thesubsection}{\thesection.\arabic{subsection}}
%\renewcommand{\thesubsubsection}{\thesubsection.\arabic{subsubsection}}
 \begin{document}
\section{My section}
\label{abc}
I wanna Sec \ref{def123}.
\subsection{\label{def123}My subsection}
\end{document}

enter image description here

Publisher classes like revtex by design remove such choices from the author and enforce the journal style, so it is better to use a generic class such as article rather than redefine revtex internals to avoid this.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.