# Hide section number but keep equation numbering by section

Original question (i): My section headings are in the form 'Scenario 1: Learning to use LaTeX' etc so it looks stupid when the heading is printed as '1 Scenario 1: Learning to use LaTeX'. Therefore I'd like to hide the section numbering.

However I still want the equation numbers to be by section (so the first equation in section 1 is labelled (1.1) etc).

I've tried putting \numberwithin{equation}{section} in the preamble and using \section*{...} but then the equation numbers in all the sections are (0.1), (0.2) etc.

Any ideas on how to do this? Thanks in advance!

Follow-up Question (ii): This is a more specific question to my paper, about how to write up the sections so that the numberings make sense.

My paper has the following sections, and I've written next to each how I'd like the equations to be numbered:

Scenario 1 (1.1),(1.2) etc

Scenario 2 (2.1) etc

Scenario 3 (3.1) etc

Scenario 4 (4.1) etc

Scenario 5 (5.1) etc

Scenario H1 (H1.1) etc

Scenario 8 (8.1) etc

Scenario H2 (H2.1) etc

Supplementary Information

The Supplementary Information also has subsections:

Scenario 1 Numbers follow on from Scenario 1 above eg (1.9),(1.10) etc

Scenario 2 As above, eg (2.7) etc

Scenario 6 (6.1) etc

Scenario 7 (7.1) etc

• Welcome to the site. Please edit your question and provide a small, but complete working example that demonstrates the issue, beginning with \documentclass. Jun 17 '21 at 10:49
• \numberwithin*{equation}{section} should do what you want. Jun 17 '21 at 13:45
• I just tried putting this in and it comes up with an error ('no counter '*' defined'). Jun 17 '21 at 16:28
• Where is \numberwithin defined? The kernel provides \counterwithin which I use. Jun 17 '21 at 16:57
• @PeterWilson I'm not fully sure what you mean? I think \numberwithin comes from the amsmath package. Jun 17 '21 at 17:03

## W.r.t the original question (i)

You could redefine the section and equation numbers in this way--

\documentclass{article}

\usepackage{amsmath}

\renewcommand{\thesection}{Scenario \arabic{section}:}
\renewcommand{\theequation}{\arabic{section}.\arabic{equation}}

\begin{document}

\section{Solving equations in \LaTeX}

Consider the equation with one variable---
$$a^2 + 2a = 8$$
which solves as $a = 2$.

\section{Moving deeper}

Two equations with two unknowns---
\begin{align}
a &= b + 3 \\
b &= 2
\end{align}
boils down to $a = 5$.

\section{The harder part}

Two equations with three unknowns do not have a unique solution\ldots
\begin{align}
a &= b + c \\
b &= c - 5
\end{align}
solves for any value of $c$.

\end{document}


which produces this--

## W.r.t the first part of the follow-up question (ii)

Addressing the need for an additional Scenario H1 (only the first part to this question), something like this--

...could be achieved by combining my answer with @Werner's more robust, low-level(?) TeX solution ...somewhat close to @egreg's answer, and defining two section-like commands

• \scenario{...} and
• \scenarioh{...}

with their respective counters scenario and scenarioh according to normal LaTeX protocol (please pardon my limited TeX knowledge).

\documentclass{article}

\usepackage{amsmath}
\numberwithin{equation}{section}

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

\newcounter{scenario}
\newcounter{scenarioh}

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

\newcommand{\scenario}[1]{
\addtocounter{scenario}{1}
\renewcommand{\thesection}{%
\arabic{scenario}%
}
\section{#1}
\renewcommand{\theequation}{%
\arabic{scenario}.\arabic{equation}%
}
}

\newcommand{\scenarioh}[1]{
\addtocounter{scenarioh}{1}
% A  "Scenario H" will normally
% increment the "Scenario" counter by 1
\addtocounter{scenario}{1}
\renewcommand{\thesection}{%
H\arabic{scenarioh}%
}
\section{#1}
\renewcommand{\theequation}{%
H\arabic{scenarioh}.\arabic{equation}%
}
}

\newcommand{\skipscenario}{\addtocounter{scenario}{1}}

\begin{document}

\scenario{Solving equations in \LaTeX}\label{sec:sol}

Consider the equation with one variable---
$$a^2 + 2a = 8$$
which solves as $a = 2$, or $a = -4$.

\scenario{Moving deeper}

Two equations with two unknowns---
\begin{align}
a &= b + 3 \\
b &= 2
\end{align}
boils down to $a = 5$, being the only root, unlike \S\,\ref{sec:sol}.

\scenario{The harder part}

Two equations with three unknowns do not have a unique solution\ldots
\begin{align}
a &= b + c \\
b &= c - 5
\end{align}
solves for any value of $c$.

\scenarioh{Weird use cases}\label{sec:weird}

Fermat's last theorem states---
\begin{align}
a^n + b^n = c^n  \qquad n > 2
\label{eq:weird}
\end{align}
We skip a the next scenario and move on to scenario \ref{sec:iden}.

\skipscenario

\scenario{Identities}\label{sec:iden}

Let's take the identity---
$$a \equiv a$$

\end{document}


I took the body from Partha D.'s answer for laziness.

Why not to redefine \thesection? Because with \ref you'd end up with unwanted bits of information.

• Ah I hadn't thought of \ref. Could you explain a little more what you are doing in the preamble (from \makeatletter to \makeatother)? Jun 17 '21 at 17:17