Numbering the Equations in Latex

  • LaTeX
  • Thread starter EngWiPy
  • Start date
  • Tags
    Latex
In summary: This numbering is already done by default when you create an equation...what's the problem with that?This numbering is already done by default when you create an equation...what's the problem with that?
  • #1
EngWiPy
1,368
61
Hello,

I am wondering if there is an automatic way to number the equations in my thesis based on chapters, sections, subsections, ..., etc.

Regards
 
Physics news on Phys.org
  • #2
\numberwithin?
http://home.iitk.ac.in/~swagatk/faq/latex.html
http://online.redwoods.cc.ca.us/instruct/darnold/staffDev/lecture4.pdf#page=6
maybe useful... http://www.categorifiedcoder.info/old/weblog/archives/pure_latex_numberwithin

I haven't tried these myself.
 
Last edited by a moderator:
  • #3
Beautiful! I had been meaning to get around to learning this, and it works very well.

Code:
\numberwithin{equation}{section} %sets equation numbers <chapter>.<section>.<index>
\numberwithin{equation}{subsection} %sets equation numbers <chapter>.<section>.<subsection>.<index>
\numberwithin{equation}{subsubsection} %sets equation numbers <chapter>.<section>.<subsection>.<subsubsection>.<index>
 
  • #4
Thanks robphy and Fenn for replying.

When I wrote for example

Code:
\numberwithin{equation}{subsection}

and I have equations in the section before the subsection, the numbering will be something like 1.0.1 or if I have equations in the chapter before any section the numbering will be 0.0.1. I don't want this. I know a way to put a new control sequence just before each chapter, section, subsection, ..., etc, but I am wondering if there is a global control squence that solves these issues automatically, so that the numbers will be:

1- For chapter one: 1.1, 1.2, 1.3, ...
2- For section one in chapter one: 1.1.1, 1.1.2, 1.1.3, ...
.
.
.
etc

Best regards
 
  • #5
That might be a little confusing to the reader, where the depth of equation indices depends on the section where the equation resides. It may not be obvious to the reader whether (1.2) refers to Section 1.2, or Equation 2 in Chapter 1 before the first section. Just my opinion though.

To do what you're asking, it looks like /numberwithin will do this:

Code:
\chapter{New chapter}

\numberwithin{equation}{chapter}

\begin{align}
 F &= ma\\
 &= mv^2/r
\end{align}

...

\numberwithin{equation}{section}

\section{New Section}

\begin{align}
 E &= mc^2\\
 \pi &\text{ is exactly three!}
\end{align}

[tex]

\chapter{New chapter}

\numberwithin{equation}{chapter}

\begin{align}
F &= ma\\
&= mv^2/r
\end{align}

...

\numberwithin{equation}{section}

\section{New Section}

\begin{align}
E &= mc^2\\
\pi &\text{ is exactly three!}
\end{align}
[/tex]
 
  • #6
But in this case: how to distiniguish between the equations in chapter one and chapter two, for example, and both before any new section is encountered? The whole thing is confusing actually. I am thinking to treat chapters as sections, and sections as subsections, and so on. I don't know if there is anything prevent me doing that. But if you see any book, the equations are labeled as I discribed in my previous thread.

Regards
 
  • #7
Well, this forum doesn't do my example justice. For my thesis, I'm using the memoir package, and my equations would appear as (1.1), (1.2), (1.1.1), (1.1.2) in the example I gave. Which package are you using to prepare your thesis?

All my textbooks that I have with me right now use the format (<chapter>.<index>). I'll have to check my Sakurai when I get home to see how he handles (<chapter>.<section>.<index>). I would personally put a section right at the top of your chapter, so you're within the first section from the onset.

Code:
\chapter{How to Bathe a Dog}
\section{Introduction}

Generally speaking, the best equation used to bathe a dog is
%
\begin{align}
  g(t) &= 4\pi \frac{M}{\sqrt{t}}.
\end{align}
 
  • #8
Fenn said:
Well, this forum doesn't do my example justice. For my thesis, I'm using the memoir package, and my equations would appear as (1.1), (1.2), (1.1.1), (1.1.2) in the example I gave. Which package are you using to prepare your thesis?
...

How to use the memoir package? I think it is just what I want. Right now, I don't use any pacakes to number the equations, it is in its default setting.

Regards
 
  • #9
This numbering is already done by default when you create an equation...what's the problem with that?
 
  • #10
junglebeast said:
This numbering is already done by default when you create an equation...what's the problem with that?

Dear junglebeast,

The numbering is done by default, yes you are right, but the default numbering is sequential, and dosen't count for chapters, sections, subsections, ... ,etc.

Regards
 
  • #11
S_David said:
How to use the memoir package? I think it is just what I want. Right now, I don't use any pacakes to number the equations, it is in its default setting.
Regards

Actually, looks like I was using the improper name. Memoir is a class. At the top of your document, you have the line \documentclass[options]{classname}.

If you are using a different class, you will probably notice some unexpected behavior when you switch from one class to another. This package defines a whole pile of stuff that I have found handy when setting up the document. There is a comprehensive description of this class at http://www.ctan.org/tex-archive/macros/latex/contrib/memoir/memman.pdf, but you could also try looking for a thesis template that uses memoir, and see how it relates to your existing setup.

I'm still in the process of developing my thesis, and as I do so, my layout changes. When I am nearing completion, I plan to document my configuration and release it as a template for others. Thanks to this thread, the equation numbering style will be a part of that template!
 
  • #12
Fenn said:
Actually, looks like I was using the improper name. Memoir is a class. At the top of your document, you have the line \documentclass[options]{classname}.

If you are using a different class, you will probably notice some unexpected behavior when you switch from one class to another. This package defines a whole pile of stuff that I have found handy when setting up the document. There is a comprehensive description of this class at http://www.ctan.org/tex-archive/macros/latex/contrib/memoir/memman.pdf, but you could also try looking for a thesis template that uses memoir, and see how it relates to your existing setup.

I'm still in the process of developing my thesis, and as I do so, my layout changes. When I am nearing completion, I plan to document my configuration and release it as a template for others. Thanks to this thread, the equation numbering style will be a part of that template!

I am using the article class then. Anyway I will look at the document you gave, and see if it satisfies my thesis requirements. Finally, I liked what you said about your thesis template, which for sure will help others in writting their own thesis.

Best regards
 
  • #13
Hi,
I was wondering how to number a set of equations (in Latex) under the same number but differentiate with a letter appeneded at the end!
i.e,
aX + bY = k -------(1.1a)
cX + dY = l -------(1.1b)
rX + sY = m -------(1.1c)
like wise.
I can get them numbered as (1.1),(1.2),(1.3) etc. But don't know how to get the above format.

Thanks,
Madara
 
  • #14
You can use the subequation environment

ftp://ftp.ams.org/pub/tex/doc/amsmath/short-math-guide.pdf
 

Related to Numbering the Equations in Latex

1. What is the purpose of numbering equations in Latex?

Numbering equations in Latex allows for easier referencing and organization of equations in a scientific document. It also helps readers follow the logical flow of the equations and understand their relationships.

2. How do I start numbering equations in Latex?

To start numbering equations in Latex, use the command "\begin{equation}" before the equation and "\end{equation}" after the equation. This will automatically number the equation and add it to the list of equations in your document.

3. Can I customize the numbering of equations in Latex?

Yes, you can customize the numbering of equations in Latex by using the command "\tag" after the equation and specifying the desired number or label. You can also change the format, such as using Roman numerals or letters, by using the "\tag" command with the desired format.

4. How do I refer to a numbered equation in Latex?

To refer to a numbered equation in Latex, use the command "\ref{label}" where "label" is the label or number assigned to the equation. This will automatically insert the corresponding equation number in your document.

5. Is it possible to have multiple equations with the same number in Latex?

Yes, it is possible to have multiple equations with the same number in Latex by using the command "\tag" with the same number or label for each equation. However, it is recommended to use unique numbers or labels for each equation to avoid confusion.

Similar threads

Replies
9
Views
1K
Replies
12
Views
1K
Replies
1
Views
292
Replies
3
Views
2K
Replies
13
Views
2K
Replies
11
Views
2K
Replies
3
Views
2K
Replies
2
Views
1K
Back
Top