AnswerBun.com

Indentation of the align environment

TeX - LaTeX Asked by raf on August 29, 2020

My code:

begin{itemize}
  item Case $1$ :
             begin{align*}
                         & 2^x-1 =0\
                         implies & 2^x = 1 \
                         implies & ln(2^x) = ln(1)  & text{ [taking natural  logarithm on both sides]} \ 
                        implies & x ln2 = 0 \
                        therefore & quad x = 0 
             end{align*}
  item Case $2$ :
               begin{align*}
                         & x+3 =0\
                         therefore & quad x = -3 
               end{align*}
  item Case $3$ :
             begin{align*}
                         & x-1 =0\
                         therefore &  quad x = 1 
             end{align*}
end{itemize}

Now the problem is I don’t want to center the equations in the cases 2 and 3. I want to keep them along the red line I have marked on its output.

enter image description here

How can I prove my code for such desired output?

2 Answers

One can use flalign to NOT center equations, but you need an extra && in at least one line to take up the right side of the page. The indentation is achieved using a minipage, effectively reducing textwidth to the remaining space.

documentclass{article}
usepackage{mathtools, amssymb}
usepackage{showframe}% alignment tool

newlength tempwidth
settowidth{tempwidth}{Case $2$ :}

begin{document}

begin{itemize}
  item Case $1$ :begin{minipage}[t]{dimexpr linewidth-tempwidth}
             abovedisplayskip=0pt% or even -baselineskip
             begin{flalign*}
                         & 2^x-1 =0 &&\
                         implies & 2^x = 1 \
                         implies & ln(2^x) = ln(1) & text{ [taking natural logarithm on both sides]} \
                        implies & x ln2 = 0 \
                        therefore & quad x = 0
             end{flalign*}end{minipage}
  item Case $2$ :begin{minipage}[t]{dimexpr linewidth-tempwidth}
             abovedisplayskip=0pt
             begin{flalign*}
                   phantom{implies} & x+3 =0 &&\
                         therefore & quad x = -3
             end{flalign*}end{minipage}
  item Case $3$ :begin{minipage}[t]{dimexpr linewidth-tempwidth}
             abovedisplayskip=0pt
             begin{flalign*}
                   phantom{implies} & x-1 =0 &&\
                         therefore & quad x = 1
             end{flalign*}end{minipage}
end{itemize}

end{document} 

demo

Answered by John Kormylo on August 29, 2020

Like this?

documentclass{article}
usepackage{mathtools, amssymb}

begin{document}

begin{itemize}
  item Case $1$ :
             $ begin{aligned}[t] \
                         & 2^x-1 =0\
                         implies & 2^x = 1 \
                         implies & ln(2^x) = ln(1) & text{ [taking natural logarithm on both sides]} \
                        implies & x ln2 = 0 \
                        therefore & quad x = 0
             end{aligned} $
  item Case $2$ :
              $ begin{aligned}[t] \
                   phantom{implies} & x+3 =0\
                         therefore & quad x = -3
               end{aligned} $
  item Case $3$ :
             $ begin{aligned}[t] \
                   phantom{implies} & x-1 =0\
                         therefore & quad x = 1
             end{aligned} $
end{itemize}

end{document} 

enter image description here

Answered by Bernard on August 29, 2020

Add your own answers!

Related Questions

Table horizontal lines are incomplete

1  Asked on October 18, 2020 by miguelpiquet

   

Wrong LaTeX output in arxiv

1  Asked on October 17, 2020 by youngmath

 

include sql files and use minted for highlighting

1  Asked on October 17, 2020 by volker-raschek

     

Why is my photo on the wrong side?

1  Asked on October 16, 2020 by muhashka

   

Issue combining makecell and cellcolor

2  Asked on October 15, 2020 by netim

     

Convert B5 to A4

1  Asked on October 15, 2020

   

Coloring all nodes that follow to a specific terminal node

1  Asked on October 13, 2020 by utku-trk

 

Can’t include references with biblatex

1  Asked on October 12, 2020 by joo-areias

   

Ask a Question

Get help from others!

© 2022 AnswerBun.com. All rights reserved. Sites we Love: PCI Database, MenuIva, UKBizDB, Menu Kuliner, Sharing RPP