Nested alignments
I want to make alignments that look like this:
which I have done by using
begin{align}
& frac{dx}{dt} = y qquad frac{dy}{dt} = x \
implies & frac{d^2x}{dt^2} = frac{d}{dt}bigg(frac{dx}{dt} bigg) \
& ; ; ; ; ; ; , = frac{dy}{dt} \
& ; ; ; ; ; ; , = x \
implies & frac{d^2x}{dt^2} = x \
implies & x(t) = Ae^t + Be^{-t}
end{align}
Of course, it's kinda silly to do ; ; ; ; ... and align them manually. However, when I try putting a begin{align} within another begin{align} like this
begin{align}
begin{align}
end{align}
end{align}
it gives me an error.
What is the correct way of doing this?
EDIT:
begin{alignat} still doesn't quite get me there:
begin{alignat}{2}
& frac{dx}{dt} = y qquad frac{dy}{dt} = x \
implies & frac{d^2x}{dt^2} && = frac{d}{dt}bigg(frac{dx}{dt} bigg) \
& && = frac{dy}{dt} \
& && = x \
implies & frac{d^2x}{dt^2} = x \
implies & x(t) = Ae^t + Be^{-t}
end{alignat}
gives
align nesting alignment
add a comment |
I want to make alignments that look like this:
which I have done by using
begin{align}
& frac{dx}{dt} = y qquad frac{dy}{dt} = x \
implies & frac{d^2x}{dt^2} = frac{d}{dt}bigg(frac{dx}{dt} bigg) \
& ; ; ; ; ; ; , = frac{dy}{dt} \
& ; ; ; ; ; ; , = x \
implies & frac{d^2x}{dt^2} = x \
implies & x(t) = Ae^t + Be^{-t}
end{align}
Of course, it's kinda silly to do ; ; ; ; ... and align them manually. However, when I try putting a begin{align} within another begin{align} like this
begin{align}
begin{align}
end{align}
end{align}
it gives me an error.
What is the correct way of doing this?
EDIT:
begin{alignat} still doesn't quite get me there:
begin{alignat}{2}
& frac{dx}{dt} = y qquad frac{dy}{dt} = x \
implies & frac{d^2x}{dt^2} && = frac{d}{dt}bigg(frac{dx}{dt} bigg) \
& && = frac{dy}{dt} \
& && = x \
implies & frac{d^2x}{dt^2} = x \
implies & x(t) = Ae^t + Be^{-t}
end{alignat}
gives
align nesting alignment
1
You should usealignat
rather thanalign
--alignat
allows for multiple&
'columns'
– user31729
Feb 2 at 18:52
How should I use alignat? There is this massive spacing between the columns
– glowstonetrees
Feb 2 at 19:10
Usually, the&
is used before=
– user31729
Feb 2 at 19:12
but I also want to align the implies
– glowstonetrees
Feb 2 at 19:13
Well, that's not forbidden, of course
– user31729
Feb 2 at 19:14
add a comment |
I want to make alignments that look like this:
which I have done by using
begin{align}
& frac{dx}{dt} = y qquad frac{dy}{dt} = x \
implies & frac{d^2x}{dt^2} = frac{d}{dt}bigg(frac{dx}{dt} bigg) \
& ; ; ; ; ; ; , = frac{dy}{dt} \
& ; ; ; ; ; ; , = x \
implies & frac{d^2x}{dt^2} = x \
implies & x(t) = Ae^t + Be^{-t}
end{align}
Of course, it's kinda silly to do ; ; ; ; ... and align them manually. However, when I try putting a begin{align} within another begin{align} like this
begin{align}
begin{align}
end{align}
end{align}
it gives me an error.
What is the correct way of doing this?
EDIT:
begin{alignat} still doesn't quite get me there:
begin{alignat}{2}
& frac{dx}{dt} = y qquad frac{dy}{dt} = x \
implies & frac{d^2x}{dt^2} && = frac{d}{dt}bigg(frac{dx}{dt} bigg) \
& && = frac{dy}{dt} \
& && = x \
implies & frac{d^2x}{dt^2} = x \
implies & x(t) = Ae^t + Be^{-t}
end{alignat}
gives
align nesting alignment
I want to make alignments that look like this:
which I have done by using
begin{align}
& frac{dx}{dt} = y qquad frac{dy}{dt} = x \
implies & frac{d^2x}{dt^2} = frac{d}{dt}bigg(frac{dx}{dt} bigg) \
& ; ; ; ; ; ; , = frac{dy}{dt} \
& ; ; ; ; ; ; , = x \
implies & frac{d^2x}{dt^2} = x \
implies & x(t) = Ae^t + Be^{-t}
end{align}
Of course, it's kinda silly to do ; ; ; ; ... and align them manually. However, when I try putting a begin{align} within another begin{align} like this
begin{align}
begin{align}
end{align}
end{align}
it gives me an error.
What is the correct way of doing this?
EDIT:
begin{alignat} still doesn't quite get me there:
begin{alignat}{2}
& frac{dx}{dt} = y qquad frac{dy}{dt} = x \
implies & frac{d^2x}{dt^2} && = frac{d}{dt}bigg(frac{dx}{dt} bigg) \
& && = frac{dy}{dt} \
& && = x \
implies & frac{d^2x}{dt^2} = x \
implies & x(t) = Ae^t + Be^{-t}
end{alignat}
gives
align nesting alignment
align nesting alignment
edited Feb 2 at 19:07
glowstonetrees
asked Feb 2 at 18:50
glowstonetreesglowstonetrees
1184
1184
1
You should usealignat
rather thanalign
--alignat
allows for multiple&
'columns'
– user31729
Feb 2 at 18:52
How should I use alignat? There is this massive spacing between the columns
– glowstonetrees
Feb 2 at 19:10
Usually, the&
is used before=
– user31729
Feb 2 at 19:12
but I also want to align the implies
– glowstonetrees
Feb 2 at 19:13
Well, that's not forbidden, of course
– user31729
Feb 2 at 19:14
add a comment |
1
You should usealignat
rather thanalign
--alignat
allows for multiple&
'columns'
– user31729
Feb 2 at 18:52
How should I use alignat? There is this massive spacing between the columns
– glowstonetrees
Feb 2 at 19:10
Usually, the&
is used before=
– user31729
Feb 2 at 19:12
but I also want to align the implies
– glowstonetrees
Feb 2 at 19:13
Well, that's not forbidden, of course
– user31729
Feb 2 at 19:14
1
1
You should use
alignat
rather than align
-- alignat
allows for multiple &
'columns'– user31729
Feb 2 at 18:52
You should use
alignat
rather than align
-- alignat
allows for multiple &
'columns'– user31729
Feb 2 at 18:52
How should I use alignat? There is this massive spacing between the columns
– glowstonetrees
Feb 2 at 19:10
How should I use alignat? There is this massive spacing between the columns
– glowstonetrees
Feb 2 at 19:10
Usually, the
&
is used before =
– user31729
Feb 2 at 19:12
Usually, the
&
is used before =
– user31729
Feb 2 at 19:12
but I also want to align the implies
– glowstonetrees
Feb 2 at 19:13
but I also want to align the implies
– glowstonetrees
Feb 2 at 19:13
Well, that's not forbidden, of course
– user31729
Feb 2 at 19:14
Well, that's not forbidden, of course
– user31729
Feb 2 at 19:14
add a comment |
3 Answers
3
active
oldest
votes
You can use alignat
for this:
documentclass{article}
usepackage{amsmath}
begin{document}
begin{alignat*}{2}
&quad& frac{mathrm{d}x}{mathrm{d}t} &= y qquad frac{mathrm{d}y}{mathrm{d}t} = x \
implies && frac{mathrm{d}^2x}{mathrm{d}t^2} &= frac{mathrm{d}}{mathrm{d}t} biggl( frac{mathrm{d}x}{mathrm{d}t} biggr) \
&& &= frac{mathrm{d}y}{mathrm{d}t} \
&& &= x \
implies && frac{mathrm{d}^2x}{mathrm{d}t^2} &= x \
implies && x(t) &= Ae^t + Be^{-t}
end{alignat*}
end{document}
I'm not sure why you used upright d's when the OP uses italic ones. Even I conform toln
when the OP does on Math.SE, go figure!;-)
– egreg
Feb 2 at 23:19
add a comment |
I wouldn't perform any alignment on the implies
symbols. To provide (visual) clarity of exposition, it suffices to perform alignment on the first instance of =
in each line.
I can't help but remark that the 5th line seems to be redundant.
documentclass{article}
usepackage{amsmath}
begin{document}
begin{align}
frac{dx}{dt} &= y qquad frac{dy}{dt} = x \
implies frac{d^2x}{dt^2} &= frac{d}{dt}biggl(frac{dx}{dt}biggr) \
&= frac{dy}{dt} \
&= x \
implies frac{d^2x}{dt^2} &= x \
implies x(t) &= Ae^t + Be^{-t}
end{align}
end{document}
add a comment |
Nesting align
environments directly doesn't work, because align
environments start display math, so they can not be used inside math mode. Lucky for you, amsmath
includes aligned
as an alternative for cases like this (The t
tells LaTeX to align the top line with the content outside of the environment):
documentclass{article}
usepackage{amsmath}
begin{document}
begin{align}
& frac{dx}{dt} = y qquad frac{dy}{dt} = x \
implies & begin{aligned}[t]
frac{d^2x}{dt^2} &= frac{d}{dt}bigg(frac{dx}{dt} bigg) \
&= frac{dy}{dt} \
&= x
end{aligned}\
implies & frac{d^2x}{dt^2} = x \
implies & x(t) = Ae^t + Be^{-t}
end{align}
end{document}
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "85"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f473083%2fnested-alignments%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
3 Answers
3
active
oldest
votes
3 Answers
3
active
oldest
votes
active
oldest
votes
active
oldest
votes
You can use alignat
for this:
documentclass{article}
usepackage{amsmath}
begin{document}
begin{alignat*}{2}
&quad& frac{mathrm{d}x}{mathrm{d}t} &= y qquad frac{mathrm{d}y}{mathrm{d}t} = x \
implies && frac{mathrm{d}^2x}{mathrm{d}t^2} &= frac{mathrm{d}}{mathrm{d}t} biggl( frac{mathrm{d}x}{mathrm{d}t} biggr) \
&& &= frac{mathrm{d}y}{mathrm{d}t} \
&& &= x \
implies && frac{mathrm{d}^2x}{mathrm{d}t^2} &= x \
implies && x(t) &= Ae^t + Be^{-t}
end{alignat*}
end{document}
I'm not sure why you used upright d's when the OP uses italic ones. Even I conform toln
when the OP does on Math.SE, go figure!;-)
– egreg
Feb 2 at 23:19
add a comment |
You can use alignat
for this:
documentclass{article}
usepackage{amsmath}
begin{document}
begin{alignat*}{2}
&quad& frac{mathrm{d}x}{mathrm{d}t} &= y qquad frac{mathrm{d}y}{mathrm{d}t} = x \
implies && frac{mathrm{d}^2x}{mathrm{d}t^2} &= frac{mathrm{d}}{mathrm{d}t} biggl( frac{mathrm{d}x}{mathrm{d}t} biggr) \
&& &= frac{mathrm{d}y}{mathrm{d}t} \
&& &= x \
implies && frac{mathrm{d}^2x}{mathrm{d}t^2} &= x \
implies && x(t) &= Ae^t + Be^{-t}
end{alignat*}
end{document}
I'm not sure why you used upright d's when the OP uses italic ones. Even I conform toln
when the OP does on Math.SE, go figure!;-)
– egreg
Feb 2 at 23:19
add a comment |
You can use alignat
for this:
documentclass{article}
usepackage{amsmath}
begin{document}
begin{alignat*}{2}
&quad& frac{mathrm{d}x}{mathrm{d}t} &= y qquad frac{mathrm{d}y}{mathrm{d}t} = x \
implies && frac{mathrm{d}^2x}{mathrm{d}t^2} &= frac{mathrm{d}}{mathrm{d}t} biggl( frac{mathrm{d}x}{mathrm{d}t} biggr) \
&& &= frac{mathrm{d}y}{mathrm{d}t} \
&& &= x \
implies && frac{mathrm{d}^2x}{mathrm{d}t^2} &= x \
implies && x(t) &= Ae^t + Be^{-t}
end{alignat*}
end{document}
You can use alignat
for this:
documentclass{article}
usepackage{amsmath}
begin{document}
begin{alignat*}{2}
&quad& frac{mathrm{d}x}{mathrm{d}t} &= y qquad frac{mathrm{d}y}{mathrm{d}t} = x \
implies && frac{mathrm{d}^2x}{mathrm{d}t^2} &= frac{mathrm{d}}{mathrm{d}t} biggl( frac{mathrm{d}x}{mathrm{d}t} biggr) \
&& &= frac{mathrm{d}y}{mathrm{d}t} \
&& &= x \
implies && frac{mathrm{d}^2x}{mathrm{d}t^2} &= x \
implies && x(t) &= Ae^t + Be^{-t}
end{alignat*}
end{document}
answered Feb 2 at 19:32


WernerWerner
450k7210001709
450k7210001709
I'm not sure why you used upright d's when the OP uses italic ones. Even I conform toln
when the OP does on Math.SE, go figure!;-)
– egreg
Feb 2 at 23:19
add a comment |
I'm not sure why you used upright d's when the OP uses italic ones. Even I conform toln
when the OP does on Math.SE, go figure!;-)
– egreg
Feb 2 at 23:19
I'm not sure why you used upright d's when the OP uses italic ones. Even I conform to
ln
when the OP does on Math.SE, go figure! ;-)
– egreg
Feb 2 at 23:19
I'm not sure why you used upright d's when the OP uses italic ones. Even I conform to
ln
when the OP does on Math.SE, go figure! ;-)
– egreg
Feb 2 at 23:19
add a comment |
I wouldn't perform any alignment on the implies
symbols. To provide (visual) clarity of exposition, it suffices to perform alignment on the first instance of =
in each line.
I can't help but remark that the 5th line seems to be redundant.
documentclass{article}
usepackage{amsmath}
begin{document}
begin{align}
frac{dx}{dt} &= y qquad frac{dy}{dt} = x \
implies frac{d^2x}{dt^2} &= frac{d}{dt}biggl(frac{dx}{dt}biggr) \
&= frac{dy}{dt} \
&= x \
implies frac{d^2x}{dt^2} &= x \
implies x(t) &= Ae^t + Be^{-t}
end{align}
end{document}
add a comment |
I wouldn't perform any alignment on the implies
symbols. To provide (visual) clarity of exposition, it suffices to perform alignment on the first instance of =
in each line.
I can't help but remark that the 5th line seems to be redundant.
documentclass{article}
usepackage{amsmath}
begin{document}
begin{align}
frac{dx}{dt} &= y qquad frac{dy}{dt} = x \
implies frac{d^2x}{dt^2} &= frac{d}{dt}biggl(frac{dx}{dt}biggr) \
&= frac{dy}{dt} \
&= x \
implies frac{d^2x}{dt^2} &= x \
implies x(t) &= Ae^t + Be^{-t}
end{align}
end{document}
add a comment |
I wouldn't perform any alignment on the implies
symbols. To provide (visual) clarity of exposition, it suffices to perform alignment on the first instance of =
in each line.
I can't help but remark that the 5th line seems to be redundant.
documentclass{article}
usepackage{amsmath}
begin{document}
begin{align}
frac{dx}{dt} &= y qquad frac{dy}{dt} = x \
implies frac{d^2x}{dt^2} &= frac{d}{dt}biggl(frac{dx}{dt}biggr) \
&= frac{dy}{dt} \
&= x \
implies frac{d^2x}{dt^2} &= x \
implies x(t) &= Ae^t + Be^{-t}
end{align}
end{document}
I wouldn't perform any alignment on the implies
symbols. To provide (visual) clarity of exposition, it suffices to perform alignment on the first instance of =
in each line.
I can't help but remark that the 5th line seems to be redundant.
documentclass{article}
usepackage{amsmath}
begin{document}
begin{align}
frac{dx}{dt} &= y qquad frac{dy}{dt} = x \
implies frac{d^2x}{dt^2} &= frac{d}{dt}biggl(frac{dx}{dt}biggr) \
&= frac{dy}{dt} \
&= x \
implies frac{d^2x}{dt^2} &= x \
implies x(t) &= Ae^t + Be^{-t}
end{align}
end{document}
answered Feb 2 at 19:37


MicoMico
287k32391779
287k32391779
add a comment |
add a comment |
Nesting align
environments directly doesn't work, because align
environments start display math, so they can not be used inside math mode. Lucky for you, amsmath
includes aligned
as an alternative for cases like this (The t
tells LaTeX to align the top line with the content outside of the environment):
documentclass{article}
usepackage{amsmath}
begin{document}
begin{align}
& frac{dx}{dt} = y qquad frac{dy}{dt} = x \
implies & begin{aligned}[t]
frac{d^2x}{dt^2} &= frac{d}{dt}bigg(frac{dx}{dt} bigg) \
&= frac{dy}{dt} \
&= x
end{aligned}\
implies & frac{d^2x}{dt^2} = x \
implies & x(t) = Ae^t + Be^{-t}
end{align}
end{document}
add a comment |
Nesting align
environments directly doesn't work, because align
environments start display math, so they can not be used inside math mode. Lucky for you, amsmath
includes aligned
as an alternative for cases like this (The t
tells LaTeX to align the top line with the content outside of the environment):
documentclass{article}
usepackage{amsmath}
begin{document}
begin{align}
& frac{dx}{dt} = y qquad frac{dy}{dt} = x \
implies & begin{aligned}[t]
frac{d^2x}{dt^2} &= frac{d}{dt}bigg(frac{dx}{dt} bigg) \
&= frac{dy}{dt} \
&= x
end{aligned}\
implies & frac{d^2x}{dt^2} = x \
implies & x(t) = Ae^t + Be^{-t}
end{align}
end{document}
add a comment |
Nesting align
environments directly doesn't work, because align
environments start display math, so they can not be used inside math mode. Lucky for you, amsmath
includes aligned
as an alternative for cases like this (The t
tells LaTeX to align the top line with the content outside of the environment):
documentclass{article}
usepackage{amsmath}
begin{document}
begin{align}
& frac{dx}{dt} = y qquad frac{dy}{dt} = x \
implies & begin{aligned}[t]
frac{d^2x}{dt^2} &= frac{d}{dt}bigg(frac{dx}{dt} bigg) \
&= frac{dy}{dt} \
&= x
end{aligned}\
implies & frac{d^2x}{dt^2} = x \
implies & x(t) = Ae^t + Be^{-t}
end{align}
end{document}
Nesting align
environments directly doesn't work, because align
environments start display math, so they can not be used inside math mode. Lucky for you, amsmath
includes aligned
as an alternative for cases like this (The t
tells LaTeX to align the top line with the content outside of the environment):
documentclass{article}
usepackage{amsmath}
begin{document}
begin{align}
& frac{dx}{dt} = y qquad frac{dy}{dt} = x \
implies & begin{aligned}[t]
frac{d^2x}{dt^2} &= frac{d}{dt}bigg(frac{dx}{dt} bigg) \
&= frac{dy}{dt} \
&= x
end{aligned}\
implies & frac{d^2x}{dt^2} = x \
implies & x(t) = Ae^t + Be^{-t}
end{align}
end{document}
answered Feb 2 at 19:18
Marcel KrügerMarcel Krüger
13k11636
13k11636
add a comment |
add a comment |
Thanks for contributing an answer to TeX - LaTeX Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f473083%2fnested-alignments%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
1
You should use
alignat
rather thanalign
--alignat
allows for multiple&
'columns'– user31729
Feb 2 at 18:52
How should I use alignat? There is this massive spacing between the columns
– glowstonetrees
Feb 2 at 19:10
Usually, the
&
is used before=
– user31729
Feb 2 at 19:12
but I also want to align the implies
– glowstonetrees
Feb 2 at 19:13
Well, that's not forbidden, of course
– user31729
Feb 2 at 19:14