
Mit diesem Code
\documentclass[a4paper,12pt]{article}
\usepackage{mathtools, mathrsfs}
%% Code for '\widebar' macro is courtesy of
%% https://tex.stackexchange.com/a/60253
\makeatletter
\let\save@mathaccent\mathaccent
\newcommand*\if@single[3]{%
\setbox0\hbox{${\mathaccent"0362{#1}}^H$}%
\setbox2\hbox{${\mathaccent"0362{\kern0pt#1}}^H$}%
\ifdim\ht0=\ht2 #3\else #2\fi
}
%The bar will be moved to the right by a half of \macc@kerna, which is computed by amsmath:
\newcommand*\rel@kern[1]{\kern#1\dimexpr\macc@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
\def\mathaccent##1##2{%
%Enable nesting of accents:
\let\mathaccent\save@mathaccent
%If there's more than a single symbol, use the first character instead (see below):
\if#32 \let\macc@nucleus\first@char \fi
%Determine the italic correction:
\setbox\z@\hbox{$\macc@style{\macc@nucleus}_{}$}%
\setbox\tw@\hbox{$\macc@style{\macc@nucleus}{}_{}$}%
\dimen@\wd\tw@
\advance\dimen@-\wd\z@
%Now \dimen@ is the italic correction of the symbol.
\divide\dimen@ 3
\@tempdima\wd\tw@
\advance\@tempdima-\scriptspace
%Now \@tempdima is the width of the symbol.
\divide\@tempdima 10
\advance\dimen@-\@tempdima
%Now \dimen@ = (italic correction / 3) - (Breite / 10)
\ifdim\dimen@>\z@ \dimen@0pt\fi
%The bar will be shortened in the case \dimen@<0 !
\rel@kern{0.6}\kern-\dimen@
\if#31
\overline{\rel@kern{-0.6}\kern\dimen@\macc@nucleus\rel@kern{0.4}\kern\dimen@}%
\advance\[email protected]\dimexpr\macc@kerna
%Place the combined final kern (-\dimen@) if it is >0 or if a superscript follows:
\let\final@kern#2%
\ifdim\dimen@<\z@ \let\final@kern1\fi
\if\final@kern1 \kern-\dimen@\fi
\else
\overline{\rel@kern{-0.6}\kern\dimen@#1}%
\fi
}%
\macc@depth\@ne
\let\math@bgroup\@empty \let\math@egroup\macc@set@skewchar
\mathsurround\z@ \frozen@everymath{\mathgroup\macc@group\relax}%
\macc@set@skewchar\relax
\let\mathaccentV\macc@nested@a
%The following initialises \macc@kerna and calls \mathaccent:
\if#31
\macc@nested@a\relax111{#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:
\def\gobble@till@marker##1\endmarker{}%
\futurelet\first@char\gobble@till@marker#1\endmarker
\ifcat\noexpand\first@char A\else
\def\first@char{}%
\fi
\macc@nested@a\relax111{\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}{d\tau}\right]d\tau=\\
=\int_a^{b} \Bigl[-mc^2-q\varphi\dfrac{1}{\sqrt{1-\dfrac{u^{2}}{c^{2}}}}+q\frac{\bar{u}\cdot \widebar{A}}{\sqrt{1-\dfrac{u^{2}}{c^{2}}}}\Bigr] d\tau=& &&&\\
=\int_a^{b} \left[-mc^2+q\,\boldsymbol{\mathcal{U}}\cdot \boldsymbol{\mathcal{A}}\right] d\tau&&&&\\
\end{aligned}
\]
\end{document}
Ich habe diese Ausgabe:
Ich hätte jedoch gerne folgende Ausrichtung wie im Bild unten:
Ich habe in den letzten Tagen mehrere Tests gemacht, bin aber nicht weitergekommen. Bei anderen Formeln ist die Ausrichtung links sehr gut. Bei dieser Formel gelingt es mir nicht.
Und zum Schluss: Wie kann ich die Form des Integrals der zweiten Zeile verbessern, in der die beiden grünen Rechtecke hervorgehoben sind? Die eckigen Klammern berücksichtigen nicht die Länge des Integralsymbols.
Antwort1
Meine Mathematikeraugen bluten, wenn ich so etwas sehe wie
\frac{<whatever}{\sqrt{1-\dfrac{u^2}{c^2}}
erscheint mehr als einmal; ich vermute, in Ihrem Dokument erscheint esvielemal.
\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}{d\tau}\right]\,d\tau=\\
&=\int_a^{b} [-mc^2-q\varphi\gamma(u)+q\bar{u}\cdot \widebar{A}\gamma(u)] \,d\tau=\\
&=\int_a^{b} [-mc^2+q\,\bm{\mathcal{U}}\cdot \bm{\mathcal{A}}] \,d\tau\\
\end{aligned}
\]
where
\[
\gamma(u)=\left(1-\frac{u^2}{c^2}\right)^{-1/2}
\]
\end{document}
Es sollte eineeinzel &
pro Zeile.
Ich habe auch die Verwendung von \left
„and“ \right
und „loaded“ korrigiert bm
, was besser funktioniert als amsbsy
„and“, dessen \boldsymbol
Befehl durch ersetzt wurde \bm
(aber \boldsymbol
genauso gut funktioniert).
Antwort2
Hier sind ein paar Vorschläge:
\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}
Der erste Vorschlag verwendet ein erweitertes Integral ausbigints
, aber es legt optisch viel zu viel Wert. Daher der zweite Vorschlag, einen weniger aufdringlichen Bruchteil der Form a / b zu verwenden.
Antwort3
Zuerst hatten Sie unnötige Et-Zeichen und andere fehlten.
Um einige Gleichungen linksbündig auszurichten, ist es am einfachsten, die fleqn
Umgebung von zu verwenden nccmath
. Außerdem habe ich das Layout der mittleren Zeile verbessert, indem ich den \mfrac
Befehl ( medium-sized
Brüche) anstelle von verwendet habe \dfrac
.
\documentclass[a4paper,12pt]{article}
\usepackage{mathtools, mathrsfs, nccmath}
\usepackage[showframe]{geometry}
\makeatletter
\let\save@mathaccent\mathaccent
\newcommand*\if@single[3]{%
\setbox0\hbox{${\mathaccent"0362{#1}}^H$}%
\setbox2\hbox{${\mathaccent"0362{\kern0pt#1}}^H$}%
\ifdim\ht0=\ht2 #3\else #2\fi
}
%The bar will be moved to the right by a half of \macc@kerna, which is computed by amsmath:
\newcommand*\rel@kern[1]{\kern#1\dimexpr\macc@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
\def\mathaccent##1##2{%
%Enable nesting of accents:
\let\mathaccent\save@mathaccent
%If there's more than a single symbol, use the first character instead (see below):
\if#32 \let\macc@nucleus\first@char \fi
%Determine the italic correction:
\setbox\z@\hbox{$\macc@style{\macc@nucleus}_{}$}%
\setbox\tw@\hbox{$\macc@style{\macc@nucleus}{}_{}$}%
\dimen@\wd\tw@
\advance\dimen@-\wd\z@
%Now \dimen@ is the italic correction of the symbol.
\divide\dimen@ 3
\@tempdima\wd\tw@
\advance\@tempdima-\scriptspace
%Now \@tempdima is the width of the symbol.
\divide\@tempdima 10
\advance\dimen@-\@tempdima
%Now \dimen@ = (italic correction / 3) - (Breite / 10)
\ifdim\dimen@>\z@ \dimen@0pt\fi
%The bar will be shortened in the case \dimen@<0 !
\rel@kern{0.6}\kern-\dimen@
\if#31
\overline{\rel@kern{-0.6}\kern\dimen@\macc@nucleus\rel@kern{0.4}\kern\dimen@}%
\advance\[email protected]\dimexpr\macc@kerna
%Place the combined final kern (-\dimen@) if it is >0 or if a superscript follows:
\let\final@kern#2%
\ifdim\dimen@<\z@ \let\final@kern1\fi
\if\final@kern1 \kern-\dimen@\fi
\else
\overline{\rel@kern{-0.6}\kern\dimen@#1}%
\fi
}%
\macc@depth\@ne
\let\math@bgroup\@empty \let\math@egroup\macc@set@skewchar
\mathsurround\z@ \frozen@everymath{\mathgroup\macc@group\relax}%
\macc@set@skewchar\relax
\let\mathaccentV\macc@nested@a
%The following initialises \macc@kerna and calls \mathaccent:
\if#31
\macc@nested@a\relax111{#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:
\def\gobble@till@marker##1\endmarker{}%
\futurelet\first@char\gobble@till@marker#1\endmarker
\ifcat\noexpand\first@char A\else
\def\first@char{}%
\fi
\macc@nested@a\relax111{\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}{d\tau}\right]d\tau=\\
& =\int_a^{b} \Bigl[-mc^2-q\varphi\mfrac{1}{\sqrt{1-\mfrac{u^{2}\mathstrut}{c^{2}}}}+q\mfrac{\bar{u}\cdot \widebar{A}}{\sqrt{1-\mfrac{u^{2}}{c^{2}}}}\Bigr] d\tau=& &&&\\
& =\int_a^{b} \left[-mc^2+q\,\boldsymbol{\mathcal{U}}\cdot \boldsymbol{\mathcal{A}}\right] d\tau\\
\end{align*}
\end{fleqn}
\end{document}
Antwort4
Ein bisschen spät im Spiel, aber hoffentlich immer noch nützlich.
Neben der Platzierung &
von Ausrichtungspunkten dort, wo sie benötigt werden, ist die wichtigste Änderung gegenüber Ihrem Beispielcode die Verwendung der Inline-Bruchnotation für die Nennerterme in der mittleren Zeile. Übrigens ist dies \\
am Ende der letzten Zeile einer aligned
Umgebung nicht erforderlich.
\documentclass[a4paper,12pt]{article}
\usepackage{mathtools, mathrsfs, bm}
%% Code for '\widebar' macro is from https://tex.stackexchange.com/a/60253/5001
\makeatletter
\let\save@mathaccent\mathaccent
\newcommand*\if@single[3]{%
\setbox0\hbox{${\mathaccent"0362{#1}}^H$}%
\setbox2\hbox{${\mathaccent"0362{\kern0pt#1}}^H$}%
\ifdim\ht0=\ht2 #3\else #2\fi
}
%The bar will be moved to the right by a half of
%\macc@kerna, which is computed by amsmath:
\newcommand*\rel@kern[1]{\kern#1\dimexpr\macc@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
\def\mathaccent##1##2{%
%Enable nesting of accents:
\let\mathaccent\save@mathaccent
%If there's more than a single symbol, use the first
%character instead (see below):
\if#32 \let\macc@nucleus\first@char \fi
%Determine the italic correction:
\setbox\z@\hbox{$\macc@style{\macc@nucleus}_{}$}%
\setbox\tw@\hbox{$\macc@style{\macc@nucleus}{}_{}$}%
\dimen@\wd\tw@
\advance\dimen@-\wd\z@
%Now \dimen@ is the italic correction of the symbol.
\divide\dimen@ 3
\@tempdima\wd\tw@
\advance\@tempdima-\scriptspace
%Now \@tempdima is the width of the symbol.
\divide\@tempdima 10
\advance\dimen@-\@tempdima
%Now \dimen@ = (italic correction / 3) - (Breite / 10)
\ifdim\dimen@>\z@ \dimen@0pt\fi
%The bar will be shortened in the case \dimen@<0 !
\rel@kern{0.6}\kern-\dimen@
\if#31
\overline{\rel@kern{-0.6}\kern\dimen@\macc@nucleus\rel@kern{0.4}\kern\dimen@}%
\advance\[email protected]\dimexpr\macc@kerna
%Place the combined final kern (-\dimen@) if it is >0 or if a superscript follows:
\let\final@kern#2%
\ifdim\dimen@<\z@ \let\final@kern1\fi
\if\final@kern1 \kern-\dimen@\fi
\else
\overline{\rel@kern{-0.6}\kern\dimen@#1}%
\fi
}%
\macc@depth\@ne
\let\math@bgroup\@empty \let\math@egroup\macc@set@skewchar
\mathsurround\z@ \frozen@everymath{\mathgroup\macc@group\relax}%
\macc@set@skewchar\relax
\let\mathaccentV\macc@nested@a
%The following initialises \macc@kerna and calls \mathaccent:
\if#31
\macc@nested@a\relax111{#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:
\def\gobble@till@marker##1\endmarker{}%
\futurelet\first@char\gobble@till@marker#1\endmarker
\ifcat\noexpand\first@char A\else
\def\first@char{}%
\fi
\macc@nested@a\relax111{\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}{d\tau}\Bigr] d\tau = \\
&=\int_a^{b} \biggl[-mc^2-q\varphi\frac{1}{\sqrt{1-u^2/c^2}}
+q\frac{\bar{u}\cdot \widebar{A}}{\sqrt{1-u^2/c^2}}\biggr] d\tau = \\
&=\int_a^{b} [-mc^2+q\,\bm{\mathcal{U}}\cdot \bm{\mathcal{A}}\,]\, d\tau
\end{aligned}
\]
\end{document}