# Equation numbering gone wrong

2,348

You cannot break lines in equation. Use a gathered environment within equation. The label will be typeset between the equation lines, unless you load amsmath with the tbtags option. If you want the label to appear on the last line, you can use the gather environment, and \notag on the first two lines:

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

\begin{document}
\setcounter{section}{3}
$$\begin{gathered} \frac{c_r(6\sigma+3)+4\sigma²(\sigma-2P_c+1)-2P_c+1}{(2\sigma+1)²} = 0 \\ \Updownarrow \\ P_c^* = \frac{4\sigma²+4\sigma+1+4\sigma³+6c_r\sigma+3c_r}{2(1+4σ)} \end{gathered}$$

\begin{gather}
\notag \frac{c_r(6\sigma+3)+4\sigma²(\sigma-2P_c+1)-2P_c+1}{(2\sigma+1)²} = 0 \\
\notag \Updownarrow \\
P_c^* = \frac{4\sigma²+4\sigma+1+4\sigma³+6c_r\sigma+3c_r}{2(1+4σ)}
\label{3.7bis}
\end{gather}

\end{document}


Share:
2,348

Author by

### Saud

Updated on August 01, 2022

• Saud 12 days

There are three issues that I would like to fix which are probably interlinked, but don't know how (have tried a couple of things):

1) Force the equation numbering of equation 3.7 to move to the right-hand side of the the lower equation (underneath the updownarrow, so it looks like the numbering of equation 3.8. 2) Avoid compressing the size of the lower equation 3) Avoid italic font of equation 3.8

This is my code:

\documentclass[12pt,twoside]{book}
\usepackage{amssymb}
\usepackage{amsthm}
\usepackage{amsmath}
\begin{document}

$$\frac{c_r(6\sigma+3)+4\sigma^2(\sigma-2P_c+1)-2P_c+1}{(2\sigma+1)^2} = 0 \\ \center\Updownarrow \\ P_c^* = \frac{4\sigma^2+4\sigma+1+4\sigma^3+6c_r\sigma+3c_r}{2(1+4\sigma)}\center \label{3.7}$$
\vspace{-3cm}

The original paper produces the following result:

$$P_c^* = \frac{4\sigma^2+4\sigma+1}{2(1+4\sigma)} \label{3.8}$$

\end{document}


Please post the a working document, not just fragments
• David Carlisle over 6 years
you must have had multiple errors from that fragment? you can not use \\  or \center in equation
• Saud over 6 years
@ChristianHupfer: Done.
• Saud over 6 years
@DavidCarlisle: Yes, I do get three errors in total. For some reason, I can't see the explanations on them when I hover the mouse over.
Using \label{3.7} is not really recommended. Please the alignat environment for something like this
tex does not attempt to make sensible typeset output after an error, it just recovers enough to process the document to check for more errors. you can never use \center in math mode, for multi-line math display do not use equation use an environment from amsmath
@Saud: Something easy to remember. What's the purpose of \labels if you name them like the equation number (which can change, most likely). Use \label{myimportantresult} or something like this
you possibly want to try using the gathered environment inside the equation numbered 3.7; that will allow you to separate lines by \\  and center all the lines with only a single equation number. as @DavidCarlisle says, \\  is not allowed inside equation`; that is meant for either one-line displays, or displays that have a grouping environment that treats them as a unit.