10

I have 2 equations which looks like:

A = B+ C + D... , While x is true.

The problem is, the equation is quite big which goes on for 2 lines. How do I give an indent to the second line so it looks like:

A = B + C + D + E + F +
    G + H + I + ... , while x is true.
1
  • You can use the align or array environment.
    – azetina
    Nov 29, 2013 at 15:37

4 Answers 4

10

You can use the align environment if you want. Remove the * to get the numbered equation form. The following is MWE:

\documentclass{article}
\usepackage{amsmath}
\begin{document}
\begin{align*}
A {}={} & B + C + D + E + F +\\
        & G + H + I + \dotsb, \quad \text{while $x$ is true.}
\end{align*}
\end{document}

Another flavor would be like:

\[
\begin{aligned}
A {}={} & B + C + D + E + F +\\
        & G + H + I + \dotsb, \quad \text{while $x$ is true.}
\end{aligned}
\]

or

\[
\begin{array}{r@{}c@{}l}
A   &{}={}& B + C + D + E + F +\\
    &     & G + H + I + \dotsb, \quad \text{while $x$ is true.}
\end{array}
\]

This does not give any numbered version but keeps the alignment. I recommend you read the amsmath documentation and other math related sources to get acquainted with alignments in equations. For example, here in TeX.SX you can make a quick search and you will see several examples of alignment. For instance if I search alignment in equations I would get lots of examples. (click me)

I will also invite you to read the following links:

  1. https://tex.stackexchange.com/a/147149/10898
  2. https://tex.stackexchange.com/a/122497/10898
4
  • If you remove the * you get two numbered equations. Nov 29, 2013 at 15:47
  • @karlkoeller Oops guess am still sleepy......
    – azetina
    Nov 29, 2013 at 15:49
  • Thank you. Your first example worked. I do not have a lot of equations, just a few here and there. Nov 29, 2013 at 16:16
  • @ctrl-shift-esc glad to have helped. happy texing
    – azetina
    Nov 29, 2013 at 16:18
10

Try something like

\documentclass{article}
\usepackage{amsmath}

\begin{document}
\begin{equation}
\begin{split}
  A ={} & B + C + D + E + F + \\
        & G + H + I + \dots, \quad\text{while $x$ is true}.
\end{split}
\end{equation}
\end{document} 

Output

enter image description here

If you don't want the equation to be numbered use equation* instead of equation.

As Svend suggested in the comment, in this case it is probably better using \dotsb instead of \dots.

enter image description here

2
  • \dots --> \dotsb. Nov 29, 2013 at 15:56
  • @SvendTveskæg Yes, in this case it is probably the best choice. Nov 29, 2013 at 16:02
2

You also may use the multlined environment if you load the mathtools package (don't load amsmath in that case, it does it for you) ; this code lets you shift the second equation with respect to the first one, instead of aligning them

\begin{equation}  
  \begin{multlined}  
   A = B + C + D + E + F + \\\  
   G + H + I + \dots,\qquad \text{\rlap{while $x$ is true. }}  
  \end{multlined} 
\end{equation}

Here is the result:enter image description here

1
  • By the way, how does one incorporate a nice-looking output? I converted my pdf to a png, but the result displays poorly.
    – Bernard
    Nov 29, 2013 at 21:59
1

Just for comparing Karlkoeller's answer that used split with mine that uses aligned.

\documentclass[preview,border=12pt]{standalone}
\usepackage[a5paper,landscape]{geometry}
\usepackage{amsmath}

\begin{document}

\begin{minipage}{.5\linewidth}
\hrulefill
\begin{equation}  
\begin{split}
A = {} 
& B + C + D + \\
& E + F + \\
& G + H + I + \dots, \quad\text{using split}.
\end{split}
\end{equation}
\hrulefill
\end{minipage}
\begin{minipage}{.5\linewidth}
\hrulefill
\begin{equation}  
A = 
\!
\begin{aligned}[t]
& B + C + D + \\
& E + F + \\
& G + H + I + \dots, \quad\text{using aligned}.
\end{aligned}
\end{equation}
\hrulefill
\end{minipage}

\end{document} 

enter image description here

2
  • I suggest making the following adjustment & E + F +{} \\ to fine tune the alignment.
    – azetina
    Nov 29, 2013 at 22:35
  • @azetina: That is correct. I will edit later. Nov 29, 2013 at 23:05

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .