我在使用列表中遇到了一些麻烦multline
。环境中的表达式太低了。这flalign
也发生在以下表达式中:
这是 MWE
\documentclass[10pt,twoside,a4paper]{book}
%\usepackage{showframe}
%\usepackage{layout}
\usepackage{geometry}
\geometry{margin=1in}
%
\usepackage{amsmath}
\usepackage{mathtools}
%
\usepackage{amsthm}
\usepackage{thmtools}
%
\usepackage{newtxmath}
%
\usepackage{lipsum}
%
\usepackage{enumitem}
%%%%%
%Definition of a new list type
\newcounter{qcounter}
\newenvironment{questions}{
\begin{list}{
\bfseries\upshape\arabic{qcounter}.
}{
\renewcommand{\makelabel}[1]{%
\textbf{\refstepcounter{qcounter}\arabic{qcounter}##1.}}%
\usecounter{qcounter}
\setlength{\labelwidth}{0.5em}
\setlength{\labelsep}{0.5em}
\setlength{\leftmargin}{\labelwidth+\labelsep+0.5em}
\setlength{\itemsep}{2pt}
\setlength{\listparindent}{1em}
\setlength{\parsep}{1pt}
\setlength{\topsep}{6pt}
}
}{
\end{list}
}
%Command to correctly align environments in the list
\newcommand{\AL}{%
\setlength{\abovedisplayskip}{0pt}%
\setlength{\belowdisplayskip}{0pt}%
\setlength{\abovedisplayshortskip}{0pt}%
\setlength{\belowdisplayshortskip}{0pt}%
\setlength{\multlinegap}{0pt}%
~\vspace*{-\baselineskip}%
}
\begin{document}
\begin{questions}
\item[]\AL
\begin{multline*}
f(x_1,\,x_2,\,x_3)=(\overline{x}_1\,\overline{x}_2\,\overline{x}_3\sim x_1x_2\overline{x}_3)\sim\\
\sim(x_1\overline{x}_2x_3\sim\overline{x}_1x_2x_3);
\end{multline*}
\item[]\AL
\begin{flalign*}
&\bigoplus\limits_{1\leqslant i<j\leqslant n}x_ix_j\oplus\bigoplus\limits_{i=1}^{n}x_i\,,\quad n\geqslant 2.&
\end{flalign*}
\end{questions}
\end{document}
我正在寻找一些全球性的解决方案,而不是像~\hspace*{-3.5pt}
每次那样。
以下是代码:
\documentclass[10pt,twoside,a4paper]{book}
%\usepackage{showframe}
%\usepackage{layout}
\usepackage{geometry}
\geometry{margin=1in}
%
\usepackage{amsmath}
\usepackage{mathtools}
%
\usepackage{amsthm}
\usepackage{thmtools}
%
\usepackage{newtxmath}
%
\usepackage{lipsum}
%
\usepackage{enumitem}
%%%%%
%Definition of a new list type
\newcounter{qcounter}
\newenvironment{questions}{
\begin{list}{
\bfseries\upshape\arabic{qcounter}.
}{
\renewcommand{\makelabel}[1]{%
\textbf{\refstepcounter{qcounter}\arabic{qcounter}##1.}}%
\usecounter{qcounter}
\setlength{\labelwidth}{0.5em}
\setlength{\labelsep}{0.5em}
\setlength{\leftmargin}{\labelwidth+\labelsep+0.5em}
\setlength{\itemsep}{2pt}
\setlength{\listparindent}{1em}
\setlength{\parsep}{1pt}
\setlength{\topsep}{6pt}
}
}{
\end{list}
}
%Command to correctly align environments in the list
\newcommand{\AL}{%
\setlength{\abovedisplayskip}{0pt}%
\setlength{\belowdisplayskip}{0pt}%
\setlength{\abovedisplayshortskip}{0pt}%
\setlength{\belowdisplayshortskip}{0pt}%
\setlength{\multlinegap}{0pt}%
}
\begin{document}
\begin{questions}
\item[]\AL
$\begin{multlined}[t]
f(x_1,\,x_2,\,x_3)=(\overline{x}_1\,\overline{x}_2\,\overline{x}_3\sim x_1x_2\overline{x}_3)\sim\\
\sim(x_1\overline{x}_2x_3\sim\overline{x}_1x_2x_3);
\end{multlined}$
\item[]\AL
$\begin{aligned}[t]
f(x_1,\,x_2,\,x_3)=(\overline{x}_1\,\overline{x}_2\,\overline{x}_3\sim x_1x_2\overline{x}_3)\sim\sim(x_1\overline{x}_2x_3\sim\overline{x}_1x_2x_3);
\end{aligned}$
\end{questions}
\end{document}
答案1
标准align
& Co. 有多种变体,可用作数学模式中的构建块,即aligned
& Co. 据我所知,您flalign*
根本不需要在这里使用,而可以简单地使用
\item $\begin{aligned}[t] a &= b \\ &= c \end{aligned}$
可选参数指示[t]
将 的第一行基线aligned
与外部基线对齐。 也有一个等效项multlined
(由 定义mathtools
,而aligned
附带amsmath
)。
\item[]
(顺便说一句,由于环境定义不当,您需要每次都输入questions
。我认为这不是故意的......)