11

I know how to make them do 1, 2, 3....just need to know 1.1, 1.2, 3.2, 3.3 etc

\begin{align}

\end{align}

This will produce 1, 2, 3 etc, I know this but need the other.

  • 1
  • Welcome to TeX SE, your question could be made a little clearer. A minimal working example from \documentclass until \end{document} could enable more users to answer your question. – jens_bo Jan 19 '14 at 2:24
  • 2
    The title of you post is very bad. It is essentially useless for other users that may face a similar issue, when they search for existing questions/answers on this site. That would be nice if you could reformulate it in a more descriptive way, as, for instance: Equation numbering: how can I get (1.1), (2.1), (3.2) in the article class? – pluton Jan 19 '14 at 5:26
17

The question can also be interpreted that the first number of the composite equation number should be the section number. The other two classes report and book are using composite equation numbers, whose first part is the chapter number. The article class does not have chapters and uses plain equation numbers.

Package amsmath (this is used because of align) provides an easy way to add the section number:

\numberwithin{equation}{section}

Complete example:

\documentclass{article}
\usepackage{amsmath}

\numberwithin{equation}{section}

\begin{document}
  \section{Equation numbering}
  \begin{align}
    a = a\\
    b = b\\
    c = c
  \end{align}

  \section{Second section}
  \begin{gather}
    d = d
  \end{gather}
\end{document}

Result

| improve this answer | |
  • \numberwithin was not recognized for me, but \counterwithin{equation}{section} worked. – marts Jun 15 '17 at 12:01
  • @marts \numberwithin requires package amsmath, where it is defined, as I have written in the answer. – Heiko Oberdiek Jun 15 '17 at 12:03
  • I know, I am using that package. I haven't been able to figure out why \numberwithin doesn't work. I've added the comment for other users who might stumble upon this problem. – marts Jun 15 '17 at 12:05
  • @marts Then, make a proper minimal working example (MWE) in a new question to have something to be analyzed. The example in the answer still works for me without problems. – Heiko Oberdiek Jun 15 '17 at 12:07
16

The amsmath package offers you the subequations environment; to get the desired formatting, you can redefine \theequation:

\documentclass{article}
\usepackage{amsmath}

\begin{document}

\begin{subequations}
\begin{align}
y & = d \\
y & = cx+d \\
y & = bx^{2}+cx+d \\
y & = ax^{3}+bx^{2}+cx+d
\end{align}
\end{subequations}

\begin{subequations}
\renewcommand{\theequation}{\theparentequation.\arabic{equation}}
\begin{align}
y & = d \\
y & = cx+d \\
y & = bx^{2}+cx+d \\
y & = ax^{3}+bx^{2}+cx+d
\end{align}
\end{subequations}

\end{document}

enter image description here

| improve this answer | |

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.