Hi all
I have a simple question regarding Latex.
I tried many manuals but couldn't find the answer.
I am trying to write a document containing several sections, and in each there are equations.
I would like to number the equations with the number of sections, followed by a dot and then the equation number (e.g. 1.1, 1.2, 1.3, ..., 2.1, 2.2 etc.)
The thing is that I can't do it - I always get the equations numbered from 1 to the number of equations (1, 2, 3) regardless which section they are.
Can someone tell me what am I doing wrong?
Thanks
Math & Science ⇒ Enumerating equations
NEW: TikZ book now 40% off at Amazon.com for a short time.

- localghost
- Site Moderator
- Posts: 9202
- Joined: Fri Feb 02, 2007 12:06 pm
Enumerating equations
Especially as a new member please get used to posting always a full example (see Board Rules). This is essential and in your own interest if you expect to get help quickly [1].
From your description I assume that you are using the article class (or a similar one). You are nothing doing wrong. This is the way this class numbers equations. The amsmath package helps you to get your equations numbered as desired.
[1] View topic: Avoidable mistakes
Best regards and welcome to the board
Thorsten
From your description I assume that you are using the article class (or a similar one). You are nothing doing wrong. This is the way this class numbers equations. The amsmath package helps you to get your equations numbered as desired.
Code: Select all
\documentclass[11pt,a4paper,english]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{babel}
\usepackage{amsmath}
\numberwithin{equation}{section}
\begin{document}
\section{Foo}
\begin{equation}\label{eqn:einstein}
E=mc^2
\end{equation}
\section{Bar}
\begin{subequations}\label{eqn:binomi}
\begin{align}
(a+b)^2&=a^2+2ab+b^2 \label{subeqn-1:binomi} \\
(a-b)^2&=a^2-2ab+b^2 \label{subeqn-2:binomi} \\
(a+b)(a-b)&=a^2-b^2 \label{subeqn-3:binomi}
\end{align}
\end{subequations}
\end{document}
Best regards and welcome to the board
Thorsten
How to make a "Minimal Example"
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10
Enumerating equations
Great Thanks!
Thats just what was missing:
The \numberwithin command
Thanks again
Guy
Thats just what was missing:
The \numberwithin command
Thanks again
Guy