4

My current code is like this:

\begin{multline}
Q_{K_4} =[l_1,(l_2,l_3),(l_4,l_5),(l_2,l_6,l_4),(l_5,l_6,l_3)].[l_2,l_3,(l_6,l_4),(l_6,l_5)].[l_4,l_6,l_5]\\
=\cfrac{l_1 (l_2,l_3)(l_4,l_5) (l_2,l_4,l_6)(l_3,l_5,l_6)}{(l_1,(l_2,l_3),( l_4,l_5),(l_2,l_4,l_6),(l_3,l_5,l_6))}.\cfrac{l_2 l_3(l_6,l_4) (l_5,l_6)}{(l_2,l_3(l_6,l_4),(l_6,l_5))}.[l_4,l_5,l_6]\\
=\cfrac{(l_4,l_5)(l_5,l_6)(l_6,l_4)[l_4,l_5,l_6]l_1 l_2 l_3 ( l_2,l_3 ) (l_2,l_4,l_6) (l_3,l_5,l_6)}{((l_1,l_2,l_3,(l_4,l_5)),(l_2,l_4,l_6,(l_3,l_5,l_6)))(l_2,l_3,l_6,l_4,(l_6,l_5))}\\
=\cfrac{l_4l_5l_6(l_4,l_5,l_6)l_1l_2l_3(l_2,l_3)(l_2,l_6,l_4)(l_5,l_6,l_3)}{ ((l_1,l_2,l_3,l_4,l_5),(l_2,l_4,l_6, l_3,l_5))(l_2,l_3,l_6,l_4,l_6,l_5)}\\ [\ (l_4l_5)(l_5,l_6)(l_6,l_4)[l_4,l_6,l_5] = l_4l_5l_6(l_4,l_5,l_6) ]\\
=\cfrac{l_1 l_2 l_3 l_4 l_5 l_6 (l_2,l_3)(l_2,l_4,l_6)(l_3,l_5,l_6)(l_4, l_5, l_6)}{((l_1,l_2,l_3,l_4,l_5 ),(l_2,l_3,l_4, l_5,l_6))(l_2,l_3,l_4,l_5,l_6)}
\end{multline}

But then it shows up like this. How do I align it properly, so that the equation number is also visible? code image

1
  • 2
    You have to use the align environment, and mark the alignment point (=, I suppose) in each row with an ampersand. – Bernard Feb 1 at 17:20
5

I’m not sure I’m understanding what you’re asking for, but is it something like this?

\documentclass{article}
\usepackage{newcomputermodern} % Or your font of choice.
\usepackage{amsmath} % Already loaded.

\begin{document}
\begin{equation}
\begin{aligned}
Q_{K_4} &= [l_1,(l_2,l_3),(l_4,l_5),(l_2,l_6,l_4),(l_5,l_6,l_3)].[l_2,l_3,(l_6,l_4),(l_6,l_5)].[l_4,l_6,l_5]\\
        &= \cfrac{l_1 (l_2,l_3)(l_4,l_5) (l_2,l_4,l_6)(l_3,l_5,l_6)}{(l_1,(l_2,l_3),( l_4,l_5),(l_2,l_4,l_6),(l_3,l_5,l_6))}.
           \cfrac{l_2 l_3(l_6,l_4) (l_5,l_6)}{(l_2,l_3(l_6,l_4),(l_6,l_5))}.[l_4,l_5,l_6]\\
        &= \cfrac{(l_4,l_5)(l_5,l_6)(l_6,l_4)[l_4,l_5,l_6]l_1 l_2 l_3 ( l_2,l_3 ) (l_2,l_4,l_6)
           (l_3,l_5,l_6)}{((l_1,l_2,l_3,(l_4,l_5)),(l_2,l_4,l_6,(l_3,l_5,l_6)))(l_2,l_3,l_6,l_4,(l_6,l_5))}\\
        &= \cfrac{l_4l_5l_6(l_4,l_5,l_6)l_1l_2l_3(l_2,l_3)(l_2,l_6,l_4)(l_5,l_6,l_3)}{ ((l_1,l_2,l_3,l_4,l_5),
           (l_2,l_4,l_6, l_3,l_5))(l_2,l_3,l_6,l_4,l_6,l_5)}\\
        &\qquad [\ (l_4l_5)(l_5,l_6)(l_6,l_4)[l_4,l_6,l_5] = l_4l_5l_6(l_4,l_5,l_6) ]\\
        &= \cfrac{l_1 l_2 l_3 l_4 l_5 l_6 (l_2,l_3)(l_2,l_4,l_6)(l_3,l_5,l_6)(l_4, l_5, l_6)}
           {((l_1,l_2,l_3,l_4,l_5 ),(l_2,l_3,l_4, l_5,l_6))(l_2,l_3,l_4,l_5,l_6)}
\end{aligned}
\end{equation}
\end{document}

New Computer Modern Book Sample

Using aligned within an equation gets you aligned equations with a single number at the end.

Here is an example that combines aligned with split to give aligned, split equations. I took the liberty of indenting for readability, making outer nested parentheses and brackets larger than the ones they enclose, and changing all the fractions to \frac.

\documentclass{article}
\usepackage{newcomputermodern} % Or your font of choice.
\usepackage{amsmath} % Already loaded.

\begin{document}
\begin{equation}
\begin{aligned}
Q_{K_4} &= \begin{split} &[l_1,(l_2,l_3),(l_4,l_5),(l_2,l_6,l_4),(l_5,l_6,l_3)].\\
 &\quad[l_2,l_3,(l_6,l_4),(l_6,l_5)].[l_4,l_6,l_5]
           \end{split}\\
        &= \begin{split} &\frac{l_1 (l_2,l_3)(l_4,l_5) (l_2,l_4,l_6)(l_3,l_5,l_6)}
                               {\bigl(l_1,(l_2,l_3),( l_4,l_5),(l_2,l_4,l_6),(l_3,l_5,l_6)\bigr)}.\\
                         &\quad\frac{l_2 l_3(l_6,l_4) (l_5,l_6)}{\bigl(l_2,l_3(l_6,l_4),(l_6,l_5)\bigr)}.[l_4,l_5,l_6]
           \end{split}\\
        &=   \frac{(l_4,l_5)(l_5,l_6)(l_6,l_4)[l_4,l_5,l_6]l_1 l_2 l_3 ( l_2,l_3 ) (l_2,l_4,l_6)
                   (l_3,l_5,l_6)}
                  {\Bigl((l_1,l_2,l_3,(l_4,l_5)\bigr),
                   \bigl(l_2,l_4,l_6,\bigl(l_3,l_5,l_6)\bigr)\Bigr)\bigl(l_2,l_3,l_6,l_4,(l_6,l_5)\bigr)}\\
        &= \begin{split} &\frac{l_4l_5l_6(l_4,l_5,l_6)l_1l_2l_3(l_2,l_3)(l_2,l_6,l_4)(l_5,l_6,l_3)}
                               { \bigl((l_1,l_2,l_3,l_4,l_5), (l_2,l_4,l_6, l_3,l_5)\bigr)(l_2,l_3,l_6,l_4,l_6,l_5)}\\
                         &\quad \bigl[ (l_4l_5)(l_5,l_6)(l_6,l_4)[l_4,l_6,l_5] = l_4l_5l_6(l_4,l_5,l_6) \bigr]
           \end{split}\\
        &= \frac{l_1 l_2 l_3 l_4 l_5 l_6 (l_2,l_3)(l_2,l_4,l_6)(l_3,l_5,l_6)(l_4, l_5, l_6)}
                {\bigl((l_1,l_2,l_3,l_4,l_5 ),(l_2,l_3,l_4, l_5,l_6)\bigr)(l_2,l_3,l_4,l_5,l_6)}
\end{aligned}
\end{equation}
\end{document}

New Computer Modern Sample

6
  • 2
    I don't think it's a good idea to use \cfrac here. The ordinary \frac directive seems more appropriate. And, I'd replace all instances of . with \cdot. – Mico Feb 1 at 17:34
  • 1
    @Mico I copied it from the code in the question, and changed only the environments. You could be right! – Davislor Feb 1 at 17:34
  • Thank you so much! – spandna28 Feb 1 at 17:40
  • 1
    Thanks @Mico I will do that – spandna28 Feb 1 at 17:40
  • 1
    @CampanIgnis - I suppose I was about 98% certain that \cdot was the right symbol to replace the four instances of .. What raised my subjective probability to near-cdrtainty was the presence of . between two \frac terms. :-) – Mico Feb 1 at 19:24
2

Unfortunately you not provide any information about your document. So we don't know the size of \textwidth, used fonts etc. This has strong influence on equation formatting (if there is enough space for equation number or it is necessary to make more breaks):

He case with bigger \textwidth:

\documentclass{article}
\usepackage{geometry} % for bigger \textwidth
\usepackage{mathtools}

\begin{document}
    \begin{equation}\label{eq:longequation}
\begin{aligned}
Q_{K_4}
& = \bigl[l_1,(l_2,l_3),(l_4,l_5),(l_2,l_6,l_4),(l_5,l_6,l_3)\bigr]{\cdot}
    \bigl[l_2,l_3,(l_6,l_4),(l_6,l_5)].[l_4,l_6,l_5\bigr]                                   \\
& = \frac{l_1 (l_2,l_3)(l_4,l_5) (l_2,l_4,l_6)(l_3,l_5,l_6)}
         {\bigl(l_1,(l_2,l_3),( l_4,l_5),(l_2,l_4,l_6),(l_3,l_5,l_6)\bigr)}{\cdot}
    \frac{l_2 l_3(l_6,l_4) (l_5,l_6)}
         {\bigl(l_2,l_3(l_6,l_4),(l_6,l_5)\bigr)}{\cdot}[l_4,l_5,l_6]                                       \\
& = \frac{(l_4,l_5)(l_5,l_6)(l_6,l_4)[l_4,l_5,l_6]l_1 l_2 l_3 (l_2,l_3)(l_2,l_4,l_6) (l_3,l_5,l_6)}
         {\bigl((l_1,l_2,l_3,(l_4,l_5)),(l_2,l_4,l_6,(l_3,l_5,l_6))\bigr)
          \bigl(l_2,l_3,l_6,l_4,(l_6,l_5)\bigr)} \\
& = \begin{multlined}[t]
        \frac{l_4l_5l_6(l_4,l_5,l_6)l_1l_2l_3(l_2,l_3)(l_2,l_6,l_4)(l_5,l_6,l_3)}
         {\bigl((l_1,l_2,l_3,l_4,l_5),(l_2,l_4,l_6, l_3,l_5)\bigr)
                (l_2,l_3,l_6,l_4,l_6,l_5)}{\cdot}\\
         \bigl[(l_4l_5)(l_5,l_6)(l_6,l_4)[l_4,l_6,l_5] = l_4l_5l_6(l_4,l_5,l_6)\bigr]
    \end{multlined}                                                                         \\
& = \frac{l_1 l_2 l_3 l_4 l_5 l_6 (l_2,l_3)(l_2,l_4,l_6)(l_3,l_5,l_6)(l_4, l_5, l_6)}
         {((l_1,l_2,l_3,l_4,l_5 ),(l_2,l_3,l_4, l_5,l_6))(l_2,l_3,l_4,l_5,l_6)}
\end{aligned}
    \end{equation}
\end{document}

enter image description here

A case with smaller (standard article) \textwidth:

\documentclass{article}
%\usepackage{newtxmath}
\usepackage{mathtools}

\begin{document}
    \begin{equation}\label{eq:longequation}
\begin{aligned}
Q_{K_4}
& = \begin{multlined}[t]
    \bigl[l_1,(l_2,l_3),(l_4,l_5),(l_2,l_6,l_4),(l_5,l_6,l_3)\bigr]{\cdot}  \\
    \bigl[l_2,l_3,(l_6,l_4),(l_6,l_5)].[l_4,l_6,l_5\bigr]                                   
    \end{multlined}                                                                          \\
& = \begin{multlined}[t]
    \frac{l_1 (l_2,l_3)(l_4,l_5) (l_2,l_4,l_6)(l_3,l_5,l_6)}
         {\bigl(l_1,(l_2,l_3),( l_4,l_5),(l_2,l_4,l_6),(l_3,l_5,l_6)\bigr)}{\cdot}\\
    \frac{l_2 l_3(l_6,l_4) (l_5,l_6)}
         {\bigl(l_2,l_3(l_6,l_4),(l_6,l_5)\bigr)}{\cdot}[l_4,l_5,l_6]                     
    \end{multlined}                                                                          \\
& = \frac{(l_4,l_5)(l_5,l_6)(l_6,l_4)[l_4,l_5,l_6]l_1 l_2 l_3 (l_2,l_3)(l_2,l_4,l_6) (l_3,l_5,l_6)}
         {\bigl((l_1,l_2,l_3,(l_4,l_5)),(l_2,l_4,l_6,(l_3,l_5,l_6))\bigr)
          \bigl(l_2,l_3,l_6,l_4,(l_6,l_5)\bigr)} \\
& = \begin{multlined}[t]
        \frac{l_4l_5l_6(l_4,l_5,l_6)l_1l_2l_3(l_2,l_3)(l_2,l_6,l_4)(l_5,l_6,l_3)}
         {\bigl((l_1,l_2,l_3,l_4,l_5),(l_2,l_4,l_6, l_3,l_5)\bigr)
                (l_2,l_3,l_6,l_4,l_6,l_5)}{\cdot}\\
         \bigl[(l_4l_5)(l_5,l_6)(l_6,l_4)[l_4,l_6,l_5] = l_4l_5l_6(l_4,l_5,l_6)\bigr]
    \end{multlined}                                                                         \\
& = \frac{l_1 l_2 l_3 l_4 l_5 l_6 (l_2,l_3)(l_2,l_4,l_6)(l_3,l_5,l_6)(l_4, l_5, l_6)}
         {((l_1,l_2,l_3,l_4,l_5 ),(l_2,l_3,l_4, l_5,l_6))(l_2,l_3,l_4,l_5,l_6)}
\end{aligned}
    \end{equation}
\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

Not the answer you're looking for? Browse other questions tagged or ask your own question.