What am I doing wrong in this use of split?
I'm doing something wrong in the code below that makes the last equation not be written on a line by itself. What I'm trying to do is to split the penultimate equation into two lines. But this happens:
The last equation continues on the right for some reason. Can you spot what is the problem?
usepackage{amsmath}
newcommand{q}[2]{langle #1 | #2 rangle}
newcommand{qr}[1]{|#1rangle}
newcommand{ql}[1]{langle #1|}
DeclareMathOperator{mdc}{mdc}
begin{document}
begin{align*}
qr{psi_2} &= U_f qr{psi_1}\
&= U_f frac{1}{sqrt{2^4}} left[qr0 + qr1 + qr2+qr3+qr4+qr5+qr6 + qr{7}right] qr0 qr0\
&= U_f frac{1}{sqrt{2^4}} left[qr0qr0 + qr1qr0 + qr2qr0+qr3qr0+qr4qr0+qr5qr0+qr6qr0 + qr{7}qr0right] qr0\
begin{split}
&= frac{1}{sqrt{2^4}} big[U_fqr0qr0 + U_fqr1qr0 + U_fqr2qr0+U_fqr3qr0 \
&qquadqquad + U_fqr4qr0+U_fqr5qr0+U_fqr6qr0 + U_fqr{7}qr0big] qr0\
end{split}
&= frac{1}{sqrt{2^4}} left[qr0qr2 + qr1qr4 + ... + qr{i}qr{f(i)} + ... + qr{7}qr1right] qr0,
end{align*}
end{document}
align split
add a comment |
I'm doing something wrong in the code below that makes the last equation not be written on a line by itself. What I'm trying to do is to split the penultimate equation into two lines. But this happens:
The last equation continues on the right for some reason. Can you spot what is the problem?
usepackage{amsmath}
newcommand{q}[2]{langle #1 | #2 rangle}
newcommand{qr}[1]{|#1rangle}
newcommand{ql}[1]{langle #1|}
DeclareMathOperator{mdc}{mdc}
begin{document}
begin{align*}
qr{psi_2} &= U_f qr{psi_1}\
&= U_f frac{1}{sqrt{2^4}} left[qr0 + qr1 + qr2+qr3+qr4+qr5+qr6 + qr{7}right] qr0 qr0\
&= U_f frac{1}{sqrt{2^4}} left[qr0qr0 + qr1qr0 + qr2qr0+qr3qr0+qr4qr0+qr5qr0+qr6qr0 + qr{7}qr0right] qr0\
begin{split}
&= frac{1}{sqrt{2^4}} big[U_fqr0qr0 + U_fqr1qr0 + U_fqr2qr0+U_fqr3qr0 \
&qquadqquad + U_fqr4qr0+U_fqr5qr0+U_fqr6qr0 + U_fqr{7}qr0big] qr0\
end{split}
&= frac{1}{sqrt{2^4}} left[qr0qr2 + qr1qr4 + ... + qr{i}qr{f(i)} + ... + qr{7}qr1right] qr0,
end{align*}
end{document}
align split
2
I'm not quite sure what you're aiming for, but have you tried commenting out thebegin{split}
andend{split}
, and leaving the inner two lines alone?
– Teepeemm
11 hours ago
Wow. Why am I using split in the first place? I thought this wouldn't work at all.
– Joep Awinita
11 hours ago
Needless to say, @Teepeemm, you're answered the question completely.
– Joep Awinita
11 hours ago
But a two line comment takes far less effort than a complete answer. I'm content with letting those wanting to take the time to also take the points.
– Teepeemm
10 hours ago
add a comment |
I'm doing something wrong in the code below that makes the last equation not be written on a line by itself. What I'm trying to do is to split the penultimate equation into two lines. But this happens:
The last equation continues on the right for some reason. Can you spot what is the problem?
usepackage{amsmath}
newcommand{q}[2]{langle #1 | #2 rangle}
newcommand{qr}[1]{|#1rangle}
newcommand{ql}[1]{langle #1|}
DeclareMathOperator{mdc}{mdc}
begin{document}
begin{align*}
qr{psi_2} &= U_f qr{psi_1}\
&= U_f frac{1}{sqrt{2^4}} left[qr0 + qr1 + qr2+qr3+qr4+qr5+qr6 + qr{7}right] qr0 qr0\
&= U_f frac{1}{sqrt{2^4}} left[qr0qr0 + qr1qr0 + qr2qr0+qr3qr0+qr4qr0+qr5qr0+qr6qr0 + qr{7}qr0right] qr0\
begin{split}
&= frac{1}{sqrt{2^4}} big[U_fqr0qr0 + U_fqr1qr0 + U_fqr2qr0+U_fqr3qr0 \
&qquadqquad + U_fqr4qr0+U_fqr5qr0+U_fqr6qr0 + U_fqr{7}qr0big] qr0\
end{split}
&= frac{1}{sqrt{2^4}} left[qr0qr2 + qr1qr4 + ... + qr{i}qr{f(i)} + ... + qr{7}qr1right] qr0,
end{align*}
end{document}
align split
I'm doing something wrong in the code below that makes the last equation not be written on a line by itself. What I'm trying to do is to split the penultimate equation into two lines. But this happens:
The last equation continues on the right for some reason. Can you spot what is the problem?
usepackage{amsmath}
newcommand{q}[2]{langle #1 | #2 rangle}
newcommand{qr}[1]{|#1rangle}
newcommand{ql}[1]{langle #1|}
DeclareMathOperator{mdc}{mdc}
begin{document}
begin{align*}
qr{psi_2} &= U_f qr{psi_1}\
&= U_f frac{1}{sqrt{2^4}} left[qr0 + qr1 + qr2+qr3+qr4+qr5+qr6 + qr{7}right] qr0 qr0\
&= U_f frac{1}{sqrt{2^4}} left[qr0qr0 + qr1qr0 + qr2qr0+qr3qr0+qr4qr0+qr5qr0+qr6qr0 + qr{7}qr0right] qr0\
begin{split}
&= frac{1}{sqrt{2^4}} big[U_fqr0qr0 + U_fqr1qr0 + U_fqr2qr0+U_fqr3qr0 \
&qquadqquad + U_fqr4qr0+U_fqr5qr0+U_fqr6qr0 + U_fqr{7}qr0big] qr0\
end{split}
&= frac{1}{sqrt{2^4}} left[qr0qr2 + qr1qr4 + ... + qr{i}qr{f(i)} + ... + qr{7}qr1right] qr0,
end{align*}
end{document}
align split
align split
asked 11 hours ago
Joep AwinitaJoep Awinita
1256
1256
2
I'm not quite sure what you're aiming for, but have you tried commenting out thebegin{split}
andend{split}
, and leaving the inner two lines alone?
– Teepeemm
11 hours ago
Wow. Why am I using split in the first place? I thought this wouldn't work at all.
– Joep Awinita
11 hours ago
Needless to say, @Teepeemm, you're answered the question completely.
– Joep Awinita
11 hours ago
But a two line comment takes far less effort than a complete answer. I'm content with letting those wanting to take the time to also take the points.
– Teepeemm
10 hours ago
add a comment |
2
I'm not quite sure what you're aiming for, but have you tried commenting out thebegin{split}
andend{split}
, and leaving the inner two lines alone?
– Teepeemm
11 hours ago
Wow. Why am I using split in the first place? I thought this wouldn't work at all.
– Joep Awinita
11 hours ago
Needless to say, @Teepeemm, you're answered the question completely.
– Joep Awinita
11 hours ago
But a two line comment takes far less effort than a complete answer. I'm content with letting those wanting to take the time to also take the points.
– Teepeemm
10 hours ago
2
2
I'm not quite sure what you're aiming for, but have you tried commenting out the
begin{split}
and end{split}
, and leaving the inner two lines alone?– Teepeemm
11 hours ago
I'm not quite sure what you're aiming for, but have you tried commenting out the
begin{split}
and end{split}
, and leaving the inner two lines alone?– Teepeemm
11 hours ago
Wow. Why am I using split in the first place? I thought this wouldn't work at all.
– Joep Awinita
11 hours ago
Wow. Why am I using split in the first place? I thought this wouldn't work at all.
– Joep Awinita
11 hours ago
Needless to say, @Teepeemm, you're answered the question completely.
– Joep Awinita
11 hours ago
Needless to say, @Teepeemm, you're answered the question completely.
– Joep Awinita
11 hours ago
But a two line comment takes far less effort than a complete answer. I'm content with letting those wanting to take the time to also take the points.
– Teepeemm
10 hours ago
But a two line comment takes far less effort than a complete answer. I'm content with letting those wanting to take the time to also take the points.
– Teepeemm
10 hours ago
add a comment |
3 Answers
3
active
oldest
votes
In addition to getting rid of the unneeded split
environment, you may want to (a) typeset the U_f
terms more compactly, i.e., as U_{!f}
, (b) replace various left[
and right]
directives with bigl[
and bigr]
, and (c) replace ...
with dots
.
documentclass{article}
usepackage{mathtools} % for 'DeclarePairedDelimiter' macro
DeclarePairedDelimiterqrlvertrangle
newcommand{Uf}{U_{!f}}
begin{document}
begin{align*}
qr{psi_2}
&= Uf qr{psi_1}\
&= Uf frac{1}{sqrt{2^4}}
bigl[qr0 + qr1 + qr2+qr3 +qr4
+qr5 +qr6 + qr7bigr] qr0 qr0\
&= Uf frac{1}{sqrt{2^4}}
bigl[qr0qr0 + qr1qr0 + qr2qr0+qr3qr0
+qr4qr0+qr5qr0+qr6qr0 + qr7qr0bigr] qr0\
&= frac{1}{sqrt{2^4}}
bigl[Ufqr0qr0 + Ufqr1qr0 + Ufqr2qr0+Ufqr3qr0 \
&qquadqquad
+ Ufqr4qr0+Ufqr5qr0+Ufqr6qr0
+ Ufqr7qr0bigr] qr0\
&= frac{1}{sqrt{2^4}}
bigl[qr0qr2 + qr1qr4 + dots
+ qr{i}qr{f(i)} + dots + qr7qr1bigr] qr0,
end{align*}
end{document}
add a comment |
I suggest using the multlined
environment from mathtools
, and the DeclarePairedDelimiter
command from the same package, which will produce scaling , qr
and ql
:
documentclass{article}
usepackage{mathtools}
DeclarePairedDelimiterXnorm[1]lVertrVert{ifblank{#1}{: · :}{#1}}
DeclarePairedDelimiterXPP{twonorm }[1]{}{lVert}{rVert}{_{2}}{ifblank{#1}{: · :}{#1}}
DeclarePairedDelimiterXq[2]{langle}{rangle}%
{#1,delimsizevert,mathopen{}#2}
DeclarePairedDelimiter{qr}vertrangle
DeclarePairedDelimiter{ql}langle rvert
DeclareMathOperator{mdc}{mdc}
begin{document}
begin{align*}
qr{psi_2} &= U_f qr{psi_1}\
&= U_f frac{1}{sqrt{2^4}} bigl[qr0 + qr1 + qr2+qr3+qr4+qr5+qr6 + qr{7}bigr] qr0 qr0\
&= U_f frac{1}{sqrt{2^4}}bigl[qr0qr0 + qr1qr0 + qr2qr0+qr3qr0+qr4qr0+qr5qr0+qr6qr0 + qr{7}qr0bigr] qr0\
&= begin{multlined}[t] frac{1}{sqrt{2^4}} bigl[U_fqr0qr0 + U_fqr1qr0 + U_fqr2qr0+U_fqr3qr0 \[-1.5ex]
qquad+ U_fqr4qr0+U_fqr5qr0+U_fqr6qr0 + U_fqr{7}qr0bigr] qr0
end{multlined}\
&= frac{1}{sqrt{2^4}}bigl[qr0qr2 + qr1qr4 + ... + qr{i}qr{f(i)} + ... + qr{7}qr1bigr] qr0,
end{align*}
end{document}
Theleft
andright
directives don't succeed in making "big" square brackets -- better to usebigl[
andbigr]
, right? :-)
– Mico
10 hours ago
That's right. Actually, I didn't think about this problem, but I see I should have, to make the formula a little less unpleasant to read. I'll fix that. Thanks!
– Bernard
9 hours ago
add a comment |
I think the reason you are getting this result is that the second linebreak inside the split
environment should be outside, like this:
begin{align*}
qr{psi_2} &= U_f qr{psi_1}\
&= U_f frac{1}{sqrt{2^4}} left[qr0 + qr1 + qr2+qr3+qr4+qr5+qr6 + qr{7}right] qr0 qr0\
&= U_f frac{1}{sqrt{2^4}} left[qr0qr0 + qr1qr0 + qr2qr0+qr3qr0+qr4qr0+qr5qr0+qr6qr0 + qr{7}qr0right] qr0\
begin{split}
&= frac{1}{sqrt{2^4}} big[U_fqr0qr0 + U_fqr1qr0 + U_fqr2qr0+U_fqr3qr0 \
&qquadqquad + U_fqr4qr0+U_fqr5qr0+U_fqr6qr0 + U_fqr{7}qr0big] qr0
end{split}\
&= frac{1}{sqrt{2^4}} left[qr0qr2 + qr1qr4 + ... + qr{i}qr{f(i)} + ... + qr{7}qr1right] qr0,
end{align*}
Besides the recomendations given in Bernard's answer, I'd also suggest using the split
environment inside equation*
instead of align*
, since it seems you're trying to typeset just one (albeit multi-line) equation:
documentclass{article}
usepackage{amsmath}
newcommand{q}[2]{langle #1 | #2 rangle}
newcommand{qr}[1]{|#1rangle}
newcommand{ql}[1]{langle #1|}
DeclareMathOperator{mdc}{mdc}
begin{document}
begin{equation*}
begin{split}
qr{psi_2} &= U_f qr{psi_1}\
&= U_f frac{1}{sqrt{2^4}} left[qr0 + qr1 + qr2+qr3+qr4+qr5+qr6 + qr{7}right] qr0 qr0\
&= U_f frac{1}{sqrt{2^4}} left[qr0qr0 + qr1qr0 + qr2qr0+qr3qr0+qr4qr0+qr5qr0+qr6qr0 + qr{7}qr0right] qr0\
&=!begin{multlined}[t] frac{1}{sqrt{2^4}} big[U_fqr0qr0 + U_fqr1qr0 + U_fqr2qr0+U_fqr3qr0 \[-1.5ex]
qquad+ U_fqr4qr0+U_fqr5qr0+U_fqr6qr0 + U_fqr{7}qr0big] qr0
end{multlined}\
&= frac{1}{sqrt{2^4}} left[qr0qr2 + qr1qr4 + ... + qr{i}qr{f(i)} + ... + qr{7}qr1right] qr0,
end{split}
end{equation*}
end{document}
New contributor
1
But how to align the equal signs withinequation
?align
is appropriate here.
– Sigur
10 hours ago
I forgot to add that I'd recomend using thesplit
environment to align the equal signs and the multlined environment to break one the lines into two.
– Vinicius M. G. Silveira
10 hours ago
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%2f476218%2fwhat-am-i-doing-wrong-in-this-use-of-split%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
In addition to getting rid of the unneeded split
environment, you may want to (a) typeset the U_f
terms more compactly, i.e., as U_{!f}
, (b) replace various left[
and right]
directives with bigl[
and bigr]
, and (c) replace ...
with dots
.
documentclass{article}
usepackage{mathtools} % for 'DeclarePairedDelimiter' macro
DeclarePairedDelimiterqrlvertrangle
newcommand{Uf}{U_{!f}}
begin{document}
begin{align*}
qr{psi_2}
&= Uf qr{psi_1}\
&= Uf frac{1}{sqrt{2^4}}
bigl[qr0 + qr1 + qr2+qr3 +qr4
+qr5 +qr6 + qr7bigr] qr0 qr0\
&= Uf frac{1}{sqrt{2^4}}
bigl[qr0qr0 + qr1qr0 + qr2qr0+qr3qr0
+qr4qr0+qr5qr0+qr6qr0 + qr7qr0bigr] qr0\
&= frac{1}{sqrt{2^4}}
bigl[Ufqr0qr0 + Ufqr1qr0 + Ufqr2qr0+Ufqr3qr0 \
&qquadqquad
+ Ufqr4qr0+Ufqr5qr0+Ufqr6qr0
+ Ufqr7qr0bigr] qr0\
&= frac{1}{sqrt{2^4}}
bigl[qr0qr2 + qr1qr4 + dots
+ qr{i}qr{f(i)} + dots + qr7qr1bigr] qr0,
end{align*}
end{document}
add a comment |
In addition to getting rid of the unneeded split
environment, you may want to (a) typeset the U_f
terms more compactly, i.e., as U_{!f}
, (b) replace various left[
and right]
directives with bigl[
and bigr]
, and (c) replace ...
with dots
.
documentclass{article}
usepackage{mathtools} % for 'DeclarePairedDelimiter' macro
DeclarePairedDelimiterqrlvertrangle
newcommand{Uf}{U_{!f}}
begin{document}
begin{align*}
qr{psi_2}
&= Uf qr{psi_1}\
&= Uf frac{1}{sqrt{2^4}}
bigl[qr0 + qr1 + qr2+qr3 +qr4
+qr5 +qr6 + qr7bigr] qr0 qr0\
&= Uf frac{1}{sqrt{2^4}}
bigl[qr0qr0 + qr1qr0 + qr2qr0+qr3qr0
+qr4qr0+qr5qr0+qr6qr0 + qr7qr0bigr] qr0\
&= frac{1}{sqrt{2^4}}
bigl[Ufqr0qr0 + Ufqr1qr0 + Ufqr2qr0+Ufqr3qr0 \
&qquadqquad
+ Ufqr4qr0+Ufqr5qr0+Ufqr6qr0
+ Ufqr7qr0bigr] qr0\
&= frac{1}{sqrt{2^4}}
bigl[qr0qr2 + qr1qr4 + dots
+ qr{i}qr{f(i)} + dots + qr7qr1bigr] qr0,
end{align*}
end{document}
add a comment |
In addition to getting rid of the unneeded split
environment, you may want to (a) typeset the U_f
terms more compactly, i.e., as U_{!f}
, (b) replace various left[
and right]
directives with bigl[
and bigr]
, and (c) replace ...
with dots
.
documentclass{article}
usepackage{mathtools} % for 'DeclarePairedDelimiter' macro
DeclarePairedDelimiterqrlvertrangle
newcommand{Uf}{U_{!f}}
begin{document}
begin{align*}
qr{psi_2}
&= Uf qr{psi_1}\
&= Uf frac{1}{sqrt{2^4}}
bigl[qr0 + qr1 + qr2+qr3 +qr4
+qr5 +qr6 + qr7bigr] qr0 qr0\
&= Uf frac{1}{sqrt{2^4}}
bigl[qr0qr0 + qr1qr0 + qr2qr0+qr3qr0
+qr4qr0+qr5qr0+qr6qr0 + qr7qr0bigr] qr0\
&= frac{1}{sqrt{2^4}}
bigl[Ufqr0qr0 + Ufqr1qr0 + Ufqr2qr0+Ufqr3qr0 \
&qquadqquad
+ Ufqr4qr0+Ufqr5qr0+Ufqr6qr0
+ Ufqr7qr0bigr] qr0\
&= frac{1}{sqrt{2^4}}
bigl[qr0qr2 + qr1qr4 + dots
+ qr{i}qr{f(i)} + dots + qr7qr1bigr] qr0,
end{align*}
end{document}
In addition to getting rid of the unneeded split
environment, you may want to (a) typeset the U_f
terms more compactly, i.e., as U_{!f}
, (b) replace various left[
and right]
directives with bigl[
and bigr]
, and (c) replace ...
with dots
.
documentclass{article}
usepackage{mathtools} % for 'DeclarePairedDelimiter' macro
DeclarePairedDelimiterqrlvertrangle
newcommand{Uf}{U_{!f}}
begin{document}
begin{align*}
qr{psi_2}
&= Uf qr{psi_1}\
&= Uf frac{1}{sqrt{2^4}}
bigl[qr0 + qr1 + qr2+qr3 +qr4
+qr5 +qr6 + qr7bigr] qr0 qr0\
&= Uf frac{1}{sqrt{2^4}}
bigl[qr0qr0 + qr1qr0 + qr2qr0+qr3qr0
+qr4qr0+qr5qr0+qr6qr0 + qr7qr0bigr] qr0\
&= frac{1}{sqrt{2^4}}
bigl[Ufqr0qr0 + Ufqr1qr0 + Ufqr2qr0+Ufqr3qr0 \
&qquadqquad
+ Ufqr4qr0+Ufqr5qr0+Ufqr6qr0
+ Ufqr7qr0bigr] qr0\
&= frac{1}{sqrt{2^4}}
bigl[qr0qr2 + qr1qr4 + dots
+ qr{i}qr{f(i)} + dots + qr7qr1bigr] qr0,
end{align*}
end{document}
answered 10 hours ago
MicoMico
280k31381770
280k31381770
add a comment |
add a comment |
I suggest using the multlined
environment from mathtools
, and the DeclarePairedDelimiter
command from the same package, which will produce scaling , qr
and ql
:
documentclass{article}
usepackage{mathtools}
DeclarePairedDelimiterXnorm[1]lVertrVert{ifblank{#1}{: · :}{#1}}
DeclarePairedDelimiterXPP{twonorm }[1]{}{lVert}{rVert}{_{2}}{ifblank{#1}{: · :}{#1}}
DeclarePairedDelimiterXq[2]{langle}{rangle}%
{#1,delimsizevert,mathopen{}#2}
DeclarePairedDelimiter{qr}vertrangle
DeclarePairedDelimiter{ql}langle rvert
DeclareMathOperator{mdc}{mdc}
begin{document}
begin{align*}
qr{psi_2} &= U_f qr{psi_1}\
&= U_f frac{1}{sqrt{2^4}} bigl[qr0 + qr1 + qr2+qr3+qr4+qr5+qr6 + qr{7}bigr] qr0 qr0\
&= U_f frac{1}{sqrt{2^4}}bigl[qr0qr0 + qr1qr0 + qr2qr0+qr3qr0+qr4qr0+qr5qr0+qr6qr0 + qr{7}qr0bigr] qr0\
&= begin{multlined}[t] frac{1}{sqrt{2^4}} bigl[U_fqr0qr0 + U_fqr1qr0 + U_fqr2qr0+U_fqr3qr0 \[-1.5ex]
qquad+ U_fqr4qr0+U_fqr5qr0+U_fqr6qr0 + U_fqr{7}qr0bigr] qr0
end{multlined}\
&= frac{1}{sqrt{2^4}}bigl[qr0qr2 + qr1qr4 + ... + qr{i}qr{f(i)} + ... + qr{7}qr1bigr] qr0,
end{align*}
end{document}
Theleft
andright
directives don't succeed in making "big" square brackets -- better to usebigl[
andbigr]
, right? :-)
– Mico
10 hours ago
That's right. Actually, I didn't think about this problem, but I see I should have, to make the formula a little less unpleasant to read. I'll fix that. Thanks!
– Bernard
9 hours ago
add a comment |
I suggest using the multlined
environment from mathtools
, and the DeclarePairedDelimiter
command from the same package, which will produce scaling , qr
and ql
:
documentclass{article}
usepackage{mathtools}
DeclarePairedDelimiterXnorm[1]lVertrVert{ifblank{#1}{: · :}{#1}}
DeclarePairedDelimiterXPP{twonorm }[1]{}{lVert}{rVert}{_{2}}{ifblank{#1}{: · :}{#1}}
DeclarePairedDelimiterXq[2]{langle}{rangle}%
{#1,delimsizevert,mathopen{}#2}
DeclarePairedDelimiter{qr}vertrangle
DeclarePairedDelimiter{ql}langle rvert
DeclareMathOperator{mdc}{mdc}
begin{document}
begin{align*}
qr{psi_2} &= U_f qr{psi_1}\
&= U_f frac{1}{sqrt{2^4}} bigl[qr0 + qr1 + qr2+qr3+qr4+qr5+qr6 + qr{7}bigr] qr0 qr0\
&= U_f frac{1}{sqrt{2^4}}bigl[qr0qr0 + qr1qr0 + qr2qr0+qr3qr0+qr4qr0+qr5qr0+qr6qr0 + qr{7}qr0bigr] qr0\
&= begin{multlined}[t] frac{1}{sqrt{2^4}} bigl[U_fqr0qr0 + U_fqr1qr0 + U_fqr2qr0+U_fqr3qr0 \[-1.5ex]
qquad+ U_fqr4qr0+U_fqr5qr0+U_fqr6qr0 + U_fqr{7}qr0bigr] qr0
end{multlined}\
&= frac{1}{sqrt{2^4}}bigl[qr0qr2 + qr1qr4 + ... + qr{i}qr{f(i)} + ... + qr{7}qr1bigr] qr0,
end{align*}
end{document}
Theleft
andright
directives don't succeed in making "big" square brackets -- better to usebigl[
andbigr]
, right? :-)
– Mico
10 hours ago
That's right. Actually, I didn't think about this problem, but I see I should have, to make the formula a little less unpleasant to read. I'll fix that. Thanks!
– Bernard
9 hours ago
add a comment |
I suggest using the multlined
environment from mathtools
, and the DeclarePairedDelimiter
command from the same package, which will produce scaling , qr
and ql
:
documentclass{article}
usepackage{mathtools}
DeclarePairedDelimiterXnorm[1]lVertrVert{ifblank{#1}{: · :}{#1}}
DeclarePairedDelimiterXPP{twonorm }[1]{}{lVert}{rVert}{_{2}}{ifblank{#1}{: · :}{#1}}
DeclarePairedDelimiterXq[2]{langle}{rangle}%
{#1,delimsizevert,mathopen{}#2}
DeclarePairedDelimiter{qr}vertrangle
DeclarePairedDelimiter{ql}langle rvert
DeclareMathOperator{mdc}{mdc}
begin{document}
begin{align*}
qr{psi_2} &= U_f qr{psi_1}\
&= U_f frac{1}{sqrt{2^4}} bigl[qr0 + qr1 + qr2+qr3+qr4+qr5+qr6 + qr{7}bigr] qr0 qr0\
&= U_f frac{1}{sqrt{2^4}}bigl[qr0qr0 + qr1qr0 + qr2qr0+qr3qr0+qr4qr0+qr5qr0+qr6qr0 + qr{7}qr0bigr] qr0\
&= begin{multlined}[t] frac{1}{sqrt{2^4}} bigl[U_fqr0qr0 + U_fqr1qr0 + U_fqr2qr0+U_fqr3qr0 \[-1.5ex]
qquad+ U_fqr4qr0+U_fqr5qr0+U_fqr6qr0 + U_fqr{7}qr0bigr] qr0
end{multlined}\
&= frac{1}{sqrt{2^4}}bigl[qr0qr2 + qr1qr4 + ... + qr{i}qr{f(i)} + ... + qr{7}qr1bigr] qr0,
end{align*}
end{document}
I suggest using the multlined
environment from mathtools
, and the DeclarePairedDelimiter
command from the same package, which will produce scaling , qr
and ql
:
documentclass{article}
usepackage{mathtools}
DeclarePairedDelimiterXnorm[1]lVertrVert{ifblank{#1}{: · :}{#1}}
DeclarePairedDelimiterXPP{twonorm }[1]{}{lVert}{rVert}{_{2}}{ifblank{#1}{: · :}{#1}}
DeclarePairedDelimiterXq[2]{langle}{rangle}%
{#1,delimsizevert,mathopen{}#2}
DeclarePairedDelimiter{qr}vertrangle
DeclarePairedDelimiter{ql}langle rvert
DeclareMathOperator{mdc}{mdc}
begin{document}
begin{align*}
qr{psi_2} &= U_f qr{psi_1}\
&= U_f frac{1}{sqrt{2^4}} bigl[qr0 + qr1 + qr2+qr3+qr4+qr5+qr6 + qr{7}bigr] qr0 qr0\
&= U_f frac{1}{sqrt{2^4}}bigl[qr0qr0 + qr1qr0 + qr2qr0+qr3qr0+qr4qr0+qr5qr0+qr6qr0 + qr{7}qr0bigr] qr0\
&= begin{multlined}[t] frac{1}{sqrt{2^4}} bigl[U_fqr0qr0 + U_fqr1qr0 + U_fqr2qr0+U_fqr3qr0 \[-1.5ex]
qquad+ U_fqr4qr0+U_fqr5qr0+U_fqr6qr0 + U_fqr{7}qr0bigr] qr0
end{multlined}\
&= frac{1}{sqrt{2^4}}bigl[qr0qr2 + qr1qr4 + ... + qr{i}qr{f(i)} + ... + qr{7}qr1bigr] qr0,
end{align*}
end{document}
edited 9 hours ago
answered 10 hours ago
BernardBernard
171k775202
171k775202
Theleft
andright
directives don't succeed in making "big" square brackets -- better to usebigl[
andbigr]
, right? :-)
– Mico
10 hours ago
That's right. Actually, I didn't think about this problem, but I see I should have, to make the formula a little less unpleasant to read. I'll fix that. Thanks!
– Bernard
9 hours ago
add a comment |
Theleft
andright
directives don't succeed in making "big" square brackets -- better to usebigl[
andbigr]
, right? :-)
– Mico
10 hours ago
That's right. Actually, I didn't think about this problem, but I see I should have, to make the formula a little less unpleasant to read. I'll fix that. Thanks!
– Bernard
9 hours ago
The
left
and right
directives don't succeed in making "big" square brackets -- better to use bigl[
and bigr]
, right? :-)– Mico
10 hours ago
The
left
and right
directives don't succeed in making "big" square brackets -- better to use bigl[
and bigr]
, right? :-)– Mico
10 hours ago
That's right. Actually, I didn't think about this problem, but I see I should have, to make the formula a little less unpleasant to read. I'll fix that. Thanks!
– Bernard
9 hours ago
That's right. Actually, I didn't think about this problem, but I see I should have, to make the formula a little less unpleasant to read. I'll fix that. Thanks!
– Bernard
9 hours ago
add a comment |
I think the reason you are getting this result is that the second linebreak inside the split
environment should be outside, like this:
begin{align*}
qr{psi_2} &= U_f qr{psi_1}\
&= U_f frac{1}{sqrt{2^4}} left[qr0 + qr1 + qr2+qr3+qr4+qr5+qr6 + qr{7}right] qr0 qr0\
&= U_f frac{1}{sqrt{2^4}} left[qr0qr0 + qr1qr0 + qr2qr0+qr3qr0+qr4qr0+qr5qr0+qr6qr0 + qr{7}qr0right] qr0\
begin{split}
&= frac{1}{sqrt{2^4}} big[U_fqr0qr0 + U_fqr1qr0 + U_fqr2qr0+U_fqr3qr0 \
&qquadqquad + U_fqr4qr0+U_fqr5qr0+U_fqr6qr0 + U_fqr{7}qr0big] qr0
end{split}\
&= frac{1}{sqrt{2^4}} left[qr0qr2 + qr1qr4 + ... + qr{i}qr{f(i)} + ... + qr{7}qr1right] qr0,
end{align*}
Besides the recomendations given in Bernard's answer, I'd also suggest using the split
environment inside equation*
instead of align*
, since it seems you're trying to typeset just one (albeit multi-line) equation:
documentclass{article}
usepackage{amsmath}
newcommand{q}[2]{langle #1 | #2 rangle}
newcommand{qr}[1]{|#1rangle}
newcommand{ql}[1]{langle #1|}
DeclareMathOperator{mdc}{mdc}
begin{document}
begin{equation*}
begin{split}
qr{psi_2} &= U_f qr{psi_1}\
&= U_f frac{1}{sqrt{2^4}} left[qr0 + qr1 + qr2+qr3+qr4+qr5+qr6 + qr{7}right] qr0 qr0\
&= U_f frac{1}{sqrt{2^4}} left[qr0qr0 + qr1qr0 + qr2qr0+qr3qr0+qr4qr0+qr5qr0+qr6qr0 + qr{7}qr0right] qr0\
&=!begin{multlined}[t] frac{1}{sqrt{2^4}} big[U_fqr0qr0 + U_fqr1qr0 + U_fqr2qr0+U_fqr3qr0 \[-1.5ex]
qquad+ U_fqr4qr0+U_fqr5qr0+U_fqr6qr0 + U_fqr{7}qr0big] qr0
end{multlined}\
&= frac{1}{sqrt{2^4}} left[qr0qr2 + qr1qr4 + ... + qr{i}qr{f(i)} + ... + qr{7}qr1right] qr0,
end{split}
end{equation*}
end{document}
New contributor
1
But how to align the equal signs withinequation
?align
is appropriate here.
– Sigur
10 hours ago
I forgot to add that I'd recomend using thesplit
environment to align the equal signs and the multlined environment to break one the lines into two.
– Vinicius M. G. Silveira
10 hours ago
add a comment |
I think the reason you are getting this result is that the second linebreak inside the split
environment should be outside, like this:
begin{align*}
qr{psi_2} &= U_f qr{psi_1}\
&= U_f frac{1}{sqrt{2^4}} left[qr0 + qr1 + qr2+qr3+qr4+qr5+qr6 + qr{7}right] qr0 qr0\
&= U_f frac{1}{sqrt{2^4}} left[qr0qr0 + qr1qr0 + qr2qr0+qr3qr0+qr4qr0+qr5qr0+qr6qr0 + qr{7}qr0right] qr0\
begin{split}
&= frac{1}{sqrt{2^4}} big[U_fqr0qr0 + U_fqr1qr0 + U_fqr2qr0+U_fqr3qr0 \
&qquadqquad + U_fqr4qr0+U_fqr5qr0+U_fqr6qr0 + U_fqr{7}qr0big] qr0
end{split}\
&= frac{1}{sqrt{2^4}} left[qr0qr2 + qr1qr4 + ... + qr{i}qr{f(i)} + ... + qr{7}qr1right] qr0,
end{align*}
Besides the recomendations given in Bernard's answer, I'd also suggest using the split
environment inside equation*
instead of align*
, since it seems you're trying to typeset just one (albeit multi-line) equation:
documentclass{article}
usepackage{amsmath}
newcommand{q}[2]{langle #1 | #2 rangle}
newcommand{qr}[1]{|#1rangle}
newcommand{ql}[1]{langle #1|}
DeclareMathOperator{mdc}{mdc}
begin{document}
begin{equation*}
begin{split}
qr{psi_2} &= U_f qr{psi_1}\
&= U_f frac{1}{sqrt{2^4}} left[qr0 + qr1 + qr2+qr3+qr4+qr5+qr6 + qr{7}right] qr0 qr0\
&= U_f frac{1}{sqrt{2^4}} left[qr0qr0 + qr1qr0 + qr2qr0+qr3qr0+qr4qr0+qr5qr0+qr6qr0 + qr{7}qr0right] qr0\
&=!begin{multlined}[t] frac{1}{sqrt{2^4}} big[U_fqr0qr0 + U_fqr1qr0 + U_fqr2qr0+U_fqr3qr0 \[-1.5ex]
qquad+ U_fqr4qr0+U_fqr5qr0+U_fqr6qr0 + U_fqr{7}qr0big] qr0
end{multlined}\
&= frac{1}{sqrt{2^4}} left[qr0qr2 + qr1qr4 + ... + qr{i}qr{f(i)} + ... + qr{7}qr1right] qr0,
end{split}
end{equation*}
end{document}
New contributor
1
But how to align the equal signs withinequation
?align
is appropriate here.
– Sigur
10 hours ago
I forgot to add that I'd recomend using thesplit
environment to align the equal signs and the multlined environment to break one the lines into two.
– Vinicius M. G. Silveira
10 hours ago
add a comment |
I think the reason you are getting this result is that the second linebreak inside the split
environment should be outside, like this:
begin{align*}
qr{psi_2} &= U_f qr{psi_1}\
&= U_f frac{1}{sqrt{2^4}} left[qr0 + qr1 + qr2+qr3+qr4+qr5+qr6 + qr{7}right] qr0 qr0\
&= U_f frac{1}{sqrt{2^4}} left[qr0qr0 + qr1qr0 + qr2qr0+qr3qr0+qr4qr0+qr5qr0+qr6qr0 + qr{7}qr0right] qr0\
begin{split}
&= frac{1}{sqrt{2^4}} big[U_fqr0qr0 + U_fqr1qr0 + U_fqr2qr0+U_fqr3qr0 \
&qquadqquad + U_fqr4qr0+U_fqr5qr0+U_fqr6qr0 + U_fqr{7}qr0big] qr0
end{split}\
&= frac{1}{sqrt{2^4}} left[qr0qr2 + qr1qr4 + ... + qr{i}qr{f(i)} + ... + qr{7}qr1right] qr0,
end{align*}
Besides the recomendations given in Bernard's answer, I'd also suggest using the split
environment inside equation*
instead of align*
, since it seems you're trying to typeset just one (albeit multi-line) equation:
documentclass{article}
usepackage{amsmath}
newcommand{q}[2]{langle #1 | #2 rangle}
newcommand{qr}[1]{|#1rangle}
newcommand{ql}[1]{langle #1|}
DeclareMathOperator{mdc}{mdc}
begin{document}
begin{equation*}
begin{split}
qr{psi_2} &= U_f qr{psi_1}\
&= U_f frac{1}{sqrt{2^4}} left[qr0 + qr1 + qr2+qr3+qr4+qr5+qr6 + qr{7}right] qr0 qr0\
&= U_f frac{1}{sqrt{2^4}} left[qr0qr0 + qr1qr0 + qr2qr0+qr3qr0+qr4qr0+qr5qr0+qr6qr0 + qr{7}qr0right] qr0\
&=!begin{multlined}[t] frac{1}{sqrt{2^4}} big[U_fqr0qr0 + U_fqr1qr0 + U_fqr2qr0+U_fqr3qr0 \[-1.5ex]
qquad+ U_fqr4qr0+U_fqr5qr0+U_fqr6qr0 + U_fqr{7}qr0big] qr0
end{multlined}\
&= frac{1}{sqrt{2^4}} left[qr0qr2 + qr1qr4 + ... + qr{i}qr{f(i)} + ... + qr{7}qr1right] qr0,
end{split}
end{equation*}
end{document}
New contributor
I think the reason you are getting this result is that the second linebreak inside the split
environment should be outside, like this:
begin{align*}
qr{psi_2} &= U_f qr{psi_1}\
&= U_f frac{1}{sqrt{2^4}} left[qr0 + qr1 + qr2+qr3+qr4+qr5+qr6 + qr{7}right] qr0 qr0\
&= U_f frac{1}{sqrt{2^4}} left[qr0qr0 + qr1qr0 + qr2qr0+qr3qr0+qr4qr0+qr5qr0+qr6qr0 + qr{7}qr0right] qr0\
begin{split}
&= frac{1}{sqrt{2^4}} big[U_fqr0qr0 + U_fqr1qr0 + U_fqr2qr0+U_fqr3qr0 \
&qquadqquad + U_fqr4qr0+U_fqr5qr0+U_fqr6qr0 + U_fqr{7}qr0big] qr0
end{split}\
&= frac{1}{sqrt{2^4}} left[qr0qr2 + qr1qr4 + ... + qr{i}qr{f(i)} + ... + qr{7}qr1right] qr0,
end{align*}
Besides the recomendations given in Bernard's answer, I'd also suggest using the split
environment inside equation*
instead of align*
, since it seems you're trying to typeset just one (albeit multi-line) equation:
documentclass{article}
usepackage{amsmath}
newcommand{q}[2]{langle #1 | #2 rangle}
newcommand{qr}[1]{|#1rangle}
newcommand{ql}[1]{langle #1|}
DeclareMathOperator{mdc}{mdc}
begin{document}
begin{equation*}
begin{split}
qr{psi_2} &= U_f qr{psi_1}\
&= U_f frac{1}{sqrt{2^4}} left[qr0 + qr1 + qr2+qr3+qr4+qr5+qr6 + qr{7}right] qr0 qr0\
&= U_f frac{1}{sqrt{2^4}} left[qr0qr0 + qr1qr0 + qr2qr0+qr3qr0+qr4qr0+qr5qr0+qr6qr0 + qr{7}qr0right] qr0\
&=!begin{multlined}[t] frac{1}{sqrt{2^4}} big[U_fqr0qr0 + U_fqr1qr0 + U_fqr2qr0+U_fqr3qr0 \[-1.5ex]
qquad+ U_fqr4qr0+U_fqr5qr0+U_fqr6qr0 + U_fqr{7}qr0big] qr0
end{multlined}\
&= frac{1}{sqrt{2^4}} left[qr0qr2 + qr1qr4 + ... + qr{i}qr{f(i)} + ... + qr{7}qr1right] qr0,
end{split}
end{equation*}
end{document}
New contributor
edited 10 hours ago
New contributor
answered 10 hours ago
Vinicius M. G. SilveiraVinicius M. G. Silveira
12
12
New contributor
New contributor
1
But how to align the equal signs withinequation
?align
is appropriate here.
– Sigur
10 hours ago
I forgot to add that I'd recomend using thesplit
environment to align the equal signs and the multlined environment to break one the lines into two.
– Vinicius M. G. Silveira
10 hours ago
add a comment |
1
But how to align the equal signs withinequation
?align
is appropriate here.
– Sigur
10 hours ago
I forgot to add that I'd recomend using thesplit
environment to align the equal signs and the multlined environment to break one the lines into two.
– Vinicius M. G. Silveira
10 hours ago
1
1
But how to align the equal signs within
equation
? align
is appropriate here.– Sigur
10 hours ago
But how to align the equal signs within
equation
? align
is appropriate here.– Sigur
10 hours ago
I forgot to add that I'd recomend using the
split
environment to align the equal signs and the multlined environment to break one the lines into two.– Vinicius M. G. Silveira
10 hours ago
I forgot to add that I'd recomend using the
split
environment to align the equal signs and the multlined environment to break one the lines into two.– Vinicius M. G. Silveira
10 hours ago
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%2f476218%2fwhat-am-i-doing-wrong-in-this-use-of-split%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
2
I'm not quite sure what you're aiming for, but have you tried commenting out the
begin{split}
andend{split}
, and leaving the inner two lines alone?– Teepeemm
11 hours ago
Wow. Why am I using split in the first place? I thought this wouldn't work at all.
– Joep Awinita
11 hours ago
Needless to say, @Teepeemm, you're answered the question completely.
– Joep Awinita
11 hours ago
But a two line comment takes far less effort than a complete answer. I'm content with letting those wanting to take the time to also take the points.
– Teepeemm
10 hours ago