嗨,我使用 flalign 来获取方程中的两列。我的问题是我无法将注释对齐到右侧。我希望它们对齐到右侧。如果我使用双 &&,注释将右对齐,但它远远超出了我的边距。我的代码如下所示。
\RequirePackage[l2tabu, orthodox]{nag} % Check for obsolete commands and packages and throw warning if such occur.
\documentclass[12pt%
]{scrartcl}
%\documentclass[12pt,a4paper]{scrartcl}
\KOMAoptions{%
% paper=letter,%
twoside=false,%
fontsize=10pt,%
headinclude=true,%
footinclude=true,%
mpinclude=false,%
index=totoc,% Substitutes the obsolete option idxtotoc.
%bibliography=totoc, % Substitutes the obsolete option bibtotoc.
numbers=noenddot% Equivalent to the obsolete option pointlessnumbers.
}
\usepackage{listings}
\usepackage{color} %red, green, blue, yellow, cyan, magenta, black, white
\definecolor{mygreen}{RGB}{28,172,0} % color values Red, Green, Blue
\definecolor{mylilas}{RGB}{170,55,241}
\setlength\parindent{0pt}
\usepackage{caption}
\usepackage{mathtools}
\usepackage{float}
\usepackage{subfigure}
\usepackage{xcolor}
\usepackage{listings}
\usepackage{matlab-prettifier}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{geometry}
\geometry{letterpaper,margin=1in}
\usepackage{graphicx}
\usepackage{amsmath}
\usepackage{amsthm}
\usepackage{float}
\usepackage[ngerman]{babel} % 'nonfrechspacing' is on.
\hyphenation{av-er-age av-er-aged con-verged con-verg-ing con-verg-es con-ver-gence con-ver-gen-ces de-note Di-ri-chlet ex-te-ri-or Helm-holtz Le-gen-dre Lip-schitz %
per-me-a-bil-i-ty po-rous po-rous-ly Neu-mann non-po-rous un-po-rous re-sult swell-ing}
\usepackage[babel]{csquotes} % Provides \enquote.
\usepackage{enumitem} % Improved itemize & enumerate environments.
\setlist{noitemsep} % Remove vertical space between items but leave space around whole list.
\usepackage{booktabs} % Improve tabulars, enable \top-, \mid-, \bottomrule.
\usepackage{tabularx} % Specify total length of tabular.
\newcolumntype{R}{>{\raggedleft\arraybackslash}X}
\newcolumntype{L}{>{\raggedright\arraybackslash}X}
\newcolumntype{C}{>{\centering\arraybackslash}X}
\newcommand*{\tabemph}[1]{\textbf{#1}} % emphasize tabular headings
\usepackage{setspace} % Provides \onehalfspacing.
\usepackage{makeidx}\makeindex
\newcommand{\emidx}[1]{\textbf{#1}}
\usepackage{mathtools}
\theoremstyle{plain}
\newtheorem{theorem}{Theorem}[section]
\newtheorem*{beweis}{Beweis}
\newtheorem{proposition}[theorem]{Proposition}
\newtheorem{problem}{Problem}
\newtheorem{model}{Model}
\newtheorem{lemma}[theorem]{Lemma}
\newtheorem{implementationnote}{Implementation note}
\newtheorem{algorithmus}{Algorithm}
\newtheorem{korollar}{Korollar}
\theoremstyle{remark}
\newtheorem{remark}[theorem]{Bemerkung}
\theoremstyle{definition}
\newtheorem{beispiel}{Beispiel}
\newtheorem*{definition}{Definition}
%% Miscellaneous packages.
\usepackage{placeins} % Provides \FloatBarrier to force figures and tables to be printed before the barrier.
%% Manipulate par indents.
\newcommand*{\linebreakmagic}{\catcode`\^^M=10 } % deactivates automatic par-break
\newcommand*{\linebreakunmagic}{\catcode`\^^M=5 } % reactivates it
\setlength{\parindent}{0em}
\setlength{\parskip}{0pt}
%% My new commands
\usepackage{aligned-overset}
\newcommand{\ui}{\{u_i\}}
\newcommand{\uil}{\{u_i\}_{i=1}^\infty}
\newcommand*{\iot}{\int_{\Omega_T}}
\newcommand{\Lpc}{L^p_c \left(0,T;W^{1,p}(\Omega) \right)}
\newcommand{\Lp}{L^p \left(0,T;W^{1,p}(\Omega) \right)}
\newcommand*{\ot}{\Omega_T}
\newcommand*{\LL}[1]{L^{#1}(\Omega_T)}
\newcommand*{\dt}{\partial_t}
\numberwithin{equation}{section}
\usepackage{dsfont}
\usepackage{bbm}
\newcommand{\intt}{\int_{t_1}^{t_2}}
\newcommand{\io}{\int_{\Omega}}
%\usepackage[nottoc,numbib]{tocbibind}
\newcommand\numberthis{\addtocounter{equation}{1}\tag{\theequation}}
%% Commands.
%\newcommand*{\overunderset}[3]{\overset{#1}{\underset{#2}{#3}}}
\newcommand*{\eps}{\epsilon}
\newcommand*{\E}[1]{\ensuremath{\mathrm{E}{#1}}}
\newcommand*{\setT}{\ensuremath{\mathcal{T}}}
\newcommand*{\setE}{\ensuremath{\mathcal{E}}}
\newcommand*{\setV}{\ensuremath{\mathcal{V}}}
\newcommand*{\vphi}{\varphi} % Basis function.
\renewcommand*{\vec}[1]{{\boldsymbol{#1}}}
% Vector.
\DeclareMathAlphabet{\mathbfsf}{\encodingdefault}{\sfdefault}{bx}{n}
\newcommand*{\vecc}[1]{\mathbfsf{#1}} % Tensor or matrix.
\newcommand*{\normal}{\vec{n}} % Outward unit normal.
\newcommand*{\laplace}{\upDelta} % Laplace operator (this is NOT the same as \Delta which is used for a difference).
\newcommand*{\grad}{\vec{\nabla}} % Gradient.
\newcommand*{\curl}{\vec{\nabla}\times} % Curl.
\renewcommand*{\div}{\vec{\nabla}\cdot} % Divergence.
% \newcommand*{\cdot}{\,\raisebox{0.41ex}{$\centerdot$}\,}
\newcommand*{\NDdiv}{\ND{\vec{\nabla}}\cdot} % Dimensionless divergence.
\newcommand*{\dd}{\mathrm{d}} % Differential d for ``int dx''.
\newcommand*{\abs}[1]{\ensuremath{\left|#1\right|}} % Absolute value or volume.
\renewcommand*{\L}{\mathcal{L}} % Linear bounded mappings.
\newcommand*{\C}{\mathcal{C}} % continuous functions
\newcommand*{\D}{\mathcal{D}} % distributions
\newcommand*{\card}[1]{\ensuremath{\##1}} % Cardinality of a set.
\newcommand*{\cls}[1]{\overline{#1}} % closure
\newcommand*{\transpose}[1]{{#1}^\mathrm{T}} % Transposition.
\newcommand*{\invtrans}[1]{{#1}^\mathrm{-T}} % Inversion/transposition.
\newcommand*{\jump}[1]{\left\llbracket{#1}\right\rrbracket} % Jump of a discontinuous value.
\DeclareMathOperator*{\cond}{cond} % Condition number.
\DeclareMathOperator*{\conv}{conv} % Convex hull.
\DeclareMathOperator*{\diag}{diag} % Diagonal matrix.
\DeclareMathOperator*{\diam}{diam} % Diameter.
\DeclareMathOperator*{\sign}{sign} % Sign.
\DeclareMathOperator*{\supp}{supp} % Support.
\DeclareMathOperator*{\esssup}{ess\,sup}
\newcommand{\upwind}[1]{#1^{\uparrow}} % Upwind symbol. Alternatively, \newcommand{\upwind}[1]{\prescript{\uparrow}{}{#1}}
\newcommand{\downwind}[1]{#1^{\downarrow}} % Downwind symbol. Alternatively, \newcommand{\downwind}[1]{\prescript{\downarrow}{}{#1}}
\usepackage{upgreek} % Greek letters in upright font.
\newcommand*{\muCT}{\mbox{$\upmu$CT}} % Abbreviation for micro-CT.
\newcommand*{\llbrace}{\lbrace\hspace*{-0.235em}\vert}
\newcommand*{\rrbrace}{\vert\hspace*{-0.23em}\rbrace}
\newcommand*{\avg}[1]{\llbrace{#1}\rrbrace} % Average.
\newcommand*{\II}{I\!I} % Roman numbers.
\newcommand*{\III}{I\!I\!I}
\newcommand*{\IV}{I\!V}
\newcommand*{\V}{V}
\newcommand*{\VI}{V\!I}
\newcommand*{\VII}{V\!I\!I}
\newcommand*{\Gammah}{\Gamma_h}
\newcommand*{\GammaD}{\Gamma_\mathrm{D}}
\newcommand*{\GammaN}{\Gamma_\mathrm{N}}
%% Characteristic Numbers and Constants %%
\newcommand*{\Pe}{\mbox{Pe}} % Peclet number.
\newcommand*{\tc}{{t_\mathrm{c}}}
\newcommand*{\Cn}{\mathrm{Cn}} % Cahn number.
\renewcommand*{\Re}{\mathrm{Re}} % Reynods number (overwrites the fraktur-R).
\newcommand*{\Ca}{\mathrm{Ca}} % Capillary number.
\newcommand*{\Fr}{\mathrm{Fr}} % Froude number.
\newcommand*{\St}{\mathrm{St}} % Strouhal number.
\newcommand*{\kB}{k_\mathrm{B}} % Boltzmann constant.
\newcommand*{\NA}{N_\mathrm{A}} % Avogadro constant.
\newcommand*{\hP}{h_\mathrm{P}} % Planck constant.
\newcommand*{\Ncomp}{{N_\mathrm{comp}}} % Number of components.
\newcommand*{\Nc}{{N_\mathrm{c}}} % Number of components.
\newcommand*{\Nel}{{N_\mathrm{el}}} % Number of elements.
\newcommand*{\Nst}{{N_\mathrm{st}}} % Number of time steps.
\newcommand*{\Nloc}{{N_\mathrm{loc}}} % Number of local degrees of freedom.
\newcommand{\pluseq}{\mathrel{+}=} % '+=' symbol.
\newcommand*{\form}[3]{\mathcal{#1}_h\big(#2,#3\big)} % Forms in the variational formulations, e.g. \form{M}{u}{v}
\newcommand*{\strain}{{\boldsymbol{\varepsilon}}}
\newcommand*{\dual}[4]{{\left\langle#1\,,\,#2\right\rangle}_{#3,#4}} % duality pairing.
\newcommand*{\norm}[2]{\|#1\|_{#2}} % Norm.
\newcommand*{\seminorm}[2]{\vert#1\vert_{#2}} % Seminorm.
\newcommand*{\scalprod}[3]{{\left(#1\,,\,#2\right)}_{#3}} % Scalar product.
\newcommand*{\Lscalprod}[2]{{\left(#1\,,\,#2\right)}} % L2 scalar product (scaled).
\newcommand*{\brokennorm}[2]{|\!|\!|#1|\!|\!|_{#2}} % Broken norm, e.g. \brokennorm{v}{H^0(\setE_h)}.
\newcommand*{\Lnorm}[1]{\|#1\|} % L2 norm (not scaled).
\newcommand*{\xLnorm}[1]{\left\|#1\right\|} % L2 norm (scaled).
\newcommand*{\xnorm}[2]{\left\|#1\right\|_{#2}} % Norm (scalable).
\newcommand*{\on}[2]{\left.#1\right\vert_{#2}} % Restriction on a set, ie eg u|G.
\newcommand*{\CQ}[1]{{#1}_\mathrm{c}} % Characteristic quantity.
\newcommand*{\ND}[1]{\tilde{#1}} % Nondimensionalized quantity.
\def\Xint#1{\mathchoice
{\,\XXint\displaystyle\textstyle{#1}}%
{\!\XXint\textstyle\scriptstyle{#1}}%
{\XXint\scriptstyle\scriptscriptstyle{#1}}%
{\XXint\scriptscriptstyle\scriptscriptstyle{#1}}%
\!\int}
\def\XXint#1#2#3{{\setbox0=\hbox{$#1{#2#3}{\int}$ }
\vcenter{\hbox{$#2#3$ }}\kern-.59\wd0}}
\def\ddashint{\Xint=}
\def\dashint{\Xint-}
%\newcommand*{\fint}{\;\dashint} % Mean value integral.
\DeclareMathOperator*{\argmin}{arg\,min} % argmin.
\DeclareMathOperator*{\minmod}{minmod} % minmod.
%% title and language
%\selectlanguage{american}
\begin{document}
\raggedbottom % latex no longer streches vertical spaces s.th. text reaches the bottom
\onehalfspacing % increase vertical spacing between lines since 'newpxtext' font is too dense
\linebreakmagic
\allowdisplaybreaks
\selectlanguage{ngerman}
\begin{flalign*}
&&R_1&\leq C_7^2 \abs{p_i-p} \norm{\nabla \phi}{L^{p+\delta}(\ot)}+C_7C_2\tilde{C}
\sqrt{Q_i -1}
\norm{\nabla u_i}{L^{p+\delta}(\ot)}^{p_i-1} \norm{\nabla \phi}{L^{p_i}(\ot)}&&[\text{mit } (\ref{2.22}) ] \\
&&&\leq C_7^2 \abs{p_i-p} \norm{\nabla \phi}{L^{p+\delta}(\ot)}+ C_7
C_2 \tilde{C}
C^{p_i-1}_*\sqrt{Q_i -1} \norm{\nabla \phi}{L^{p_i}(\ot)} &&[\text{o.B.d.A. } C_*\geq1] \\
&&&\leq C_7^2 \abs{p_i-p} \norm{\nabla \phi}{L^{p+\delta}(\ot)}+ C_7
C_2 \tilde{C}
C^{p_i}_*\sqrt{Q_i -1} \norm{\nabla \phi}{L^{p_i}(\ot)} &&[\text{für $i$ groß genug gilt } p_i\leq p+\delta ] \\
&&&\leq C_7^2 \abs{p_i-p} \norm{\nabla \phi}{L^{p+\delta}(\ot)}+ C_7
C_2 \tilde{C}
C^{p+\delta}_*\sqrt{Q_i -1} \norm{\nabla \phi}{L^{p+\delta}(\ot)} \\
&&&\leq \left(C_7^2\abs{p_i-p}+ C_7 C_2 \tilde{C} C^{p+\delta}_*\sqrt{Q_i -1} \right) \norm{\nabla \phi}{L^{p+\delta}(\ot)} \\
&&&\leq C_8 \eps_i \norm{\nabla \phi}{L^{p+\delta}(\ot)}
\end{flalign*}
\end{document}
答案1
也许你会喜欢它:
(红线表示文本区域边框)
正如我在评论中提到的:
- 请(在下一个问题中)将您的文档示例作为 MWE(最小工作示例),即一个可重现您的问题的小而完整的文档。
- 到目前为止,你的序言大部分内容与你的问题无关。你应该从序言中删除方程式中不需要的所有内容。
- 正如您所写的,您的方程式太宽,无法在页面上显示出来。
- 对于您想要实现的目标,您不需要
flalign
,只要足够就行。但是,如果您使用包中定义的环境align
移动到左边界,您将获得更好的结果。fleqn
nccmath
- 对于右侧的文本:尝试将它们插入
\tag*
命令中,就像我在下面的 MWE 中所做的那样。
\documentclass{article}
\usepackage[margin=25mm]{geometry}
\usepackage[T1]{fontenc}
\usepackage{mathtools, nccmath}
\DeclarePairedDelimiter\abs{\lvert}{\rvert} % for absolute
\newcommand*{\norm}[1]{\|#1\|} % for norm
%---------------- Show page layout. Don't use in a real document!
\usepackage{showframe}
\renewcommand\ShowFrameLinethickness{0.15pt}
\renewcommand*\ShowFrameColor{\color{red}}
%---------------------------------------------------------------%
\usepackage{lipsum}% For dummy text. Don't use in a real document
\begin{document}
\begin{fleqn}
\begin{align*}
R_1 & \leq C_7^2 \abs{p_i-p} \norm{\nabla\phi}_{L^{p+\delta}(\Omega_t)}
+ C_7C_2\widetilde{C}\sqrt{Q_i -1}
\norm{\nabla u_i}_{L^{p+\delta}(\Omega_t)}^{p_i-1}
\norm{\nabla\phi}_{L^{p_i}(\Omega_t)}
\tag*{[mit (\ref{2.22})]}\\
%
& \leq C_7^2 \abs{p_i-p} \norm{\nabla\phi}_{L^{p+\delta}(\Omega_t)}
+ C_7 C_2 \widetilde{C} C^{p_i-1}_* \sqrt{Q_i-1}
\norm{\nabla\phi}_{L^{p_i}(\Omega_t)}
\tag*{[o.B.d.A. $C*\geq 1$]} \\
%
& \leq C_7^2 \abs{p_i-p} \norm{\nabla\phi}_{L^{p+\delta}(\Omega_t)}
+ C_7 C_2 \widetilde{C} C^{p_i}_*\sqrt{Q_i -1}
\norm{\nabla\phi}_{L^{p_i}(\Omega_t)}
\tag*{[für $i$ groß genug gilt $p_i\leq p+\delta$ ]} \\
%
& \leq C_7^2 \abs{p_i-p} \norm{\nabla\phi}_{L^{p+\delta}(\Omega_t)}+ C_7
C_2 \widetilde{C}
C^{p+\delta}_*\sqrt{Q_i -1} \norm{\nabla\phi}_{L^{p+\delta}(\Omega_t)} \\
%
& \leq \bigl(C_7^2\abs{p_i-p} + C_7 C_2 \tilde{C} C^{p+\delta}_*\sqrt{Q_i-1} \bigr)
\norm{\nabla\phi}_{L^{p+\delta}(\Omega_t)} \\
& \leq C_8 \epsilon_i \norm{\nabla\phi}_{L^{p+\delta}(\Omega_t)}
\end{align*}
\end{fleqn}
\end{document}
编辑: 大部分题外话:
- 定义这么多缩写并不是一个明智的想法。如果其他人想在某个期刊上发表你的代码,那么使用它们会使你的代码对大多数人来说难以理解,或者给他们带来不必要的麻烦。正如你所看到的,在我的 MWE 中没有使用它们中的任何一个,并且对
\abs
和 的定义进行了更正\norm
。 - 在方程组中没有插入空行(正如您所做的那样),它们会导致错误。
- 我迷失在文档类的声明中,因此我使用
article
作为文档类。 - 不建议使用
tabu
软件包,因为它有缺陷且无人维护。 好的替代品是功能强大的软件包tabularray
和nicematrix
(两者的语法与 略有不同tabu
)。