A universal method for left-hand alignment of a sequence of equalities
With this code
documentclass[a4paper,12pt]{article}
usepackage{mathtools, mathrsfs}
%% Code for 'widebar' macro is courtesy of
%% https://tex.stackexchange.com/a/60253
makeatletter
letsave@mathaccentmathaccent
newcommand*if@single[3]{%
setbox0hbox{${mathaccent"0362{#1}}^H$}%
setbox2hbox{${mathaccent"0362{kern0pt#1}}^H$}%
ifdimht0=ht2 #3else #2fi
}
%The bar will be moved to the right by a half of macc@kerna, which is computed by amsmath:
newcommand*rel@kern[1]{kern#1dimexprmacc@kerna}
%If there's a superscript following the bar, then no negative kern may follow the bar;
%an additional {} makes sure that the superscript is high enough in this case:
newcommand*widebar[1]{@ifnextchar^{{wide@bar{#1}{0}}}{wide@bar{#1}{1}}}
%Use a separate algorithm for single symbols:
newcommand*wide@bar[2]{if@single{#1}{wide@bar@{#1}{#2}{1}}{wide@bar@{#1}{#2}{2}}}
newcommand*wide@bar@[3]{%
begingroup
defmathaccent##1##2{%
%Enable nesting of accents:
letmathaccentsave@mathaccent
%If there's more than a single symbol, use the first character instead (see below):
if#32 letmacc@nucleusfirst@char fi
%Determine the italic correction:
setboxz@hbox{$macc@style{macc@nucleus}_{}$}%
setboxtw@hbox{$macc@style{macc@nucleus}{}_{}$}%
dimen@wdtw@
advancedimen@-wdz@
%Now dimen@ is the italic correction of the symbol.
dividedimen@ 3
@tempdimawdtw@
advance@tempdima-scriptspace
%Now @tempdima is the width of the symbol.
divide@tempdima 10
advancedimen@-@tempdima
%Now dimen@ = (italic correction / 3) - (Breite / 10)
ifdimdimen@>z@ dimen@0ptfi
%The bar will be shortened in the case dimen@<0 !
rel@kern{0.6}kern-dimen@
if#31
overline{rel@kern{-0.6}kerndimen@macc@nucleusrel@kern{0.4}kerndimen@}%
advancedimen@0.4dimexprmacc@kerna
%Place the combined final kern (-dimen@) if it is >0 or if a superscript follows:
letfinal@kern#2%
ifdimdimen@<z@ letfinal@kern1fi
iffinal@kern1 kern-dimen@fi
else
overline{rel@kern{-0.6}kerndimen@#1}%
fi
}%
macc@depth@ne
letmath@bgroup@empty letmath@egroupmacc@set@skewchar
mathsurroundz@ frozen@everymath{mathgroupmacc@grouprelax}%
macc@set@skewcharrelax
letmathaccentVmacc@nested@a
%The following initialises macc@kerna and calls mathaccent:
if#31
macc@nested@arelax111{#1}%
else
%If the argument consists of more than one symbol, and if the first token is
%a letter, use that letter for the computations:
defgobble@till@marker##1endmarker{}%
futureletfirst@chargobble@till@marker#1endmarker
ifcatnoexpandfirst@char Aelse
deffirst@char{}%
fi
macc@nested@arelax111{first@char}%
fi
endgroup
}
makeatother
%% End of code block for widebar macro
begin{document}
[
begin{aligned}
mathscr F(bar{r}(t))&=& int_a^{b} L dt& =&int_a^{b} left[L frac{dt}{dtau}right]dtau=\
=int_a^{b} Bigl[-mc^2-qvarphidfrac{1}{sqrt{1-dfrac{u^{2}}{c^{2}}}}+qfrac{bar{u}cdot widebar{A}}{sqrt{1-dfrac{u^{2}}{c^{2}}}}Bigr] dtau=& &&&\
=int_a^{b} left[-mc^2+q,boldsymbol{mathcal{U}}cdot boldsymbol{mathcal{A}}right] dtau&&&&\
end{aligned}
]
end{document}
I have this output:
However, I would like to have the following alignment as the image below:
In the last few days I have done several tests but I have not succeeded. For other formulas the alignment on the left is very good. With this formula I can't do it.
Lastly, how can I improve the shape of the integral of the second line where the two green rectangles are highlighted? The square brackets do not respect the length of the integral symbol.
math-mode vertical-alignment align best-practices brackets
|
show 10 more comments
With this code
documentclass[a4paper,12pt]{article}
usepackage{mathtools, mathrsfs}
%% Code for 'widebar' macro is courtesy of
%% https://tex.stackexchange.com/a/60253
makeatletter
letsave@mathaccentmathaccent
newcommand*if@single[3]{%
setbox0hbox{${mathaccent"0362{#1}}^H$}%
setbox2hbox{${mathaccent"0362{kern0pt#1}}^H$}%
ifdimht0=ht2 #3else #2fi
}
%The bar will be moved to the right by a half of macc@kerna, which is computed by amsmath:
newcommand*rel@kern[1]{kern#1dimexprmacc@kerna}
%If there's a superscript following the bar, then no negative kern may follow the bar;
%an additional {} makes sure that the superscript is high enough in this case:
newcommand*widebar[1]{@ifnextchar^{{wide@bar{#1}{0}}}{wide@bar{#1}{1}}}
%Use a separate algorithm for single symbols:
newcommand*wide@bar[2]{if@single{#1}{wide@bar@{#1}{#2}{1}}{wide@bar@{#1}{#2}{2}}}
newcommand*wide@bar@[3]{%
begingroup
defmathaccent##1##2{%
%Enable nesting of accents:
letmathaccentsave@mathaccent
%If there's more than a single symbol, use the first character instead (see below):
if#32 letmacc@nucleusfirst@char fi
%Determine the italic correction:
setboxz@hbox{$macc@style{macc@nucleus}_{}$}%
setboxtw@hbox{$macc@style{macc@nucleus}{}_{}$}%
dimen@wdtw@
advancedimen@-wdz@
%Now dimen@ is the italic correction of the symbol.
dividedimen@ 3
@tempdimawdtw@
advance@tempdima-scriptspace
%Now @tempdima is the width of the symbol.
divide@tempdima 10
advancedimen@-@tempdima
%Now dimen@ = (italic correction / 3) - (Breite / 10)
ifdimdimen@>z@ dimen@0ptfi
%The bar will be shortened in the case dimen@<0 !
rel@kern{0.6}kern-dimen@
if#31
overline{rel@kern{-0.6}kerndimen@macc@nucleusrel@kern{0.4}kerndimen@}%
advancedimen@0.4dimexprmacc@kerna
%Place the combined final kern (-dimen@) if it is >0 or if a superscript follows:
letfinal@kern#2%
ifdimdimen@<z@ letfinal@kern1fi
iffinal@kern1 kern-dimen@fi
else
overline{rel@kern{-0.6}kerndimen@#1}%
fi
}%
macc@depth@ne
letmath@bgroup@empty letmath@egroupmacc@set@skewchar
mathsurroundz@ frozen@everymath{mathgroupmacc@grouprelax}%
macc@set@skewcharrelax
letmathaccentVmacc@nested@a
%The following initialises macc@kerna and calls mathaccent:
if#31
macc@nested@arelax111{#1}%
else
%If the argument consists of more than one symbol, and if the first token is
%a letter, use that letter for the computations:
defgobble@till@marker##1endmarker{}%
futureletfirst@chargobble@till@marker#1endmarker
ifcatnoexpandfirst@char Aelse
deffirst@char{}%
fi
macc@nested@arelax111{first@char}%
fi
endgroup
}
makeatother
%% End of code block for widebar macro
begin{document}
[
begin{aligned}
mathscr F(bar{r}(t))&=& int_a^{b} L dt& =&int_a^{b} left[L frac{dt}{dtau}right]dtau=\
=int_a^{b} Bigl[-mc^2-qvarphidfrac{1}{sqrt{1-dfrac{u^{2}}{c^{2}}}}+qfrac{bar{u}cdot widebar{A}}{sqrt{1-dfrac{u^{2}}{c^{2}}}}Bigr] dtau=& &&&\
=int_a^{b} left[-mc^2+q,boldsymbol{mathcal{U}}cdot boldsymbol{mathcal{A}}right] dtau&&&&\
end{aligned}
]
end{document}
I have this output:
However, I would like to have the following alignment as the image below:
In the last few days I have done several tests but I have not succeeded. For other formulas the alignment on the left is very good. With this formula I can't do it.
Lastly, how can I improve the shape of the integral of the second line where the two green rectangles are highlighted? The square brackets do not respect the length of the integral symbol.
math-mode vertical-alignment align best-practices brackets
2
It is noteqnarray
. Use a single&
per line, before the first=
.
– egreg
Mar 1 at 23:34
1
Is it normal practice where you come from to have an = sign at the end of one line and the start of the next? because it definitely isn't here, you shouldn't have one at the end of the line
– Au101
Mar 1 at 23:37
2
No downvotes so far -- what's going on?! :-)
– Mico
Mar 2 at 10:04
1
@AndréC Because there are frequent times of the year that haters attack me.
– Sebastiano
Mar 2 at 10:36
2
@AndréC - They just downvote, no explanations given, ever. And they really seem to like downvoting Sebastiano's queries. Who knows what motivates them? Maybe they dislike Saint Sebastian and believe it's appropriate to downvote queries by persons whose first name happens to be Sebastian[o]? At this point, any guess is as good, or bad, as any other.
– Mico
Mar 2 at 11:00
|
show 10 more comments
With this code
documentclass[a4paper,12pt]{article}
usepackage{mathtools, mathrsfs}
%% Code for 'widebar' macro is courtesy of
%% https://tex.stackexchange.com/a/60253
makeatletter
letsave@mathaccentmathaccent
newcommand*if@single[3]{%
setbox0hbox{${mathaccent"0362{#1}}^H$}%
setbox2hbox{${mathaccent"0362{kern0pt#1}}^H$}%
ifdimht0=ht2 #3else #2fi
}
%The bar will be moved to the right by a half of macc@kerna, which is computed by amsmath:
newcommand*rel@kern[1]{kern#1dimexprmacc@kerna}
%If there's a superscript following the bar, then no negative kern may follow the bar;
%an additional {} makes sure that the superscript is high enough in this case:
newcommand*widebar[1]{@ifnextchar^{{wide@bar{#1}{0}}}{wide@bar{#1}{1}}}
%Use a separate algorithm for single symbols:
newcommand*wide@bar[2]{if@single{#1}{wide@bar@{#1}{#2}{1}}{wide@bar@{#1}{#2}{2}}}
newcommand*wide@bar@[3]{%
begingroup
defmathaccent##1##2{%
%Enable nesting of accents:
letmathaccentsave@mathaccent
%If there's more than a single symbol, use the first character instead (see below):
if#32 letmacc@nucleusfirst@char fi
%Determine the italic correction:
setboxz@hbox{$macc@style{macc@nucleus}_{}$}%
setboxtw@hbox{$macc@style{macc@nucleus}{}_{}$}%
dimen@wdtw@
advancedimen@-wdz@
%Now dimen@ is the italic correction of the symbol.
dividedimen@ 3
@tempdimawdtw@
advance@tempdima-scriptspace
%Now @tempdima is the width of the symbol.
divide@tempdima 10
advancedimen@-@tempdima
%Now dimen@ = (italic correction / 3) - (Breite / 10)
ifdimdimen@>z@ dimen@0ptfi
%The bar will be shortened in the case dimen@<0 !
rel@kern{0.6}kern-dimen@
if#31
overline{rel@kern{-0.6}kerndimen@macc@nucleusrel@kern{0.4}kerndimen@}%
advancedimen@0.4dimexprmacc@kerna
%Place the combined final kern (-dimen@) if it is >0 or if a superscript follows:
letfinal@kern#2%
ifdimdimen@<z@ letfinal@kern1fi
iffinal@kern1 kern-dimen@fi
else
overline{rel@kern{-0.6}kerndimen@#1}%
fi
}%
macc@depth@ne
letmath@bgroup@empty letmath@egroupmacc@set@skewchar
mathsurroundz@ frozen@everymath{mathgroupmacc@grouprelax}%
macc@set@skewcharrelax
letmathaccentVmacc@nested@a
%The following initialises macc@kerna and calls mathaccent:
if#31
macc@nested@arelax111{#1}%
else
%If the argument consists of more than one symbol, and if the first token is
%a letter, use that letter for the computations:
defgobble@till@marker##1endmarker{}%
futureletfirst@chargobble@till@marker#1endmarker
ifcatnoexpandfirst@char Aelse
deffirst@char{}%
fi
macc@nested@arelax111{first@char}%
fi
endgroup
}
makeatother
%% End of code block for widebar macro
begin{document}
[
begin{aligned}
mathscr F(bar{r}(t))&=& int_a^{b} L dt& =&int_a^{b} left[L frac{dt}{dtau}right]dtau=\
=int_a^{b} Bigl[-mc^2-qvarphidfrac{1}{sqrt{1-dfrac{u^{2}}{c^{2}}}}+qfrac{bar{u}cdot widebar{A}}{sqrt{1-dfrac{u^{2}}{c^{2}}}}Bigr] dtau=& &&&\
=int_a^{b} left[-mc^2+q,boldsymbol{mathcal{U}}cdot boldsymbol{mathcal{A}}right] dtau&&&&\
end{aligned}
]
end{document}
I have this output:
However, I would like to have the following alignment as the image below:
In the last few days I have done several tests but I have not succeeded. For other formulas the alignment on the left is very good. With this formula I can't do it.
Lastly, how can I improve the shape of the integral of the second line where the two green rectangles are highlighted? The square brackets do not respect the length of the integral symbol.
math-mode vertical-alignment align best-practices brackets
With this code
documentclass[a4paper,12pt]{article}
usepackage{mathtools, mathrsfs}
%% Code for 'widebar' macro is courtesy of
%% https://tex.stackexchange.com/a/60253
makeatletter
letsave@mathaccentmathaccent
newcommand*if@single[3]{%
setbox0hbox{${mathaccent"0362{#1}}^H$}%
setbox2hbox{${mathaccent"0362{kern0pt#1}}^H$}%
ifdimht0=ht2 #3else #2fi
}
%The bar will be moved to the right by a half of macc@kerna, which is computed by amsmath:
newcommand*rel@kern[1]{kern#1dimexprmacc@kerna}
%If there's a superscript following the bar, then no negative kern may follow the bar;
%an additional {} makes sure that the superscript is high enough in this case:
newcommand*widebar[1]{@ifnextchar^{{wide@bar{#1}{0}}}{wide@bar{#1}{1}}}
%Use a separate algorithm for single symbols:
newcommand*wide@bar[2]{if@single{#1}{wide@bar@{#1}{#2}{1}}{wide@bar@{#1}{#2}{2}}}
newcommand*wide@bar@[3]{%
begingroup
defmathaccent##1##2{%
%Enable nesting of accents:
letmathaccentsave@mathaccent
%If there's more than a single symbol, use the first character instead (see below):
if#32 letmacc@nucleusfirst@char fi
%Determine the italic correction:
setboxz@hbox{$macc@style{macc@nucleus}_{}$}%
setboxtw@hbox{$macc@style{macc@nucleus}{}_{}$}%
dimen@wdtw@
advancedimen@-wdz@
%Now dimen@ is the italic correction of the symbol.
dividedimen@ 3
@tempdimawdtw@
advance@tempdima-scriptspace
%Now @tempdima is the width of the symbol.
divide@tempdima 10
advancedimen@-@tempdima
%Now dimen@ = (italic correction / 3) - (Breite / 10)
ifdimdimen@>z@ dimen@0ptfi
%The bar will be shortened in the case dimen@<0 !
rel@kern{0.6}kern-dimen@
if#31
overline{rel@kern{-0.6}kerndimen@macc@nucleusrel@kern{0.4}kerndimen@}%
advancedimen@0.4dimexprmacc@kerna
%Place the combined final kern (-dimen@) if it is >0 or if a superscript follows:
letfinal@kern#2%
ifdimdimen@<z@ letfinal@kern1fi
iffinal@kern1 kern-dimen@fi
else
overline{rel@kern{-0.6}kerndimen@#1}%
fi
}%
macc@depth@ne
letmath@bgroup@empty letmath@egroupmacc@set@skewchar
mathsurroundz@ frozen@everymath{mathgroupmacc@grouprelax}%
macc@set@skewcharrelax
letmathaccentVmacc@nested@a
%The following initialises macc@kerna and calls mathaccent:
if#31
macc@nested@arelax111{#1}%
else
%If the argument consists of more than one symbol, and if the first token is
%a letter, use that letter for the computations:
defgobble@till@marker##1endmarker{}%
futureletfirst@chargobble@till@marker#1endmarker
ifcatnoexpandfirst@char Aelse
deffirst@char{}%
fi
macc@nested@arelax111{first@char}%
fi
endgroup
}
makeatother
%% End of code block for widebar macro
begin{document}
[
begin{aligned}
mathscr F(bar{r}(t))&=& int_a^{b} L dt& =&int_a^{b} left[L frac{dt}{dtau}right]dtau=\
=int_a^{b} Bigl[-mc^2-qvarphidfrac{1}{sqrt{1-dfrac{u^{2}}{c^{2}}}}+qfrac{bar{u}cdot widebar{A}}{sqrt{1-dfrac{u^{2}}{c^{2}}}}Bigr] dtau=& &&&\
=int_a^{b} left[-mc^2+q,boldsymbol{mathcal{U}}cdot boldsymbol{mathcal{A}}right] dtau&&&&\
end{aligned}
]
end{document}
I have this output:
However, I would like to have the following alignment as the image below:
In the last few days I have done several tests but I have not succeeded. For other formulas the alignment on the left is very good. With this formula I can't do it.
Lastly, how can I improve the shape of the integral of the second line where the two green rectangles are highlighted? The square brackets do not respect the length of the integral symbol.
math-mode vertical-alignment align best-practices brackets
math-mode vertical-alignment align best-practices brackets
edited Mar 2 at 8:35
Mico
285k31388778
285k31388778
asked Mar 1 at 23:28
SebastianoSebastiano
11.1k42165
11.1k42165
2
It is noteqnarray
. Use a single&
per line, before the first=
.
– egreg
Mar 1 at 23:34
1
Is it normal practice where you come from to have an = sign at the end of one line and the start of the next? because it definitely isn't here, you shouldn't have one at the end of the line
– Au101
Mar 1 at 23:37
2
No downvotes so far -- what's going on?! :-)
– Mico
Mar 2 at 10:04
1
@AndréC Because there are frequent times of the year that haters attack me.
– Sebastiano
Mar 2 at 10:36
2
@AndréC - They just downvote, no explanations given, ever. And they really seem to like downvoting Sebastiano's queries. Who knows what motivates them? Maybe they dislike Saint Sebastian and believe it's appropriate to downvote queries by persons whose first name happens to be Sebastian[o]? At this point, any guess is as good, or bad, as any other.
– Mico
Mar 2 at 11:00
|
show 10 more comments
2
It is noteqnarray
. Use a single&
per line, before the first=
.
– egreg
Mar 1 at 23:34
1
Is it normal practice where you come from to have an = sign at the end of one line and the start of the next? because it definitely isn't here, you shouldn't have one at the end of the line
– Au101
Mar 1 at 23:37
2
No downvotes so far -- what's going on?! :-)
– Mico
Mar 2 at 10:04
1
@AndréC Because there are frequent times of the year that haters attack me.
– Sebastiano
Mar 2 at 10:36
2
@AndréC - They just downvote, no explanations given, ever. And they really seem to like downvoting Sebastiano's queries. Who knows what motivates them? Maybe they dislike Saint Sebastian and believe it's appropriate to downvote queries by persons whose first name happens to be Sebastian[o]? At this point, any guess is as good, or bad, as any other.
– Mico
Mar 2 at 11:00
2
2
It is not
eqnarray
. Use a single &
per line, before the first =
.– egreg
Mar 1 at 23:34
It is not
eqnarray
. Use a single &
per line, before the first =
.– egreg
Mar 1 at 23:34
1
1
Is it normal practice where you come from to have an = sign at the end of one line and the start of the next? because it definitely isn't here, you shouldn't have one at the end of the line
– Au101
Mar 1 at 23:37
Is it normal practice where you come from to have an = sign at the end of one line and the start of the next? because it definitely isn't here, you shouldn't have one at the end of the line
– Au101
Mar 1 at 23:37
2
2
No downvotes so far -- what's going on?! :-)
– Mico
Mar 2 at 10:04
No downvotes so far -- what's going on?! :-)
– Mico
Mar 2 at 10:04
1
1
@AndréC Because there are frequent times of the year that haters attack me.
– Sebastiano
Mar 2 at 10:36
@AndréC Because there are frequent times of the year that haters attack me.
– Sebastiano
Mar 2 at 10:36
2
2
@AndréC - They just downvote, no explanations given, ever. And they really seem to like downvoting Sebastiano's queries. Who knows what motivates them? Maybe they dislike Saint Sebastian and believe it's appropriate to downvote queries by persons whose first name happens to be Sebastian[o]? At this point, any guess is as good, or bad, as any other.
– Mico
Mar 2 at 11:00
@AndréC - They just downvote, no explanations given, ever. And they really seem to like downvoting Sebastiano's queries. Who knows what motivates them? Maybe they dislike Saint Sebastian and believe it's appropriate to downvote queries by persons whose first name happens to be Sebastian[o]? At this point, any guess is as good, or bad, as any other.
– Mico
Mar 2 at 11:00
|
show 10 more comments
4 Answers
4
active
oldest
votes
My mathematician's eyes bleed when I see something like
frac{<whatever}{sqrt{1-dfrac{u^2}{c^2}}
appearing more than once; I guess in your document it appears many times.
documentclass[a4paper,12pt]{article}
usepackage{mathtools, mathrsfs,bm}
makeatletter
%<...long code omitted for brevity...>
makeatother
begin{document}
[
begin{aligned}
mathscr F(bar{r}(t))
&= int_a^{b} L dt = int_a^{b} left[L frac{dt}{dtau}right],dtau=\
&=int_a^{b} [-mc^2-qvarphigamma(u)+qbar{u}cdot widebar{A}gamma(u)] ,dtau=\
&=int_a^{b} [-mc^2+q,bm{mathcal{U}}cdot bm{mathcal{A}}] ,dtau\
end{aligned}
]
where
[
gamma(u)=left(1-frac{u^2}{c^2}right)^{-1/2}
]
end{document}
There should be a single &
per line.
I also fixed the usage of left
and right
and loaded bm
that performs better than amsbsy
and its boldsymbol
command, replaced by bm
(but boldsymbol
works as well).
2
What makes your mathematician's eyes bleed when you see thisfrac{<whatever}{sqrt{1-dfrac{u^2}{c^2}}
?
– AndréC
Mar 2 at 9:31
@egreg Thank you so much for your patience and courtesy.
– Sebastiano
Mar 2 at 9:52
@AndréC I think his eyes bleed because of the use ofdfrac
: it should (always) befrac
. Even in this case the OP can useu^2/c^2
since it means the same but more compact.
– manooooh
Mar 20 at 0:27
add a comment |
Here are some suggestions:
documentclass{article}
usepackage{mathtools,mathrsfs,bm,bigints}
begin{document}
[
begin{aligned}
mathscr{F}(bar{r}(t)) &= int_a^b L ,mathrm{d}t = int_a^b left[L dfrac{mathrm{d}t}{mathrm{d}tau} right] ,mathrm{d}tau = \
&= bigint_a^b left[ -m c^2 - q varphi dfrac{1}{sqrt{1 - dfrac{u^2}{c^2}}} +
q frac{bar{u} cdot bar{A}}{sqrt{1 - dfrac{u^2}{c^2}}} right] ,mathrm{d}tau = \
&= int_a^b bigl[ -m c^2 + q,bm{mathcal{U}} cdot bm{mathcal{A}} bigr] mathrm{d}tau
end{aligned}
]
begin{align*}
mathscr{F}(bar{r}(t)) &= int_a^b L ,mathrm{d}t = int_a^b left[L dfrac{mathrm{d}t}{mathrm{d}tau} right] ,mathrm{d}tau = \
&= int_a^b bigl( -m c^2 - q varphi / sqrt{1 - u^2 / c^2} +
q (bar{u} cdot bar{A}) / sqrt{1 - u^2 / c^2} ,bigr) ,mathrm{d}tau = \
&= int_a^b bigl( -m c^2 + q,bm{mathcal{U}} cdot bm{mathcal{A}} bigr) ,mathrm{d}tau
end{align*}
end{document}
The first suggestion uses an extended integral from bigints
, but it places far too big an emphasis visually. Hence the second suggestion, and to use a less-intrusive fraction of the form a / b.
2
No, please, no! ;-)
– egreg
Mar 1 at 23:52
Thank you very much. See the comment to Mico's answer.
– Sebastiano
Mar 2 at 9:51
add a comment |
First you had unnecessary ampersands, and others were missing.
To have some equations left aligned, the simplest way is to use the fleqn
environment from nccmath
. Further, I improved the layout of the middle row, using the mfrac
command (medium-sized
fractions) instead of dfrac
.
documentclass[a4paper,12pt]{article}
usepackage{mathtools, mathrsfs, nccmath}
usepackage[showframe]{geometry}
makeatletter
letsave@mathaccentmathaccent
newcommand*if@single[3]{%
setbox0hbox{${mathaccent"0362{#1}}^H$}%
setbox2hbox{${mathaccent"0362{kern0pt#1}}^H$}%
ifdimht0=ht2 #3else #2fi
}
%The bar will be moved to the right by a half of macc@kerna, which is computed by amsmath:
newcommand*rel@kern[1]{kern#1dimexprmacc@kerna}
%If there's a superscript following the bar, then no negative kern may follow the bar;
%an additional {} makes sure that the superscript is high enough in this case:
newcommand*widebar[1]{@ifnextchar^{{wide@bar{#1}{0}}}{wide@bar{#1}{1}}}
%Use a separate algorithm for single symbols:
newcommand*wide@bar[2]{if@single{#1}{wide@bar@{#1}{#2}{1}}{wide@bar@{#1}{#2}{2}}}
newcommand*wide@bar@[3]{%
begingroup
defmathaccent##1##2{%
%Enable nesting of accents:
letmathaccentsave@mathaccent
%If there's more than a single symbol, use the first character instead (see below):
if#32 letmacc@nucleusfirst@char fi
%Determine the italic correction:
setboxz@hbox{$macc@style{macc@nucleus}_{}$}%
setboxtw@hbox{$macc@style{macc@nucleus}{}_{}$}%
dimen@wdtw@
advancedimen@-wdz@
%Now dimen@ is the italic correction of the symbol.
dividedimen@ 3
@tempdimawdtw@
advance@tempdima-scriptspace
%Now @tempdima is the width of the symbol.
divide@tempdima 10
advancedimen@-@tempdima
%Now dimen@ = (italic correction / 3) - (Breite / 10)
ifdimdimen@>z@ dimen@0ptfi
%The bar will be shortened in the case dimen@<0 !
rel@kern{0.6}kern-dimen@
if#31
overline{rel@kern{-0.6}kerndimen@macc@nucleusrel@kern{0.4}kerndimen@}%
advancedimen@0.4dimexprmacc@kerna
%Place the combined final kern (-dimen@) if it is >0 or if a superscript follows:
letfinal@kern#2%
ifdimdimen@<z@ letfinal@kern1fi
iffinal@kern1 kern-dimen@fi
else
overline{rel@kern{-0.6}kerndimen@#1}%
fi
}%
macc@depth@ne
letmath@bgroup@empty letmath@egroupmacc@set@skewchar
mathsurroundz@ frozen@everymath{mathgroupmacc@grouprelax}%
macc@set@skewcharrelax
letmathaccentVmacc@nested@a
%The following initialises macc@kerna and calls mathaccent:
if#31
macc@nested@arelax111{#1}%
else
%If the argument consists of more than one symbol, and if the first token is
%a letter, use that letter for the computations:
defgobble@till@marker##1endmarker{}%
futureletfirst@chargobble@till@marker#1endmarker
ifcatnoexpandfirst@char Aelse
deffirst@char{}%
fi
macc@nested@arelax111{first@char}%
fi
endgroup
}
makeatother
begin{document}
begin{fleqn}
begin{align*}
mathscr F(bar{r}(t))&= int_a^{b} L dt =int_a^{b} left[L frac{dt}{dtau}right]dtau=\
& =int_a^{b} Bigl[-mc^2-qvarphimfrac{1}{sqrt{1-mfrac{u^{2}mathstrut}{c^{2}}}}+qmfrac{bar{u}cdot widebar{A}}{sqrt{1-mfrac{u^{2}}{c^{2}}}}Bigr] dtau=& &&&\
& =int_a^{b} left[-mc^2+q,boldsymbol{mathcal{U}}cdot boldsymbol{mathcal{A}}right] dtau\
end{align*}
end{fleqn}
end{document}
Thank you very much. See the comment to Mico's answer.
– Sebastiano
Mar 2 at 9:51
add a comment |
A little bit late to the game, but hopefully still useful.
In addition to placing &
alignment points where they're needed, the main change from your sample code is the use of inline-fraction notation for the denominator terms in the middle row. By the way, there is no need for \
at the end of the final row of an aligned
environment.
documentclass[a4paper,12pt]{article}
usepackage{mathtools, mathrsfs, bm}
%% Code for 'widebar' macro is from https://tex.stackexchange.com/a/60253/5001
makeatletter
letsave@mathaccentmathaccent
newcommand*if@single[3]{%
setbox0hbox{${mathaccent"0362{#1}}^H$}%
setbox2hbox{${mathaccent"0362{kern0pt#1}}^H$}%
ifdimht0=ht2 #3else #2fi
}
%The bar will be moved to the right by a half of
%macc@kerna, which is computed by amsmath:
newcommand*rel@kern[1]{kern#1dimexprmacc@kerna}
%If there's a superscript following the bar, then no
%negative kern may follow the bar; an additional {}
%makes sure that the superscript is high enough in
%this case:
newcommand*widebar[1]{@ifnextchar^{{wide@bar{#1}{0}}}{wide@bar{#1}{1}}}
%Use a separate algorithm for single symbols:
newcommand*wide@bar[2]{if@single{#1}{wide@bar@{#1}{#2}{1}}{wide@bar@{#1}{#2}{2}}}
newcommand*wide@bar@[3]{%
begingroup
defmathaccent##1##2{%
%Enable nesting of accents:
letmathaccentsave@mathaccent
%If there's more than a single symbol, use the first
%character instead (see below):
if#32 letmacc@nucleusfirst@char fi
%Determine the italic correction:
setboxz@hbox{$macc@style{macc@nucleus}_{}$}%
setboxtw@hbox{$macc@style{macc@nucleus}{}_{}$}%
dimen@wdtw@
advancedimen@-wdz@
%Now dimen@ is the italic correction of the symbol.
dividedimen@ 3
@tempdimawdtw@
advance@tempdima-scriptspace
%Now @tempdima is the width of the symbol.
divide@tempdima 10
advancedimen@-@tempdima
%Now dimen@ = (italic correction / 3) - (Breite / 10)
ifdimdimen@>z@ dimen@0ptfi
%The bar will be shortened in the case dimen@<0 !
rel@kern{0.6}kern-dimen@
if#31
overline{rel@kern{-0.6}kerndimen@macc@nucleusrel@kern{0.4}kerndimen@}%
advancedimen@0.4dimexprmacc@kerna
%Place the combined final kern (-dimen@) if it is >0 or if a superscript follows:
letfinal@kern#2%
ifdimdimen@<z@ letfinal@kern1fi
iffinal@kern1 kern-dimen@fi
else
overline{rel@kern{-0.6}kerndimen@#1}%
fi
}%
macc@depth@ne
letmath@bgroup@empty letmath@egroupmacc@set@skewchar
mathsurroundz@ frozen@everymath{mathgroupmacc@grouprelax}%
macc@set@skewcharrelax
letmathaccentVmacc@nested@a
%The following initialises macc@kerna and calls mathaccent:
if#31
macc@nested@arelax111{#1}%
else
%If the argument consists of more than one symbol,
%and if the first token is a letter, use that letter
%for the computations:
defgobble@till@marker##1endmarker{}%
futureletfirst@chargobble@till@marker#1endmarker
ifcatnoexpandfirst@char Aelse
deffirst@char{}%
fi
macc@nested@arelax111{first@char}%
fi
endgroup
}
makeatother
begin{document}
[
begin{aligned}
mathscr{F} (bar{r}(t))
&=int_a^{b} ! L ,dt
= int_a^{b} Bigl[L frac{dt}{dtau}Bigr] dtau = \
&=int_a^{b} biggl[-mc^2-qvarphifrac{1}{sqrt{1-u^2/c^2}}
+qfrac{bar{u}cdot widebar{A}}{sqrt{1-u^2/c^2}}biggr] dtau = \
&=int_a^{b} [-mc^2+q,bm{mathcal{U}}cdot bm{mathcal{A}},], dtau
end{aligned}
]
end{document}
Thank you very much. I need everything to learn and to recognize the differences and tricks of the trade :-). The questions were all voted (as always) positively.
– Sebastiano
Mar 2 at 9:51
1
@Sebastiano: I've modified the code, usingmfrac
for all fractions in the middle row (I think it looks nicer).
– Bernard
Mar 2 at 10:21
@Bernard I hope that the electronic translation is good: you like everyone else is as if you were at home when you write to me. Obviously the polite and sensitive ones.
– Sebastiano
Mar 2 at 10:24
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%2f477369%2fa-universal-method-for-left-hand-alignment-of-a-sequence-of-equalities%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
4 Answers
4
active
oldest
votes
4 Answers
4
active
oldest
votes
active
oldest
votes
active
oldest
votes
My mathematician's eyes bleed when I see something like
frac{<whatever}{sqrt{1-dfrac{u^2}{c^2}}
appearing more than once; I guess in your document it appears many times.
documentclass[a4paper,12pt]{article}
usepackage{mathtools, mathrsfs,bm}
makeatletter
%<...long code omitted for brevity...>
makeatother
begin{document}
[
begin{aligned}
mathscr F(bar{r}(t))
&= int_a^{b} L dt = int_a^{b} left[L frac{dt}{dtau}right],dtau=\
&=int_a^{b} [-mc^2-qvarphigamma(u)+qbar{u}cdot widebar{A}gamma(u)] ,dtau=\
&=int_a^{b} [-mc^2+q,bm{mathcal{U}}cdot bm{mathcal{A}}] ,dtau\
end{aligned}
]
where
[
gamma(u)=left(1-frac{u^2}{c^2}right)^{-1/2}
]
end{document}
There should be a single &
per line.
I also fixed the usage of left
and right
and loaded bm
that performs better than amsbsy
and its boldsymbol
command, replaced by bm
(but boldsymbol
works as well).
2
What makes your mathematician's eyes bleed when you see thisfrac{<whatever}{sqrt{1-dfrac{u^2}{c^2}}
?
– AndréC
Mar 2 at 9:31
@egreg Thank you so much for your patience and courtesy.
– Sebastiano
Mar 2 at 9:52
@AndréC I think his eyes bleed because of the use ofdfrac
: it should (always) befrac
. Even in this case the OP can useu^2/c^2
since it means the same but more compact.
– manooooh
Mar 20 at 0:27
add a comment |
My mathematician's eyes bleed when I see something like
frac{<whatever}{sqrt{1-dfrac{u^2}{c^2}}
appearing more than once; I guess in your document it appears many times.
documentclass[a4paper,12pt]{article}
usepackage{mathtools, mathrsfs,bm}
makeatletter
%<...long code omitted for brevity...>
makeatother
begin{document}
[
begin{aligned}
mathscr F(bar{r}(t))
&= int_a^{b} L dt = int_a^{b} left[L frac{dt}{dtau}right],dtau=\
&=int_a^{b} [-mc^2-qvarphigamma(u)+qbar{u}cdot widebar{A}gamma(u)] ,dtau=\
&=int_a^{b} [-mc^2+q,bm{mathcal{U}}cdot bm{mathcal{A}}] ,dtau\
end{aligned}
]
where
[
gamma(u)=left(1-frac{u^2}{c^2}right)^{-1/2}
]
end{document}
There should be a single &
per line.
I also fixed the usage of left
and right
and loaded bm
that performs better than amsbsy
and its boldsymbol
command, replaced by bm
(but boldsymbol
works as well).
2
What makes your mathematician's eyes bleed when you see thisfrac{<whatever}{sqrt{1-dfrac{u^2}{c^2}}
?
– AndréC
Mar 2 at 9:31
@egreg Thank you so much for your patience and courtesy.
– Sebastiano
Mar 2 at 9:52
@AndréC I think his eyes bleed because of the use ofdfrac
: it should (always) befrac
. Even in this case the OP can useu^2/c^2
since it means the same but more compact.
– manooooh
Mar 20 at 0:27
add a comment |
My mathematician's eyes bleed when I see something like
frac{<whatever}{sqrt{1-dfrac{u^2}{c^2}}
appearing more than once; I guess in your document it appears many times.
documentclass[a4paper,12pt]{article}
usepackage{mathtools, mathrsfs,bm}
makeatletter
%<...long code omitted for brevity...>
makeatother
begin{document}
[
begin{aligned}
mathscr F(bar{r}(t))
&= int_a^{b} L dt = int_a^{b} left[L frac{dt}{dtau}right],dtau=\
&=int_a^{b} [-mc^2-qvarphigamma(u)+qbar{u}cdot widebar{A}gamma(u)] ,dtau=\
&=int_a^{b} [-mc^2+q,bm{mathcal{U}}cdot bm{mathcal{A}}] ,dtau\
end{aligned}
]
where
[
gamma(u)=left(1-frac{u^2}{c^2}right)^{-1/2}
]
end{document}
There should be a single &
per line.
I also fixed the usage of left
and right
and loaded bm
that performs better than amsbsy
and its boldsymbol
command, replaced by bm
(but boldsymbol
works as well).
My mathematician's eyes bleed when I see something like
frac{<whatever}{sqrt{1-dfrac{u^2}{c^2}}
appearing more than once; I guess in your document it appears many times.
documentclass[a4paper,12pt]{article}
usepackage{mathtools, mathrsfs,bm}
makeatletter
%<...long code omitted for brevity...>
makeatother
begin{document}
[
begin{aligned}
mathscr F(bar{r}(t))
&= int_a^{b} L dt = int_a^{b} left[L frac{dt}{dtau}right],dtau=\
&=int_a^{b} [-mc^2-qvarphigamma(u)+qbar{u}cdot widebar{A}gamma(u)] ,dtau=\
&=int_a^{b} [-mc^2+q,bm{mathcal{U}}cdot bm{mathcal{A}}] ,dtau\
end{aligned}
]
where
[
gamma(u)=left(1-frac{u^2}{c^2}right)^{-1/2}
]
end{document}
There should be a single &
per line.
I also fixed the usage of left
and right
and loaded bm
that performs better than amsbsy
and its boldsymbol
command, replaced by bm
(but boldsymbol
works as well).
answered Mar 1 at 23:50
egregegreg
731k8919303252
731k8919303252
2
What makes your mathematician's eyes bleed when you see thisfrac{<whatever}{sqrt{1-dfrac{u^2}{c^2}}
?
– AndréC
Mar 2 at 9:31
@egreg Thank you so much for your patience and courtesy.
– Sebastiano
Mar 2 at 9:52
@AndréC I think his eyes bleed because of the use ofdfrac
: it should (always) befrac
. Even in this case the OP can useu^2/c^2
since it means the same but more compact.
– manooooh
Mar 20 at 0:27
add a comment |
2
What makes your mathematician's eyes bleed when you see thisfrac{<whatever}{sqrt{1-dfrac{u^2}{c^2}}
?
– AndréC
Mar 2 at 9:31
@egreg Thank you so much for your patience and courtesy.
– Sebastiano
Mar 2 at 9:52
@AndréC I think his eyes bleed because of the use ofdfrac
: it should (always) befrac
. Even in this case the OP can useu^2/c^2
since it means the same but more compact.
– manooooh
Mar 20 at 0:27
2
2
What makes your mathematician's eyes bleed when you see this
frac{<whatever}{sqrt{1-dfrac{u^2}{c^2}}
?– AndréC
Mar 2 at 9:31
What makes your mathematician's eyes bleed when you see this
frac{<whatever}{sqrt{1-dfrac{u^2}{c^2}}
?– AndréC
Mar 2 at 9:31
@egreg Thank you so much for your patience and courtesy.
– Sebastiano
Mar 2 at 9:52
@egreg Thank you so much for your patience and courtesy.
– Sebastiano
Mar 2 at 9:52
@AndréC I think his eyes bleed because of the use of
dfrac
: it should (always) be frac
. Even in this case the OP can use u^2/c^2
since it means the same but more compact.– manooooh
Mar 20 at 0:27
@AndréC I think his eyes bleed because of the use of
dfrac
: it should (always) be frac
. Even in this case the OP can use u^2/c^2
since it means the same but more compact.– manooooh
Mar 20 at 0:27
add a comment |
Here are some suggestions:
documentclass{article}
usepackage{mathtools,mathrsfs,bm,bigints}
begin{document}
[
begin{aligned}
mathscr{F}(bar{r}(t)) &= int_a^b L ,mathrm{d}t = int_a^b left[L dfrac{mathrm{d}t}{mathrm{d}tau} right] ,mathrm{d}tau = \
&= bigint_a^b left[ -m c^2 - q varphi dfrac{1}{sqrt{1 - dfrac{u^2}{c^2}}} +
q frac{bar{u} cdot bar{A}}{sqrt{1 - dfrac{u^2}{c^2}}} right] ,mathrm{d}tau = \
&= int_a^b bigl[ -m c^2 + q,bm{mathcal{U}} cdot bm{mathcal{A}} bigr] mathrm{d}tau
end{aligned}
]
begin{align*}
mathscr{F}(bar{r}(t)) &= int_a^b L ,mathrm{d}t = int_a^b left[L dfrac{mathrm{d}t}{mathrm{d}tau} right] ,mathrm{d}tau = \
&= int_a^b bigl( -m c^2 - q varphi / sqrt{1 - u^2 / c^2} +
q (bar{u} cdot bar{A}) / sqrt{1 - u^2 / c^2} ,bigr) ,mathrm{d}tau = \
&= int_a^b bigl( -m c^2 + q,bm{mathcal{U}} cdot bm{mathcal{A}} bigr) ,mathrm{d}tau
end{align*}
end{document}
The first suggestion uses an extended integral from bigints
, but it places far too big an emphasis visually. Hence the second suggestion, and to use a less-intrusive fraction of the form a / b.
2
No, please, no! ;-)
– egreg
Mar 1 at 23:52
Thank you very much. See the comment to Mico's answer.
– Sebastiano
Mar 2 at 9:51
add a comment |
Here are some suggestions:
documentclass{article}
usepackage{mathtools,mathrsfs,bm,bigints}
begin{document}
[
begin{aligned}
mathscr{F}(bar{r}(t)) &= int_a^b L ,mathrm{d}t = int_a^b left[L dfrac{mathrm{d}t}{mathrm{d}tau} right] ,mathrm{d}tau = \
&= bigint_a^b left[ -m c^2 - q varphi dfrac{1}{sqrt{1 - dfrac{u^2}{c^2}}} +
q frac{bar{u} cdot bar{A}}{sqrt{1 - dfrac{u^2}{c^2}}} right] ,mathrm{d}tau = \
&= int_a^b bigl[ -m c^2 + q,bm{mathcal{U}} cdot bm{mathcal{A}} bigr] mathrm{d}tau
end{aligned}
]
begin{align*}
mathscr{F}(bar{r}(t)) &= int_a^b L ,mathrm{d}t = int_a^b left[L dfrac{mathrm{d}t}{mathrm{d}tau} right] ,mathrm{d}tau = \
&= int_a^b bigl( -m c^2 - q varphi / sqrt{1 - u^2 / c^2} +
q (bar{u} cdot bar{A}) / sqrt{1 - u^2 / c^2} ,bigr) ,mathrm{d}tau = \
&= int_a^b bigl( -m c^2 + q,bm{mathcal{U}} cdot bm{mathcal{A}} bigr) ,mathrm{d}tau
end{align*}
end{document}
The first suggestion uses an extended integral from bigints
, but it places far too big an emphasis visually. Hence the second suggestion, and to use a less-intrusive fraction of the form a / b.
2
No, please, no! ;-)
– egreg
Mar 1 at 23:52
Thank you very much. See the comment to Mico's answer.
– Sebastiano
Mar 2 at 9:51
add a comment |
Here are some suggestions:
documentclass{article}
usepackage{mathtools,mathrsfs,bm,bigints}
begin{document}
[
begin{aligned}
mathscr{F}(bar{r}(t)) &= int_a^b L ,mathrm{d}t = int_a^b left[L dfrac{mathrm{d}t}{mathrm{d}tau} right] ,mathrm{d}tau = \
&= bigint_a^b left[ -m c^2 - q varphi dfrac{1}{sqrt{1 - dfrac{u^2}{c^2}}} +
q frac{bar{u} cdot bar{A}}{sqrt{1 - dfrac{u^2}{c^2}}} right] ,mathrm{d}tau = \
&= int_a^b bigl[ -m c^2 + q,bm{mathcal{U}} cdot bm{mathcal{A}} bigr] mathrm{d}tau
end{aligned}
]
begin{align*}
mathscr{F}(bar{r}(t)) &= int_a^b L ,mathrm{d}t = int_a^b left[L dfrac{mathrm{d}t}{mathrm{d}tau} right] ,mathrm{d}tau = \
&= int_a^b bigl( -m c^2 - q varphi / sqrt{1 - u^2 / c^2} +
q (bar{u} cdot bar{A}) / sqrt{1 - u^2 / c^2} ,bigr) ,mathrm{d}tau = \
&= int_a^b bigl( -m c^2 + q,bm{mathcal{U}} cdot bm{mathcal{A}} bigr) ,mathrm{d}tau
end{align*}
end{document}
The first suggestion uses an extended integral from bigints
, but it places far too big an emphasis visually. Hence the second suggestion, and to use a less-intrusive fraction of the form a / b.
Here are some suggestions:
documentclass{article}
usepackage{mathtools,mathrsfs,bm,bigints}
begin{document}
[
begin{aligned}
mathscr{F}(bar{r}(t)) &= int_a^b L ,mathrm{d}t = int_a^b left[L dfrac{mathrm{d}t}{mathrm{d}tau} right] ,mathrm{d}tau = \
&= bigint_a^b left[ -m c^2 - q varphi dfrac{1}{sqrt{1 - dfrac{u^2}{c^2}}} +
q frac{bar{u} cdot bar{A}}{sqrt{1 - dfrac{u^2}{c^2}}} right] ,mathrm{d}tau = \
&= int_a^b bigl[ -m c^2 + q,bm{mathcal{U}} cdot bm{mathcal{A}} bigr] mathrm{d}tau
end{aligned}
]
begin{align*}
mathscr{F}(bar{r}(t)) &= int_a^b L ,mathrm{d}t = int_a^b left[L dfrac{mathrm{d}t}{mathrm{d}tau} right] ,mathrm{d}tau = \
&= int_a^b bigl( -m c^2 - q varphi / sqrt{1 - u^2 / c^2} +
q (bar{u} cdot bar{A}) / sqrt{1 - u^2 / c^2} ,bigr) ,mathrm{d}tau = \
&= int_a^b bigl( -m c^2 + q,bm{mathcal{U}} cdot bm{mathcal{A}} bigr) ,mathrm{d}tau
end{align*}
end{document}
The first suggestion uses an extended integral from bigints
, but it places far too big an emphasis visually. Hence the second suggestion, and to use a less-intrusive fraction of the form a / b.
answered Mar 1 at 23:44
WernerWerner
450k729981705
450k729981705
2
No, please, no! ;-)
– egreg
Mar 1 at 23:52
Thank you very much. See the comment to Mico's answer.
– Sebastiano
Mar 2 at 9:51
add a comment |
2
No, please, no! ;-)
– egreg
Mar 1 at 23:52
Thank you very much. See the comment to Mico's answer.
– Sebastiano
Mar 2 at 9:51
2
2
No, please, no! ;-)
– egreg
Mar 1 at 23:52
No, please, no! ;-)
– egreg
Mar 1 at 23:52
Thank you very much. See the comment to Mico's answer.
– Sebastiano
Mar 2 at 9:51
Thank you very much. See the comment to Mico's answer.
– Sebastiano
Mar 2 at 9:51
add a comment |
First you had unnecessary ampersands, and others were missing.
To have some equations left aligned, the simplest way is to use the fleqn
environment from nccmath
. Further, I improved the layout of the middle row, using the mfrac
command (medium-sized
fractions) instead of dfrac
.
documentclass[a4paper,12pt]{article}
usepackage{mathtools, mathrsfs, nccmath}
usepackage[showframe]{geometry}
makeatletter
letsave@mathaccentmathaccent
newcommand*if@single[3]{%
setbox0hbox{${mathaccent"0362{#1}}^H$}%
setbox2hbox{${mathaccent"0362{kern0pt#1}}^H$}%
ifdimht0=ht2 #3else #2fi
}
%The bar will be moved to the right by a half of macc@kerna, which is computed by amsmath:
newcommand*rel@kern[1]{kern#1dimexprmacc@kerna}
%If there's a superscript following the bar, then no negative kern may follow the bar;
%an additional {} makes sure that the superscript is high enough in this case:
newcommand*widebar[1]{@ifnextchar^{{wide@bar{#1}{0}}}{wide@bar{#1}{1}}}
%Use a separate algorithm for single symbols:
newcommand*wide@bar[2]{if@single{#1}{wide@bar@{#1}{#2}{1}}{wide@bar@{#1}{#2}{2}}}
newcommand*wide@bar@[3]{%
begingroup
defmathaccent##1##2{%
%Enable nesting of accents:
letmathaccentsave@mathaccent
%If there's more than a single symbol, use the first character instead (see below):
if#32 letmacc@nucleusfirst@char fi
%Determine the italic correction:
setboxz@hbox{$macc@style{macc@nucleus}_{}$}%
setboxtw@hbox{$macc@style{macc@nucleus}{}_{}$}%
dimen@wdtw@
advancedimen@-wdz@
%Now dimen@ is the italic correction of the symbol.
dividedimen@ 3
@tempdimawdtw@
advance@tempdima-scriptspace
%Now @tempdima is the width of the symbol.
divide@tempdima 10
advancedimen@-@tempdima
%Now dimen@ = (italic correction / 3) - (Breite / 10)
ifdimdimen@>z@ dimen@0ptfi
%The bar will be shortened in the case dimen@<0 !
rel@kern{0.6}kern-dimen@
if#31
overline{rel@kern{-0.6}kerndimen@macc@nucleusrel@kern{0.4}kerndimen@}%
advancedimen@0.4dimexprmacc@kerna
%Place the combined final kern (-dimen@) if it is >0 or if a superscript follows:
letfinal@kern#2%
ifdimdimen@<z@ letfinal@kern1fi
iffinal@kern1 kern-dimen@fi
else
overline{rel@kern{-0.6}kerndimen@#1}%
fi
}%
macc@depth@ne
letmath@bgroup@empty letmath@egroupmacc@set@skewchar
mathsurroundz@ frozen@everymath{mathgroupmacc@grouprelax}%
macc@set@skewcharrelax
letmathaccentVmacc@nested@a
%The following initialises macc@kerna and calls mathaccent:
if#31
macc@nested@arelax111{#1}%
else
%If the argument consists of more than one symbol, and if the first token is
%a letter, use that letter for the computations:
defgobble@till@marker##1endmarker{}%
futureletfirst@chargobble@till@marker#1endmarker
ifcatnoexpandfirst@char Aelse
deffirst@char{}%
fi
macc@nested@arelax111{first@char}%
fi
endgroup
}
makeatother
begin{document}
begin{fleqn}
begin{align*}
mathscr F(bar{r}(t))&= int_a^{b} L dt =int_a^{b} left[L frac{dt}{dtau}right]dtau=\
& =int_a^{b} Bigl[-mc^2-qvarphimfrac{1}{sqrt{1-mfrac{u^{2}mathstrut}{c^{2}}}}+qmfrac{bar{u}cdot widebar{A}}{sqrt{1-mfrac{u^{2}}{c^{2}}}}Bigr] dtau=& &&&\
& =int_a^{b} left[-mc^2+q,boldsymbol{mathcal{U}}cdot boldsymbol{mathcal{A}}right] dtau\
end{align*}
end{fleqn}
end{document}
Thank you very much. See the comment to Mico's answer.
– Sebastiano
Mar 2 at 9:51
add a comment |
First you had unnecessary ampersands, and others were missing.
To have some equations left aligned, the simplest way is to use the fleqn
environment from nccmath
. Further, I improved the layout of the middle row, using the mfrac
command (medium-sized
fractions) instead of dfrac
.
documentclass[a4paper,12pt]{article}
usepackage{mathtools, mathrsfs, nccmath}
usepackage[showframe]{geometry}
makeatletter
letsave@mathaccentmathaccent
newcommand*if@single[3]{%
setbox0hbox{${mathaccent"0362{#1}}^H$}%
setbox2hbox{${mathaccent"0362{kern0pt#1}}^H$}%
ifdimht0=ht2 #3else #2fi
}
%The bar will be moved to the right by a half of macc@kerna, which is computed by amsmath:
newcommand*rel@kern[1]{kern#1dimexprmacc@kerna}
%If there's a superscript following the bar, then no negative kern may follow the bar;
%an additional {} makes sure that the superscript is high enough in this case:
newcommand*widebar[1]{@ifnextchar^{{wide@bar{#1}{0}}}{wide@bar{#1}{1}}}
%Use a separate algorithm for single symbols:
newcommand*wide@bar[2]{if@single{#1}{wide@bar@{#1}{#2}{1}}{wide@bar@{#1}{#2}{2}}}
newcommand*wide@bar@[3]{%
begingroup
defmathaccent##1##2{%
%Enable nesting of accents:
letmathaccentsave@mathaccent
%If there's more than a single symbol, use the first character instead (see below):
if#32 letmacc@nucleusfirst@char fi
%Determine the italic correction:
setboxz@hbox{$macc@style{macc@nucleus}_{}$}%
setboxtw@hbox{$macc@style{macc@nucleus}{}_{}$}%
dimen@wdtw@
advancedimen@-wdz@
%Now dimen@ is the italic correction of the symbol.
dividedimen@ 3
@tempdimawdtw@
advance@tempdima-scriptspace
%Now @tempdima is the width of the symbol.
divide@tempdima 10
advancedimen@-@tempdima
%Now dimen@ = (italic correction / 3) - (Breite / 10)
ifdimdimen@>z@ dimen@0ptfi
%The bar will be shortened in the case dimen@<0 !
rel@kern{0.6}kern-dimen@
if#31
overline{rel@kern{-0.6}kerndimen@macc@nucleusrel@kern{0.4}kerndimen@}%
advancedimen@0.4dimexprmacc@kerna
%Place the combined final kern (-dimen@) if it is >0 or if a superscript follows:
letfinal@kern#2%
ifdimdimen@<z@ letfinal@kern1fi
iffinal@kern1 kern-dimen@fi
else
overline{rel@kern{-0.6}kerndimen@#1}%
fi
}%
macc@depth@ne
letmath@bgroup@empty letmath@egroupmacc@set@skewchar
mathsurroundz@ frozen@everymath{mathgroupmacc@grouprelax}%
macc@set@skewcharrelax
letmathaccentVmacc@nested@a
%The following initialises macc@kerna and calls mathaccent:
if#31
macc@nested@arelax111{#1}%
else
%If the argument consists of more than one symbol, and if the first token is
%a letter, use that letter for the computations:
defgobble@till@marker##1endmarker{}%
futureletfirst@chargobble@till@marker#1endmarker
ifcatnoexpandfirst@char Aelse
deffirst@char{}%
fi
macc@nested@arelax111{first@char}%
fi
endgroup
}
makeatother
begin{document}
begin{fleqn}
begin{align*}
mathscr F(bar{r}(t))&= int_a^{b} L dt =int_a^{b} left[L frac{dt}{dtau}right]dtau=\
& =int_a^{b} Bigl[-mc^2-qvarphimfrac{1}{sqrt{1-mfrac{u^{2}mathstrut}{c^{2}}}}+qmfrac{bar{u}cdot widebar{A}}{sqrt{1-mfrac{u^{2}}{c^{2}}}}Bigr] dtau=& &&&\
& =int_a^{b} left[-mc^2+q,boldsymbol{mathcal{U}}cdot boldsymbol{mathcal{A}}right] dtau\
end{align*}
end{fleqn}
end{document}
Thank you very much. See the comment to Mico's answer.
– Sebastiano
Mar 2 at 9:51
add a comment |
First you had unnecessary ampersands, and others were missing.
To have some equations left aligned, the simplest way is to use the fleqn
environment from nccmath
. Further, I improved the layout of the middle row, using the mfrac
command (medium-sized
fractions) instead of dfrac
.
documentclass[a4paper,12pt]{article}
usepackage{mathtools, mathrsfs, nccmath}
usepackage[showframe]{geometry}
makeatletter
letsave@mathaccentmathaccent
newcommand*if@single[3]{%
setbox0hbox{${mathaccent"0362{#1}}^H$}%
setbox2hbox{${mathaccent"0362{kern0pt#1}}^H$}%
ifdimht0=ht2 #3else #2fi
}
%The bar will be moved to the right by a half of macc@kerna, which is computed by amsmath:
newcommand*rel@kern[1]{kern#1dimexprmacc@kerna}
%If there's a superscript following the bar, then no negative kern may follow the bar;
%an additional {} makes sure that the superscript is high enough in this case:
newcommand*widebar[1]{@ifnextchar^{{wide@bar{#1}{0}}}{wide@bar{#1}{1}}}
%Use a separate algorithm for single symbols:
newcommand*wide@bar[2]{if@single{#1}{wide@bar@{#1}{#2}{1}}{wide@bar@{#1}{#2}{2}}}
newcommand*wide@bar@[3]{%
begingroup
defmathaccent##1##2{%
%Enable nesting of accents:
letmathaccentsave@mathaccent
%If there's more than a single symbol, use the first character instead (see below):
if#32 letmacc@nucleusfirst@char fi
%Determine the italic correction:
setboxz@hbox{$macc@style{macc@nucleus}_{}$}%
setboxtw@hbox{$macc@style{macc@nucleus}{}_{}$}%
dimen@wdtw@
advancedimen@-wdz@
%Now dimen@ is the italic correction of the symbol.
dividedimen@ 3
@tempdimawdtw@
advance@tempdima-scriptspace
%Now @tempdima is the width of the symbol.
divide@tempdima 10
advancedimen@-@tempdima
%Now dimen@ = (italic correction / 3) - (Breite / 10)
ifdimdimen@>z@ dimen@0ptfi
%The bar will be shortened in the case dimen@<0 !
rel@kern{0.6}kern-dimen@
if#31
overline{rel@kern{-0.6}kerndimen@macc@nucleusrel@kern{0.4}kerndimen@}%
advancedimen@0.4dimexprmacc@kerna
%Place the combined final kern (-dimen@) if it is >0 or if a superscript follows:
letfinal@kern#2%
ifdimdimen@<z@ letfinal@kern1fi
iffinal@kern1 kern-dimen@fi
else
overline{rel@kern{-0.6}kerndimen@#1}%
fi
}%
macc@depth@ne
letmath@bgroup@empty letmath@egroupmacc@set@skewchar
mathsurroundz@ frozen@everymath{mathgroupmacc@grouprelax}%
macc@set@skewcharrelax
letmathaccentVmacc@nested@a
%The following initialises macc@kerna and calls mathaccent:
if#31
macc@nested@arelax111{#1}%
else
%If the argument consists of more than one symbol, and if the first token is
%a letter, use that letter for the computations:
defgobble@till@marker##1endmarker{}%
futureletfirst@chargobble@till@marker#1endmarker
ifcatnoexpandfirst@char Aelse
deffirst@char{}%
fi
macc@nested@arelax111{first@char}%
fi
endgroup
}
makeatother
begin{document}
begin{fleqn}
begin{align*}
mathscr F(bar{r}(t))&= int_a^{b} L dt =int_a^{b} left[L frac{dt}{dtau}right]dtau=\
& =int_a^{b} Bigl[-mc^2-qvarphimfrac{1}{sqrt{1-mfrac{u^{2}mathstrut}{c^{2}}}}+qmfrac{bar{u}cdot widebar{A}}{sqrt{1-mfrac{u^{2}}{c^{2}}}}Bigr] dtau=& &&&\
& =int_a^{b} left[-mc^2+q,boldsymbol{mathcal{U}}cdot boldsymbol{mathcal{A}}right] dtau\
end{align*}
end{fleqn}
end{document}
First you had unnecessary ampersands, and others were missing.
To have some equations left aligned, the simplest way is to use the fleqn
environment from nccmath
. Further, I improved the layout of the middle row, using the mfrac
command (medium-sized
fractions) instead of dfrac
.
documentclass[a4paper,12pt]{article}
usepackage{mathtools, mathrsfs, nccmath}
usepackage[showframe]{geometry}
makeatletter
letsave@mathaccentmathaccent
newcommand*if@single[3]{%
setbox0hbox{${mathaccent"0362{#1}}^H$}%
setbox2hbox{${mathaccent"0362{kern0pt#1}}^H$}%
ifdimht0=ht2 #3else #2fi
}
%The bar will be moved to the right by a half of macc@kerna, which is computed by amsmath:
newcommand*rel@kern[1]{kern#1dimexprmacc@kerna}
%If there's a superscript following the bar, then no negative kern may follow the bar;
%an additional {} makes sure that the superscript is high enough in this case:
newcommand*widebar[1]{@ifnextchar^{{wide@bar{#1}{0}}}{wide@bar{#1}{1}}}
%Use a separate algorithm for single symbols:
newcommand*wide@bar[2]{if@single{#1}{wide@bar@{#1}{#2}{1}}{wide@bar@{#1}{#2}{2}}}
newcommand*wide@bar@[3]{%
begingroup
defmathaccent##1##2{%
%Enable nesting of accents:
letmathaccentsave@mathaccent
%If there's more than a single symbol, use the first character instead (see below):
if#32 letmacc@nucleusfirst@char fi
%Determine the italic correction:
setboxz@hbox{$macc@style{macc@nucleus}_{}$}%
setboxtw@hbox{$macc@style{macc@nucleus}{}_{}$}%
dimen@wdtw@
advancedimen@-wdz@
%Now dimen@ is the italic correction of the symbol.
dividedimen@ 3
@tempdimawdtw@
advance@tempdima-scriptspace
%Now @tempdima is the width of the symbol.
divide@tempdima 10
advancedimen@-@tempdima
%Now dimen@ = (italic correction / 3) - (Breite / 10)
ifdimdimen@>z@ dimen@0ptfi
%The bar will be shortened in the case dimen@<0 !
rel@kern{0.6}kern-dimen@
if#31
overline{rel@kern{-0.6}kerndimen@macc@nucleusrel@kern{0.4}kerndimen@}%
advancedimen@0.4dimexprmacc@kerna
%Place the combined final kern (-dimen@) if it is >0 or if a superscript follows:
letfinal@kern#2%
ifdimdimen@<z@ letfinal@kern1fi
iffinal@kern1 kern-dimen@fi
else
overline{rel@kern{-0.6}kerndimen@#1}%
fi
}%
macc@depth@ne
letmath@bgroup@empty letmath@egroupmacc@set@skewchar
mathsurroundz@ frozen@everymath{mathgroupmacc@grouprelax}%
macc@set@skewcharrelax
letmathaccentVmacc@nested@a
%The following initialises macc@kerna and calls mathaccent:
if#31
macc@nested@arelax111{#1}%
else
%If the argument consists of more than one symbol, and if the first token is
%a letter, use that letter for the computations:
defgobble@till@marker##1endmarker{}%
futureletfirst@chargobble@till@marker#1endmarker
ifcatnoexpandfirst@char Aelse
deffirst@char{}%
fi
macc@nested@arelax111{first@char}%
fi
endgroup
}
makeatother
begin{document}
begin{fleqn}
begin{align*}
mathscr F(bar{r}(t))&= int_a^{b} L dt =int_a^{b} left[L frac{dt}{dtau}right]dtau=\
& =int_a^{b} Bigl[-mc^2-qvarphimfrac{1}{sqrt{1-mfrac{u^{2}mathstrut}{c^{2}}}}+qmfrac{bar{u}cdot widebar{A}}{sqrt{1-mfrac{u^{2}}{c^{2}}}}Bigr] dtau=& &&&\
& =int_a^{b} left[-mc^2+q,boldsymbol{mathcal{U}}cdot boldsymbol{mathcal{A}}right] dtau\
end{align*}
end{fleqn}
end{document}
edited Mar 2 at 10:18
answered Mar 1 at 23:46
BernardBernard
175k776207
175k776207
Thank you very much. See the comment to Mico's answer.
– Sebastiano
Mar 2 at 9:51
add a comment |
Thank you very much. See the comment to Mico's answer.
– Sebastiano
Mar 2 at 9:51
Thank you very much. See the comment to Mico's answer.
– Sebastiano
Mar 2 at 9:51
Thank you very much. See the comment to Mico's answer.
– Sebastiano
Mar 2 at 9:51
add a comment |
A little bit late to the game, but hopefully still useful.
In addition to placing &
alignment points where they're needed, the main change from your sample code is the use of inline-fraction notation for the denominator terms in the middle row. By the way, there is no need for \
at the end of the final row of an aligned
environment.
documentclass[a4paper,12pt]{article}
usepackage{mathtools, mathrsfs, bm}
%% Code for 'widebar' macro is from https://tex.stackexchange.com/a/60253/5001
makeatletter
letsave@mathaccentmathaccent
newcommand*if@single[3]{%
setbox0hbox{${mathaccent"0362{#1}}^H$}%
setbox2hbox{${mathaccent"0362{kern0pt#1}}^H$}%
ifdimht0=ht2 #3else #2fi
}
%The bar will be moved to the right by a half of
%macc@kerna, which is computed by amsmath:
newcommand*rel@kern[1]{kern#1dimexprmacc@kerna}
%If there's a superscript following the bar, then no
%negative kern may follow the bar; an additional {}
%makes sure that the superscript is high enough in
%this case:
newcommand*widebar[1]{@ifnextchar^{{wide@bar{#1}{0}}}{wide@bar{#1}{1}}}
%Use a separate algorithm for single symbols:
newcommand*wide@bar[2]{if@single{#1}{wide@bar@{#1}{#2}{1}}{wide@bar@{#1}{#2}{2}}}
newcommand*wide@bar@[3]{%
begingroup
defmathaccent##1##2{%
%Enable nesting of accents:
letmathaccentsave@mathaccent
%If there's more than a single symbol, use the first
%character instead (see below):
if#32 letmacc@nucleusfirst@char fi
%Determine the italic correction:
setboxz@hbox{$macc@style{macc@nucleus}_{}$}%
setboxtw@hbox{$macc@style{macc@nucleus}{}_{}$}%
dimen@wdtw@
advancedimen@-wdz@
%Now dimen@ is the italic correction of the symbol.
dividedimen@ 3
@tempdimawdtw@
advance@tempdima-scriptspace
%Now @tempdima is the width of the symbol.
divide@tempdima 10
advancedimen@-@tempdima
%Now dimen@ = (italic correction / 3) - (Breite / 10)
ifdimdimen@>z@ dimen@0ptfi
%The bar will be shortened in the case dimen@<0 !
rel@kern{0.6}kern-dimen@
if#31
overline{rel@kern{-0.6}kerndimen@macc@nucleusrel@kern{0.4}kerndimen@}%
advancedimen@0.4dimexprmacc@kerna
%Place the combined final kern (-dimen@) if it is >0 or if a superscript follows:
letfinal@kern#2%
ifdimdimen@<z@ letfinal@kern1fi
iffinal@kern1 kern-dimen@fi
else
overline{rel@kern{-0.6}kerndimen@#1}%
fi
}%
macc@depth@ne
letmath@bgroup@empty letmath@egroupmacc@set@skewchar
mathsurroundz@ frozen@everymath{mathgroupmacc@grouprelax}%
macc@set@skewcharrelax
letmathaccentVmacc@nested@a
%The following initialises macc@kerna and calls mathaccent:
if#31
macc@nested@arelax111{#1}%
else
%If the argument consists of more than one symbol,
%and if the first token is a letter, use that letter
%for the computations:
defgobble@till@marker##1endmarker{}%
futureletfirst@chargobble@till@marker#1endmarker
ifcatnoexpandfirst@char Aelse
deffirst@char{}%
fi
macc@nested@arelax111{first@char}%
fi
endgroup
}
makeatother
begin{document}
[
begin{aligned}
mathscr{F} (bar{r}(t))
&=int_a^{b} ! L ,dt
= int_a^{b} Bigl[L frac{dt}{dtau}Bigr] dtau = \
&=int_a^{b} biggl[-mc^2-qvarphifrac{1}{sqrt{1-u^2/c^2}}
+qfrac{bar{u}cdot widebar{A}}{sqrt{1-u^2/c^2}}biggr] dtau = \
&=int_a^{b} [-mc^2+q,bm{mathcal{U}}cdot bm{mathcal{A}},], dtau
end{aligned}
]
end{document}
Thank you very much. I need everything to learn and to recognize the differences and tricks of the trade :-). The questions were all voted (as always) positively.
– Sebastiano
Mar 2 at 9:51
1
@Sebastiano: I've modified the code, usingmfrac
for all fractions in the middle row (I think it looks nicer).
– Bernard
Mar 2 at 10:21
@Bernard I hope that the electronic translation is good: you like everyone else is as if you were at home when you write to me. Obviously the polite and sensitive ones.
– Sebastiano
Mar 2 at 10:24
add a comment |
A little bit late to the game, but hopefully still useful.
In addition to placing &
alignment points where they're needed, the main change from your sample code is the use of inline-fraction notation for the denominator terms in the middle row. By the way, there is no need for \
at the end of the final row of an aligned
environment.
documentclass[a4paper,12pt]{article}
usepackage{mathtools, mathrsfs, bm}
%% Code for 'widebar' macro is from https://tex.stackexchange.com/a/60253/5001
makeatletter
letsave@mathaccentmathaccent
newcommand*if@single[3]{%
setbox0hbox{${mathaccent"0362{#1}}^H$}%
setbox2hbox{${mathaccent"0362{kern0pt#1}}^H$}%
ifdimht0=ht2 #3else #2fi
}
%The bar will be moved to the right by a half of
%macc@kerna, which is computed by amsmath:
newcommand*rel@kern[1]{kern#1dimexprmacc@kerna}
%If there's a superscript following the bar, then no
%negative kern may follow the bar; an additional {}
%makes sure that the superscript is high enough in
%this case:
newcommand*widebar[1]{@ifnextchar^{{wide@bar{#1}{0}}}{wide@bar{#1}{1}}}
%Use a separate algorithm for single symbols:
newcommand*wide@bar[2]{if@single{#1}{wide@bar@{#1}{#2}{1}}{wide@bar@{#1}{#2}{2}}}
newcommand*wide@bar@[3]{%
begingroup
defmathaccent##1##2{%
%Enable nesting of accents:
letmathaccentsave@mathaccent
%If there's more than a single symbol, use the first
%character instead (see below):
if#32 letmacc@nucleusfirst@char fi
%Determine the italic correction:
setboxz@hbox{$macc@style{macc@nucleus}_{}$}%
setboxtw@hbox{$macc@style{macc@nucleus}{}_{}$}%
dimen@wdtw@
advancedimen@-wdz@
%Now dimen@ is the italic correction of the symbol.
dividedimen@ 3
@tempdimawdtw@
advance@tempdima-scriptspace
%Now @tempdima is the width of the symbol.
divide@tempdima 10
advancedimen@-@tempdima
%Now dimen@ = (italic correction / 3) - (Breite / 10)
ifdimdimen@>z@ dimen@0ptfi
%The bar will be shortened in the case dimen@<0 !
rel@kern{0.6}kern-dimen@
if#31
overline{rel@kern{-0.6}kerndimen@macc@nucleusrel@kern{0.4}kerndimen@}%
advancedimen@0.4dimexprmacc@kerna
%Place the combined final kern (-dimen@) if it is >0 or if a superscript follows:
letfinal@kern#2%
ifdimdimen@<z@ letfinal@kern1fi
iffinal@kern1 kern-dimen@fi
else
overline{rel@kern{-0.6}kerndimen@#1}%
fi
}%
macc@depth@ne
letmath@bgroup@empty letmath@egroupmacc@set@skewchar
mathsurroundz@ frozen@everymath{mathgroupmacc@grouprelax}%
macc@set@skewcharrelax
letmathaccentVmacc@nested@a
%The following initialises macc@kerna and calls mathaccent:
if#31
macc@nested@arelax111{#1}%
else
%If the argument consists of more than one symbol,
%and if the first token is a letter, use that letter
%for the computations:
defgobble@till@marker##1endmarker{}%
futureletfirst@chargobble@till@marker#1endmarker
ifcatnoexpandfirst@char Aelse
deffirst@char{}%
fi
macc@nested@arelax111{first@char}%
fi
endgroup
}
makeatother
begin{document}
[
begin{aligned}
mathscr{F} (bar{r}(t))
&=int_a^{b} ! L ,dt
= int_a^{b} Bigl[L frac{dt}{dtau}Bigr] dtau = \
&=int_a^{b} biggl[-mc^2-qvarphifrac{1}{sqrt{1-u^2/c^2}}
+qfrac{bar{u}cdot widebar{A}}{sqrt{1-u^2/c^2}}biggr] dtau = \
&=int_a^{b} [-mc^2+q,bm{mathcal{U}}cdot bm{mathcal{A}},], dtau
end{aligned}
]
end{document}
Thank you very much. I need everything to learn and to recognize the differences and tricks of the trade :-). The questions were all voted (as always) positively.
– Sebastiano
Mar 2 at 9:51
1
@Sebastiano: I've modified the code, usingmfrac
for all fractions in the middle row (I think it looks nicer).
– Bernard
Mar 2 at 10:21
@Bernard I hope that the electronic translation is good: you like everyone else is as if you were at home when you write to me. Obviously the polite and sensitive ones.
– Sebastiano
Mar 2 at 10:24
add a comment |
A little bit late to the game, but hopefully still useful.
In addition to placing &
alignment points where they're needed, the main change from your sample code is the use of inline-fraction notation for the denominator terms in the middle row. By the way, there is no need for \
at the end of the final row of an aligned
environment.
documentclass[a4paper,12pt]{article}
usepackage{mathtools, mathrsfs, bm}
%% Code for 'widebar' macro is from https://tex.stackexchange.com/a/60253/5001
makeatletter
letsave@mathaccentmathaccent
newcommand*if@single[3]{%
setbox0hbox{${mathaccent"0362{#1}}^H$}%
setbox2hbox{${mathaccent"0362{kern0pt#1}}^H$}%
ifdimht0=ht2 #3else #2fi
}
%The bar will be moved to the right by a half of
%macc@kerna, which is computed by amsmath:
newcommand*rel@kern[1]{kern#1dimexprmacc@kerna}
%If there's a superscript following the bar, then no
%negative kern may follow the bar; an additional {}
%makes sure that the superscript is high enough in
%this case:
newcommand*widebar[1]{@ifnextchar^{{wide@bar{#1}{0}}}{wide@bar{#1}{1}}}
%Use a separate algorithm for single symbols:
newcommand*wide@bar[2]{if@single{#1}{wide@bar@{#1}{#2}{1}}{wide@bar@{#1}{#2}{2}}}
newcommand*wide@bar@[3]{%
begingroup
defmathaccent##1##2{%
%Enable nesting of accents:
letmathaccentsave@mathaccent
%If there's more than a single symbol, use the first
%character instead (see below):
if#32 letmacc@nucleusfirst@char fi
%Determine the italic correction:
setboxz@hbox{$macc@style{macc@nucleus}_{}$}%
setboxtw@hbox{$macc@style{macc@nucleus}{}_{}$}%
dimen@wdtw@
advancedimen@-wdz@
%Now dimen@ is the italic correction of the symbol.
dividedimen@ 3
@tempdimawdtw@
advance@tempdima-scriptspace
%Now @tempdima is the width of the symbol.
divide@tempdima 10
advancedimen@-@tempdima
%Now dimen@ = (italic correction / 3) - (Breite / 10)
ifdimdimen@>z@ dimen@0ptfi
%The bar will be shortened in the case dimen@<0 !
rel@kern{0.6}kern-dimen@
if#31
overline{rel@kern{-0.6}kerndimen@macc@nucleusrel@kern{0.4}kerndimen@}%
advancedimen@0.4dimexprmacc@kerna
%Place the combined final kern (-dimen@) if it is >0 or if a superscript follows:
letfinal@kern#2%
ifdimdimen@<z@ letfinal@kern1fi
iffinal@kern1 kern-dimen@fi
else
overline{rel@kern{-0.6}kerndimen@#1}%
fi
}%
macc@depth@ne
letmath@bgroup@empty letmath@egroupmacc@set@skewchar
mathsurroundz@ frozen@everymath{mathgroupmacc@grouprelax}%
macc@set@skewcharrelax
letmathaccentVmacc@nested@a
%The following initialises macc@kerna and calls mathaccent:
if#31
macc@nested@arelax111{#1}%
else
%If the argument consists of more than one symbol,
%and if the first token is a letter, use that letter
%for the computations:
defgobble@till@marker##1endmarker{}%
futureletfirst@chargobble@till@marker#1endmarker
ifcatnoexpandfirst@char Aelse
deffirst@char{}%
fi
macc@nested@arelax111{first@char}%
fi
endgroup
}
makeatother
begin{document}
[
begin{aligned}
mathscr{F} (bar{r}(t))
&=int_a^{b} ! L ,dt
= int_a^{b} Bigl[L frac{dt}{dtau}Bigr] dtau = \
&=int_a^{b} biggl[-mc^2-qvarphifrac{1}{sqrt{1-u^2/c^2}}
+qfrac{bar{u}cdot widebar{A}}{sqrt{1-u^2/c^2}}biggr] dtau = \
&=int_a^{b} [-mc^2+q,bm{mathcal{U}}cdot bm{mathcal{A}},], dtau
end{aligned}
]
end{document}
A little bit late to the game, but hopefully still useful.
In addition to placing &
alignment points where they're needed, the main change from your sample code is the use of inline-fraction notation for the denominator terms in the middle row. By the way, there is no need for \
at the end of the final row of an aligned
environment.
documentclass[a4paper,12pt]{article}
usepackage{mathtools, mathrsfs, bm}
%% Code for 'widebar' macro is from https://tex.stackexchange.com/a/60253/5001
makeatletter
letsave@mathaccentmathaccent
newcommand*if@single[3]{%
setbox0hbox{${mathaccent"0362{#1}}^H$}%
setbox2hbox{${mathaccent"0362{kern0pt#1}}^H$}%
ifdimht0=ht2 #3else #2fi
}
%The bar will be moved to the right by a half of
%macc@kerna, which is computed by amsmath:
newcommand*rel@kern[1]{kern#1dimexprmacc@kerna}
%If there's a superscript following the bar, then no
%negative kern may follow the bar; an additional {}
%makes sure that the superscript is high enough in
%this case:
newcommand*widebar[1]{@ifnextchar^{{wide@bar{#1}{0}}}{wide@bar{#1}{1}}}
%Use a separate algorithm for single symbols:
newcommand*wide@bar[2]{if@single{#1}{wide@bar@{#1}{#2}{1}}{wide@bar@{#1}{#2}{2}}}
newcommand*wide@bar@[3]{%
begingroup
defmathaccent##1##2{%
%Enable nesting of accents:
letmathaccentsave@mathaccent
%If there's more than a single symbol, use the first
%character instead (see below):
if#32 letmacc@nucleusfirst@char fi
%Determine the italic correction:
setboxz@hbox{$macc@style{macc@nucleus}_{}$}%
setboxtw@hbox{$macc@style{macc@nucleus}{}_{}$}%
dimen@wdtw@
advancedimen@-wdz@
%Now dimen@ is the italic correction of the symbol.
dividedimen@ 3
@tempdimawdtw@
advance@tempdima-scriptspace
%Now @tempdima is the width of the symbol.
divide@tempdima 10
advancedimen@-@tempdima
%Now dimen@ = (italic correction / 3) - (Breite / 10)
ifdimdimen@>z@ dimen@0ptfi
%The bar will be shortened in the case dimen@<0 !
rel@kern{0.6}kern-dimen@
if#31
overline{rel@kern{-0.6}kerndimen@macc@nucleusrel@kern{0.4}kerndimen@}%
advancedimen@0.4dimexprmacc@kerna
%Place the combined final kern (-dimen@) if it is >0 or if a superscript follows:
letfinal@kern#2%
ifdimdimen@<z@ letfinal@kern1fi
iffinal@kern1 kern-dimen@fi
else
overline{rel@kern{-0.6}kerndimen@#1}%
fi
}%
macc@depth@ne
letmath@bgroup@empty letmath@egroupmacc@set@skewchar
mathsurroundz@ frozen@everymath{mathgroupmacc@grouprelax}%
macc@set@skewcharrelax
letmathaccentVmacc@nested@a
%The following initialises macc@kerna and calls mathaccent:
if#31
macc@nested@arelax111{#1}%
else
%If the argument consists of more than one symbol,
%and if the first token is a letter, use that letter
%for the computations:
defgobble@till@marker##1endmarker{}%
futureletfirst@chargobble@till@marker#1endmarker
ifcatnoexpandfirst@char Aelse
deffirst@char{}%
fi
macc@nested@arelax111{first@char}%
fi
endgroup
}
makeatother
begin{document}
[
begin{aligned}
mathscr{F} (bar{r}(t))
&=int_a^{b} ! L ,dt
= int_a^{b} Bigl[L frac{dt}{dtau}Bigr] dtau = \
&=int_a^{b} biggl[-mc^2-qvarphifrac{1}{sqrt{1-u^2/c^2}}
+qfrac{bar{u}cdot widebar{A}}{sqrt{1-u^2/c^2}}biggr] dtau = \
&=int_a^{b} [-mc^2+q,bm{mathcal{U}}cdot bm{mathcal{A}},], dtau
end{aligned}
]
end{document}
edited Mar 2 at 11:03
answered Mar 2 at 8:20
MicoMico
285k31388778
285k31388778
Thank you very much. I need everything to learn and to recognize the differences and tricks of the trade :-). The questions were all voted (as always) positively.
– Sebastiano
Mar 2 at 9:51
1
@Sebastiano: I've modified the code, usingmfrac
for all fractions in the middle row (I think it looks nicer).
– Bernard
Mar 2 at 10:21
@Bernard I hope that the electronic translation is good: you like everyone else is as if you were at home when you write to me. Obviously the polite and sensitive ones.
– Sebastiano
Mar 2 at 10:24
add a comment |
Thank you very much. I need everything to learn and to recognize the differences and tricks of the trade :-). The questions were all voted (as always) positively.
– Sebastiano
Mar 2 at 9:51
1
@Sebastiano: I've modified the code, usingmfrac
for all fractions in the middle row (I think it looks nicer).
– Bernard
Mar 2 at 10:21
@Bernard I hope that the electronic translation is good: you like everyone else is as if you were at home when you write to me. Obviously the polite and sensitive ones.
– Sebastiano
Mar 2 at 10:24
Thank you very much. I need everything to learn and to recognize the differences and tricks of the trade :-). The questions were all voted (as always) positively.
– Sebastiano
Mar 2 at 9:51
Thank you very much. I need everything to learn and to recognize the differences and tricks of the trade :-). The questions were all voted (as always) positively.
– Sebastiano
Mar 2 at 9:51
1
1
@Sebastiano: I've modified the code, using
mfrac
for all fractions in the middle row (I think it looks nicer).– Bernard
Mar 2 at 10:21
@Sebastiano: I've modified the code, using
mfrac
for all fractions in the middle row (I think it looks nicer).– Bernard
Mar 2 at 10:21
@Bernard I hope that the electronic translation is good: you like everyone else is as if you were at home when you write to me. Obviously the polite and sensitive ones.
– Sebastiano
Mar 2 at 10:24
@Bernard I hope that the electronic translation is good: you like everyone else is as if you were at home when you write to me. Obviously the polite and sensitive ones.
– Sebastiano
Mar 2 at 10:24
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%2f477369%2fa-universal-method-for-left-hand-alignment-of-a-sequence-of-equalities%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
It is not
eqnarray
. Use a single&
per line, before the first=
.– egreg
Mar 1 at 23:34
1
Is it normal practice where you come from to have an = sign at the end of one line and the start of the next? because it definitely isn't here, you shouldn't have one at the end of the line
– Au101
Mar 1 at 23:37
2
No downvotes so far -- what's going on?! :-)
– Mico
Mar 2 at 10:04
1
@AndréC Because there are frequent times of the year that haters attack me.
– Sebastiano
Mar 2 at 10:36
2
@AndréC - They just downvote, no explanations given, ever. And they really seem to like downvoting Sebastiano's queries. Who knows what motivates them? Maybe they dislike Saint Sebastian and believe it's appropriate to downvote queries by persons whose first name happens to be Sebastian[o]? At this point, any guess is as good, or bad, as any other.
– Mico
Mar 2 at 11:00