Math & ScienceEquation Numbering

Information and discussion about LaTeX's math and science related features (e.g. formulas, graphs).
Post Reply
peaches2165
Posts: 25
Joined: Wed Oct 22, 2008 5:03 pm

Equation Numbering

Post by peaches2165 »

Hi All,

I'm having a bit of a problem numbering some equations.
I need to be some sub numbers on automatic. For example.

\begin{equation}
\frac{1}{2} \label{E4.3_1}
\end{equation}

or

\begin{equation}
\frac{1}{3} \label{E4.3_2}
\end{equation}

Is there a way to do this?

Also is there a way to automatically put a footnote within an equation?

Thanks,

Peaches

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

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

Equation Numbering

Post by localghost »

The amsmath package offers the right environment for this purpose.

Code: Select all

\documentclass[11pt,a4paper]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{amsmath}

\begin{document}
  \begin{subequations}
    \begin{align}
      (a+b)^2&=a^2+2ab+b^2 \\
      (a-b)^2&=a^2-2ab+b^2 \\
      (a+b)(a-b)&=a^2-b^2
    \end{align}
  \end{subequations}
\end{document}
You may be able to modify the equation numbering by using the mathtools package from the mh bundle.


Best regards
Thorsten¹
peaches2165
Posts: 25
Joined: Wed Oct 22, 2008 5:03 pm

Re: Equation Numbering

Post by peaches2165 »

Hi, Thanks for the post, but that is not actually what i need I need two equations to have the same number with a sub 1 and the other with sub 2 and the 1 and 2 actually have to be subscripted to the equation number

as equation number 4.1_1 and equation number 4.1_2

Is there a way to do this automatically?

Thanks,

Peaches
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Equation Numbering

Post by localghost »

peaches2165 wrote:[…] but that is not actually what i need I need two equations to have the same number with a sub 1 and the other with sub 2 and the 1 and 2 actually have to be subscripted to the equation number as equation number 4.1_1 and equation number 4.1_2 […]
It is totally clear to me that this is not exactly what you want. It was only supposed to be an approach. Be proactive and don't expect complete solutions right at the beginning. Read the mentioned manuals and see if you can do something on your own.
peaches2165 wrote:[…] Is there a way to do this automatically? […]
I'm not aware of such an automatism. So you (or anybody else) will have to do this by hand because the above code is all I can offer at the moment. The forum search may yield some useful results.
phi
Posts: 577
Joined: Tue Oct 21, 2008 8:10 pm

Equation Numbering

Post by phi »

Try the following slight modification of the subequations environment:

Code: Select all

\documentclass[11pt,a4paper]{article}
\usepackage{fixltx2e}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{amsmath}

\makeatletter
\renewenvironment*{subequations}{%
  \refstepcounter{equation}%
  \protected@edef\theparentequation{\theequation}%
  \setcounter{parentequation}{\value{equation}}%
  \setcounter{equation}{0}%
  \def\theequation{\theparentequation\textsubscript{\arabic{equation}}}%
  \ignorespaces
}{%
  \setcounter{equation}{\value{parentequation}}%
  \ignorespacesafterend
}
\makeatother
Post Reply