TransWikia.com

How to shift text left in align environment

TeX - LaTeX Asked on July 20, 2021

I want to align the following text left.

Latex command:

begin{align*}
x1&=x~(text{$1$ is multiplicative identity})
&=x+x~(text{since}~text{ a monosemiring with an identity is idempotent too})
&=x+x1&=x+x^21&=x(1+x)text{i.e}., x1 &=x(1+x)
text{or }1&=1+x~text{by cancellation law}
text{Hence, $R$ is additively absorbing}.
end{align*}

2 Answers

Here is a proposal using intertext{} instead of text{}.

documentclass{article}
usepackage{mathtools} % <-- also loads amsmath.

begin{document}

section*{Your Code}
begin{align*}
x1&=x~(text{$1$ is multiplicative identity})
&=x+x~(text{since}~text{ a monosemiring with an identity is idempotent too})
&=x+x1&=x+x^21&=x(1+x)text{i.e}., x1 &=x(1+x)
text{or }1&=1+x~text{by cancellation law}
text{Hence, $R$ is additively absorbing}.
end{align*}

section*{Proposal}
begin{align*}
x1&=x~(text{$1$ is multiplicative identity})
&=x+x~(text{since}~text{ a monosemiring with an identity is idempotent too})
&=x+x1&=x+x^21&=x(1+x)text{i.e}., x1 &=x(1+x)
text{or }1&=1+x~text{by cancellation law}
intertext{Hence, $R$ is additively absorbing}. % <-- intertext
end{align*}

end{document}

enter image description here

Update

This update is motivated by Barbara's (hurtful :)) comment:

This works only by accident. The last line, when included in the alignment, forces the alignment point to the end of that sentence. Removing it from the alignment then allows the remaining lines to be centered as a group, and if the second line were not so long, the group would not move so far to the left. In the present case, just moving the last line entirely out of the alignment/display would work as well.

(Bold formatting is done by Manuel)

I also add (steal) the shortintertext approach that Bernard uses to have a more complete list of approaches.

documentclass{article}
usepackage{mathtools} % <-- also loads amsmath.

begin{document}

section*{Your Code}
begin{align*}
x1&=x~(text{$1$ is multiplicative identity})
&=x+x~(text{since}~text{ a monosemiring with an identity is idempotent too})
&=x+x1&=x+x^21&=x(1+x)text{i.e}., x1 &=x(1+x)
text{or }1&=1+x~text{by cancellation law}
text{Hence, $R$ is additively absorbing}.
end{align*}

section*{Proposal 1}
begin{align*}
x1&=x~(text{$1$ is multiplicative identity})
&=x+x~(text{since}~text{ a monosemiring with an identity is idempotent too})
&=x+x1&=x+x^21&=x(1+x)text{i.e}., x1 &=x(1+x)
text{or }1&=1+x~text{by cancellation law}
intertext{Hence, $R$ is additively absorbing}. % <-- intertext (amsmath package)
end{align*}

section*{Proposal 2 (Barbara Beeton)}
begin{align*}
x1&=x~(text{$1$ is multiplicative identity})
&=x+x~(text{since}~text{ a monosemiring with an identity is idempotent too})
&=x+x1&=x+x^21&=x(1+x)text{i.e}., x1 &=x(1+x)
text{or }1&=1+x~text{by cancellation law}
end{align*}
Hence, $R$ is additively absorbing

section*{Proposal 3 (Bernard)}
begin{align*}
x1&=x~(text{$1$ is multiplicative identity})
&=x+x~(text{since}~text{ a monosemiring with an identity is idempotent too})
&=x+x1&=x+x^21&=x(1+x)text{i.e}., x1 &=x(1+x)
text{or }1&=1+x~text{by cancellation law}
shortintertext{Hence, $R$ is additively absorbing}. % <-- shortintertext (mathtools package)
end{align*}

end{document}

enter image description here enter image description here

Correct answer by Dr. Manuel Kuehner on July 20, 2021

I propose to use the fleqn environment from nccmath and for the last line, the shortintertext command from mathtools:

documentclass{article}
usepackage{nccmath}
usepackage{mathtools}
usepackage[showframe]{geometry}

begin{document}

begin{fleqn}
begin{align*}
x,1&=xquad(text{$1$ is multiplicative identity})
&=x+xquad(text{since a monosemiring with an identity is idempotent too})
&=x+x1&=x+x^21 &=x(1+x)text{i.e., } x,1 &=x(1+x)
text{or }1&=1+xquadtext{by cancellation law}
shortintertext{Hence, $R$ is additively absorbing}.
end{align*}
end{fleqn}

end{document} 

enter image description here

Answered by Bernard on July 20, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP