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{equation}
\begin{gathered}
\frac{c_r(6\sigma+3)+4\sigma²(\sigma2P_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}
\end{equation}
\begin{gather}
\notag \frac{c_r(6\sigma+3)+4\sigma²(\sigma2P_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}
Related videos on Youtube
Author by
Saud
Updated on August 01, 2022Comments

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 righthand 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} \begin{equation} \frac{c_r(6\sigma+3)+4\sigma^2(\sigma2P_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} \end{equation} \vspace{3cm} The original paper produces the following result: \begin{equation} P_c^* = \frac{4\sigma^2+4\sigma+1}{2(1+4\sigma)} \label{3.8} \end{equation} \end{document}

Admin over 6 yearsPlease post the a working document, not just fragments

David Carlisle over 6 yearsyou must have had multiple errors from that fragment? you can not use
\\
or\center
inequation

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.

Admin over 6 yearsUsing
\label{3.7}
is not really recommended. Please thealignat
environment` for something like this 
Saud over 6 years@ChristianHupfer: What would you recommend instead?

David Carlisle over 6 yearstex 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 multiline math display do not useequation
use an environment fromamsmath

Admin over 6 years@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 
barbara beeton over 6 yearsyou 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 insideequation
; that is meant for either oneline displays, or displays that have a grouping environment that treats them as a unit. 
Saud over 6 years@barbarabeeton: Haven't really used the gathered environment before, but after just having read about it makes sense.
