0

Notice I want my equation to have numbering.

7

LaTeX (and amsmath package) do not support this as it is a rather strange request, the style of equations should almost always be a document-wide choice.

That said, if you really need this you can make use of the fact that $$ is not supported latex syntax and does not obey the fleqn option.

\documentclass[fleqn]{article}

\usepackage{amsmath}

\begin{document}

zzz
\begin{equation}
  aaa=bbb
\end{equation}
zzz
$$\refstepcounter{equation}
  aaa=bbb
\eqno(\theequation)
$$
zzz
\begin{equation}
  aaa=bbb
\end{equation}

\end{document}
  • 1
    Perhaps you should use \ifvmode \nointerlineskip \makebox[.6\linewidth]{}\fi $$ instead of just $$ to start the display. – Skillmon likes topanswers.xyz Aug 17 '18 at 19:50
  • @Skillmon no need for the test, it is not in vmode (and should never be) latex has that test to catch user errors – David Carlisle Aug 17 '18 at 19:52
6

The nccmath package, which defines a fleqn environment to be used when you want to have only some equations aligned at the left margin, has, conversely, a ceqn when you want to have occasionally centred equations in a document with the fleqn option. These environments work like (and are compatible with) the subequations environment – and all amsmath environments.

Here is an example:

\documentclass[fleqn]{article}

\usepackage{amsmath, nccmath}
\usepackage{lipsum}

\begin{document}

\lipsum[11]
\begin{equation}
  aaa=bbb
\end{equation}

\begin{subequations}
\begin{ceqn}
\begin{align}
  aaa & =bbb \\
aaa + c & =bbb + d
\end{align}
\end{ceqn}
\end{subequations}

\end{document} 

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy