0

SOLUTION: It turns out it was a documentclass problem. By removing prl from \documentclass[reprint,aps,prl,superscriptaddress,notitlepage]{revtex4-2} it fixed my problem.

I'm having a problem where I can refer to figures/equations/tables, etc. but not sections in my supplemental document. For the supplement, I want to add in an "S" prefix before everything, so I've redefined them at the beginning. However, this doesn't seem to be working for the sections, and I don't know why. I've created a minimal working example below.

The problem likely lies in that the sections themselves do not have numbers, however I don't see anywhere that would explicitly turn them off here for any reason.

\documentclass[reprint,aps,prl,superscriptaddress,notitlepage]{revtex4-2}

\usepackage{lipsum}

\newcommand\startsupplement{%
       \setcounter{table}{0}
       \renewcommand{\thetable}{S\arabic{table}}
       \setcounter{figure}{0}
       \renewcommand{\thefigure}{S\arabic{figure}}
       \setcounter{equation}{0}
       \renewcommand{\theequation}{S\arabic{equation}}
       \setcounter{section}{0}
       \renewcommand{\thesection}{S\arabic{section}}
    }

\begin{document}
    
\title{\textbf{\fontfamily{phv}\selectfont 
Supplemental Material: \\ My Supplement Name}}
\author{Me}
\affiliation{Department of Physics}

\maketitle
\startsupplement

\section{First Section}
\label{sec:section1}

Referring to Section~\ref{sec:section1} \\
Referring to Section~\ref{sec:section2} \\

\thesection

\begin{equation}
\label{eq:linear}
y = mx + b
\end{equation}

\begin{equation}
\label{eq:exponential}
y = y_0 + e^{ax}
\end{equation}

Referring to Eqn.~\ref{eq:linear} \\
Referring to Eqn.~\ref{eq:exponential} \\

\lipsum[1]

\section{Second Section}
\label{sec:section2}
    

Referring to Section~\ref{sec:section1} \\
Referring to Section~\ref{sec:section2} \\

Referring to Eqn.~\ref{eq:linear} \\
Referring to Eqn.~\ref{eq:exponential} \\

\lipsum[2]

\end{document}
5
  • Ok thanks, good to know, I've updated – spaderdabomb Aug 27 '20 at 17:14
  • your sections don't have numbers, so what do you expect to get with \ref{sec:section1}? – Ulrike Fischer Aug 27 '20 at 17:15
  • I guess that is part of/the main issue as well. I am unsure why they do not have numbers. Any ideas? I've updated question to be more clear. – spaderdabomb Aug 27 '20 at 17:17
  • 1
    well it is the design choice of the class/journals. – Ulrike Fischer Aug 27 '20 at 17:18
  • I see, I got rid of the "prl" part of the document class and it works, thanks! – spaderdabomb Aug 27 '20 at 17:21

Your Answer

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

Browse other questions tagged or ask your own question.