30

I want to manually label equation number ? For example I want to label this equation 3.1 instead of (1) which automatically pops up. Is it also possible in split environment as well or not ?

\begin{equation}
    \log \mu_{ijk}= \lambda + \lambda_i ^I + \lambda_j ^J+\lambda_k ^K+\lambda_{ij} ^{IJ}+\lambda_{ik} ^{IK}+\lambda_{jk} ^{JK}+\lambda_{ijk} ^{IJK} \label{eq:3.1}
    \end{equation}
1
  • 2
    try tag{\thesection.\theequation}; I think this has been asked before somewhere...
    – cmhughes
    Commented Mar 10, 2014 at 2:21

4 Answers 4

36

You can use \tag:

\documentclass{article}
\usepackage{amsmath}
\begin{document}
\begin{equation}
    \log \mu_{ijk}= \lambda + \lambda_i ^I + \lambda_j ^J+\lambda_k ^K+\lambda_{ij} ^{IJ}+\lambda_{ik} ^{IK}+\lambda_{jk} ^{JK}+\lambda_{ijk} ^{IJK} \tag{3.1}\label{eq:3.1}
\end{equation}
\end{document}

Capture of expected output

1
  • 2
    Excellent !! How to do the exact same thing in equation and split environment together ?
    – user35571
    Commented Mar 10, 2014 at 2:36
19

I guess you are looking for a way to number your equations "within" sections, that is, add the section number before the equation number.

This can be done automatically if you add the line

\numberwithin{equation}{section}

in your preamble, without any manual intervention.

MWE:

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

\begin{document}

\section{Test}
Some text

\section{Another Test}
Some text

\section{An equation}
\begin{equation}
\log \mu_{ijk}= \lambda + \lambda_i ^I + \lambda_j ^J+\lambda_k ^K+\lambda_{ij} ^{IJ}+\lambda_{ik} ^{IK}+\lambda_{jk} ^{JK}+\lambda_{ijk} ^{IJK} \label{eq:3.1}
\end{equation}

\end{document}

Output:

enter image description here

12

Personally, I wanted to have "Eq." in front of the equation numbering. I thought you had the same question but then with "equation" instead of "Eq.". Also, I wanted to have the section numbering in front of the equation, so that the equations are numbered as (Eq. 3.1) instead of (1).

I started from How to change equation numbering style.

\documentclass{article}
\usepackage{amsmath} % \numberwithin{equation} doesn't exist without this package.
\numberwithin{equation}{section} % This line resets equation numbering when starting a new section.
\renewcommand{\theequation}{Eq. \thesection.\arabic{equation}} % This line ads "Eq." in front of your equation numbering.
\begin{document}
\section{Introduction}
\begin{equation}
1+1=3?
\end{equation}
\begin{equation}
1+1\neq3
\end{equation}
\section{Some section or chapter without content...}
\section{Content!}
\begin{equation}
1+1=2
\end{equation}
\begin{equation}
1+2=3
\end{equation}
\end{document}

example of what it should look like

Unfortunately, the order of lines is crucial, because it is possible to override "\renewcommand{\theequation}{Eq. \thesection.\arabic{equation}}" with "\numberwithin{equation}{section}", and you only get (1.1).

Note that if "\numberwithin{equation}{section}" is left out, equation numbering continues after opening a new section, so it numbers like (Eq. 1.1), (Eq. 1.2), (Eq. 3.3), (Eq. 3.4), which is strange.

PS, I don't know why you would like to force a tag to become "equation 3.1", I thought the automatic numbering was a good thing.

2
  • This doesn't answer the question.
    – Werner
    Commented Feb 21, 2017 at 21:43
  • Sorry for my late response, my previous answer was too short and was lacking a picture. The complete script should print "Eq. 3.1", which answers the question, right? I don't know why you would like to force a tag to become "equation 3.1", I thought the automatic numbering was a good thing....
    – Teun Zijp
    Commented Feb 27, 2017 at 1:02
3

THis worked for me Thank you

\documentclass{article}
    \usepackage{amsmath}
    \begin{document}
    \begin{equation}\tag{3.1}
    \begin{split}
        \log \mu_{ijk}= \lambda + \lambda_i ^I + \lambda_j ^J+\lambda_k ^K+\lambda_{ij} ^{IJ}+\lambda_{ik} ^{IK}+\lambda_{jk} ^{JK}+\lambda_{ijk} ^{IJK} \tag{3.1}\label{eq:3.1}

    \end{split}
        \end{equation}
    \end{document}
1
  • I believe only giving tag while doing \begin equation was sufficient. Commented Oct 28, 2020 at 3:23

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .