TeX - LaTeX Asked on November 26, 2021
I’m learning LaTeX and writing code on overleaf.
I am particular about the alignment of equal (=
) signs and after banging my head for a few hours, it seems best to keep all equations in a single align
environment and then repeatedly use intertext{}
for discussions.
However, I came across a segment in my practice reference that has a number of equations in a row unnumbered. My solution was to write nonumber
at the end of each equation.
#1
. Building a new begin{align*}
inside of begin{align}
gives me errors.
#2
. Adding a begin{split}
works until the last line which can be corrected with a single nonumber
, but all equations are now left justified.
#3
. If I enclose everything with a begin{center}
the intertext{}
are also centered. This is with a setlengthparindent{0pt}
preamble. begin{centered}
does no visual change to #2
Is there a better way? I would prefer to keep only the equations centered.
x
Here is the compiled output for #1
:
x
Here’s the compiled output for #2
:
x
Here’s the compiled output for #3
:
x
Here’s my code for #1
, the nonumber
statements are in the last 5 lines:
(I’m sorry it’s a complicated mess)
begin{align}
psi_mathbf{k}(r) & = sum_{IJ} mathrm{e}^{imathbf{k}cdot mathbf{R}_{IJ}} phi_o{(mathbf{r} - mathbf{R}_{IJ}})
\
intertext{We add a translation of an arbitrary vector (mathbf{R'}) and obtain}
psi_mathbf{k}(r) & = sum_{IJ} mathrm{e}^{imathbf{k}cdot mathbf{R}_{IJ}} phi_o{(mathbf{r + R' - R}_{IJ}}) \
& = sum_{IJ} mathrm{e}^{imathbf{k}cdot mathbf{R}_{IJ}} phi_o{(mathbf{r - (R_mathit{IJ} - R')}})
\
intertext{Now let us define:}
Tilde{mathbf{R}}_{IJ} & = mathbf{R_mathit{IJ}-R'}
%end{align}
%%
%begin{align}
intertext{Then, since the summation in (2) is over an infinite number of pairs ((I, J)), we can rewrite it as}
psi_mathbf{k}mathbf{(r+R')} & = sum_{IJ}mathrm{e}^{imathbf{k} cdot (mathbf{Tilde{R}}_{IJ}+R')} phi_o(mathbf{r - Tilde{R})}_{IJ} nonumber\
& = sum_{IJ}mathrm{e}^{imathbf{k cdot R'}} cdot mathrm{e}^{imathbf{k}mathbf{Tilde{R}}_{IJ}} phi_o(mathbf{r - Tilde{R})}_{IJ} nonumber\
& = mathrm{e}^{imathbf{k cdot R'}} sum_{IJ} mathrm{e}^{imathbf{k}mathbf{Tilde{R}}_{IJ}} phi_o(mathbf{r - Tilde{R})}_{IJ} nonumber\
& = mathrm{e}^{imathbf{k cdot R'}} psi_mathbf{k}mathbf{(r)} nonumber
end{align}
Here is the code for #2
:
begin{align}
psi_mathbf{k}(r) & = sum_{IJ} mathrm{e}^{imathbf{k}cdot mathbf{R}_{IJ}} phi_o{(mathbf{r} - mathbf{R}_{IJ}})
\
intertext{We add a translation of an arbitrary vector (mathbf{R'}) and obtain}
psi_mathbf{k}(r) & = sum_{IJ} mathrm{e}^{imathbf{k}cdot mathbf{R}_{IJ}} phi_o{(mathbf{r + R' - R}_{IJ}}) \
& = sum_{I J} mathrm{e}^{imathbf{k}cdot mathbf{R}_{IJ}} phi_o{(mathbf{r - (R_mathit{IJ} - R')}})
\
intertext{Now let us define:}
Tilde{mathbf{R}}_{IJ} & = mathbf{R_mathit{IJ}-R'} \
%end{align}
%%
begin{split}
intertext{Then, since the summation in (2) is over an infinite number of pairs ((I, J)), we can rewrite it as}
psi_mathbf{k}mathbf{(r+R')} & = sum_{IJ}mathrm{e}^{imathbf{k} cdot (mathbf{Tilde{R}}_{IJ}+R')} phi_o(mathbf{r - Tilde{R})}_{IJ} \
& =sum_{IJ}mathrm{e}^{imathbf{k cdot R'}} cdot mathrm{e}^{imathbf{k}mathbf{Tilde{R}}_{IJ}} phi_o(mathbf{r - Tilde{R})}_{IJ} \
& = mathrm{e}^{imathbf{k cdot R'}} sum_{IJ} mathrm{e}^{imathbf{k}mathbf{Tilde{R}}_{IJ}} phi_o(mathbf{r - Tilde{R})}_{IJ}\
& = mathrm{e}^{imathbf{k cdot R'}} psi_mathbf{k}mathbf{(r)}
end{split}
end{align}
Code for #3
is just code for #2
with begin{center}
and end{center}
at both ends
I see no reason to align all those equals sign. Maybe the first two blocks can use intertext
, but I'm not really sure. Personally, I'd not align them.
Some advice. Define a command for the Euler constant to avoid explicit mathrm{e}
all along your document. Also avoid mathbf
and use a semantic command, here vec
, but you can decide for a different name. Also it should be
tilde{mathbf{R}}
and never mathbf{r-R}
or similar shortcuts. Your document loses in semantics this way and becomes confused: why mathbf{(r)}
somewhere, for instance?
The last display is too distant from the first two to benefit from an alignment of the equals signs. Readers will see them as separate entities anyway. For sure, the middle display should not align with the others and this separates the blocks, so no alignment is necessary or good.
documentclass{article}
usepackage{amsmath}
newcommand{eul}{mathrm{e}}
renewcommand{vec}[1]{mathbf{#1}}
begin{document}
begin{align}
psi_{vec{k}}(vec{r})
& = sum_{IJ} eul^{ivec{k}cdot vec{R}_{IJ}}
phi_o(vec{r} - vec{R}_{IJ})
\
intertext{We add a translation of an arbitrary vector (vec{R}') and obtain}
begin{split}
psi_{vec{k}}(vec{r})
& = sum_{IJ} eul^{ivec{k}cdot vec{R}_{IJ}}
phi_o(vec{r} + vec{R}' - vec{R}_{IJ})
\
& = sum_{IJ} eul^{ivec{k}cdot vec{R}_{IJ}}
phi_o(vec{r} - (vec{R}_{IJ} - vec{R}'))
end{split}
end{align}
Now let us define
begin{equation}
Tilde{vec{R}}_{IJ} = vec{R}_{IJ}-vec{R}'
end{equation}
Then, since the summation in (2) is over an infinite number of pairs ((I, J)),
we can rewrite it as
begin{equation}
begin{split}
psi_{vec{k}}(vec{r}+vec{R}')
& = sum_{IJ} eul^{ivec{k} cdot (tilde{vec{R}}_{IJ}+vec{R}')}
phi_o(vec{r} - tilde{vec{R}})_{IJ} \
& = sum_{IJ} eul^{ivec{k} cdot vec{R}'} cdot
eul^{ivec{k}cdottilde{vec{R}}_{IJ}}
phi_o(vec{r} - tilde{vec{R}})_{IJ} \
& = eul^{ivec{k} cdot vec{R}'}
sum_{IJ} eul^{ivec{k}cdottilde{vec{R}}_{IJ}}
phi_o(vec{r} - tilde{vec{R}})_{IJ} \
& = eul^{ivec{k} cdot vec{R}'} psi_{vec{k}}(vec{r})
end{split}
end{equation}
end{document}
If you want the number aligned to the bottom line of split
load amsmath
with the tbtags
option.
Answered by egreg on November 26, 2021
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP