1

I have the following code to output an equation. I want to use a single equation number for this whole block. How can we do it?

latex output latex code

  • You only have one alignmrnt column? – Bernard Mar 08 '21 at 13:40
  • 2
    Could you please post a code, not a screenshot of a code? – Bernard Mar 08 '21 at 13:45
  • \begin{flalign} \tilde{A} &= A_{N,m}A_{m,m}^{-1}A_{m,N} &&\ &=A_{N,m}U\wedge^{-1}U^TA_{N,m}^T &&\ &=A_{N,m}U\wedge^{-1/2}\wedge^{-1/2}U^TA_{N,m}^T &&\ &=GG^T \label{nystrom_evd_approx_for_indefinite} \end{flalign} – rockstone435 Mar 08 '21 at 14:21

3 Answers3

4

I see no reason to change from standard centering to left alignment for a single display, so I guess you want all displays to be flush left.

\documentclass{article}
\usepackage[fleqn]{amsmath}

\setlength{\mathindent}{0pt}

\begin{document}

This is some text prior to the display running to at least cover two lines; let's add some words until they fit \begin{equation} \begin{split} \tilde{A} &= A_{N,m} A_{m,m}^{-1} A_{m,N} \ &= A_{N,m} U \wedge^{-1} U^T A_{N,m}^T \ &= A_{N,m} U \wedge^{-1/2} {} \wedge^{-1/2} U^T A_{N,m}^T \ &= GG^{T} \end{split} \end{equation} and some text past the display.

\end{document}

enter image description here

If you really want this particular display to be flush left, but I can't imagine why, you can do as follows

\documentclass{article}
\usepackage{amsmath}

\begin{document}

This is some text prior to the display running to at least cover two lines; let's add some words until they fit \begin{flalign} \begin{aligned} \tilde{A} &= A_{N,m} A_{m,m}^{-1} A_{m,N} \ &= A_{N,m} U \wedge^{-1} U^T A_{N,m}^T \ &= A_{N,m} U \wedge^{-1/2} {} \wedge^{-1/2} U^T A_{N,m}^T \ &= GG^{T} \end{aligned}&& \end{flalign} and some text past the display.

\end{document}

The output is the same as before.

egreg
  • 1,121,712
3

A solution with a plain aligned environment within equation nested in a fleqn environment, defined by the nccmath package:

\documentclass{article}
\usepackage{amsmath, nccmath}

\usepackage{commath}

\begin{document}
\noindent Some text. some text. Some more text. Some more text.
\begin{fleqn}
\begin{equation}
  \begin{aligned}
   \tilde{A} & = A_{N, m}A_{m, m}^{-1}A_{m, N} \\
  & = A_{N, m}\wedge^{-1}U^{\mathrm t} A_{N, m}^{\mathrm t} \\
  & = A_{N, m}\wedge^{-1/2}\wedge^{-1/2}U^{\mathrm t} A_{N, m}^{\mathrm t} \\
  & = GG^{\mathrm t}
        \end{aligned}%
\label{nystrom_evd_approx_for_indefinite}
\end{equation}
\end{fleqn}

\end{document}

enter image description here

Bernard
  • 271,350
  • As far as I get it.. it gives equation number in the middle.. so you dont need to specify it separately like we use tag in * environment (a solution given below by Willoughby.) – rockstone435 Mar 08 '21 at 14:24
  • 2
    You only need a \label for crossreferences. If you prefer the equation number aligned with the first or the last line, use the optional argument of the environment[t] or [b] ([c] being the default). – Bernard Mar 08 '21 at 14:30
1

Use the * version of the environment which has no numbering and then \tag the desired equation. For example if you have three equations and want a number only on the second line:

\documentclass{article}
\usepackage{commath}
\begin{document}
    \begin{flalign*}
        F &= ma&&\\
        a^2 &= b^2 + c^2&&\refstepcounter{equation}\tag{\theequation}\\
        0 &= e^{i\pi} + 1
    \end{flalign*}
\end{document}

Here \refstepcounter{equation} increases the value of the equation counter and also makes it accessible to \label and then \tag{\theequation} labels the equation with the current equation number.

Willoughby
  • 3,649