3

The code:

\documentclass{article}
\usepackage{physics}

\numberwithin{equation}{section}
\renewcommand*{\thesection}{Problem~\arabic{section}}

\begin{document}
\section{Relativity}
\begin{equation}
E=mc^2
\end{equation}
\end{document}

And the results:

enter image description here

How to suppress the "Problem" in the numbering to be (1.1)?

1
  • \renewcommand\theequation{\arabic{section}.\arabic{equation}} should do the trick.
    – Bernard
    Sep 23, 2016 at 1:47

1 Answer 1

2

You should avoid updating the section number representation as it may be used elsewhere. Instead, update the section number format \@seccntformat which is used when setting the section title:

enter image description here

\documentclass{article}

\usepackage{physics}

\numberwithin{equation}{section}

\makeatletter
\renewcommand{\@seccntformat}[1]{Problem~\csname the#1\endcsname\quad}
\makeatother

\begin{document}

\section{Relativity}

\begin{equation}
  E=mc^2
\end{equation}

\end{document}

This will also set \subsections (and lower units) with the Problem prefix.


It also may suffice to only call

\renewcommand{\theequation}{\arabic{section}.\arabic{equation}}
0

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.