在以下摘录的文章中,我希望将数字放在item
与其(i)
后的第一个等式相同的行上,以避免第一行空白。我找不到任何方法可以手动正确地执行此操作。
感谢您提供的任何想法。
\documentclass{extbook}
\usepackage{mathtools,enumitem}
\begin{document}
\begin{enumerate}[label=(\roman*)]
\item \begin{alignat*}{2}
\langle a_0, z \rangle &> 0, \ldots, \langle a_q, z \rangle &&> 0, \\
\langle c_1, z \rangle &\geq 0, \ldots, \langle c_r, z \rangle &&\geq 0,
\shortintertext{and}
\langle b_1, z \rangle &= 0, \ldots, \langle b_p, z \rangle &&= 0,
\end{alignat*}
has a solution,
\item[or]
\item There exist scalars $\alpha_0, \ldots,\alpha_q$, $\gamma_1, \ldots,\gamma_r$, and $\beta_1, \ldots,\beta_p$, not all zero, satisfying
\begin{equation*}
\begin{gathered}
\alpha_0 a_0 + \dots + \alpha_q a_q + \gamma_1 c_1 + \dots + \gamma_r c_r + \beta_1 b_1 + \dots + \beta_p b_p = 0, \\
\alpha_i \geq 0, \; i = 0,\ldots,q, \\
\gamma_i \geq 0, \; i = 1,\ldots,r,
\end{gathered}
\end{equation*}
but never both.
\end{enumerate}
\end{document}
答案1
因为从\item
技术上讲,在为项目设置某些内容之前,不会在页面上的列表中设置编号。因此,我将插入一个\mbox{}
,然后强制移动到垂直模式(通过\par
),然后调整垂直间距 - \parskip
(由于\par
)、\baselineskip
(垂直跳转整行)和\abovedisplayskip
(插入到上面段落的行尾宽度不大的显示上方的内容)的组合。
\documentclass{article}
\usepackage{mathtools,enumitem}
\showoutput
\begin{document}
\begin{enumerate}[label=(\roman*)]
\item \mbox{} \par
\vspace{\dimexpr-2\baselineskip-\parskip-\abovedisplayskip}
\begin{alignat*}{2}
\langle a_0, z \rangle &> 0, \dots, \langle a_q, z \rangle &&> 0, \\
\langle c_1, z \rangle &\geq 0, \dots, \langle c_r, z \rangle &&\geq 0,
\shortintertext{and}
\langle b_1, z \rangle &= 0, \dots, \langle b_p, z \rangle &&= 0,
\end{alignat*}
has a solution,
\item[or]
\item
There exist scalars $\alpha_0, \dots,\alpha_q$, $\gamma_1, \dots,\gamma_r$, and $\beta_1, \dots,\beta_p$, not all zero, satisfying
\[
\begin{gathered}
\alpha_0 a_0 + \dots + \alpha_q a_q + \gamma_1 c_1 + \dots + \gamma_r c_r + \beta_1 b_1 + \dots + \beta_p b_p = 0, \\
\alpha_i \geq 0, \; i = 0, \dots, q, \\
\gamma_i \geq 0, \; i = 1, \dots, r,
\end{gathered}
\]
but never both.
\end{enumerate}
\end{document}
但请注意,\parskip
和\abovedisplayskip
都是橡胶长度,因此该解决方案可能需要根据页面的位置进行一些调整。
答案2
对于第一个\item
,我建议您使用alignedat
具有对齐的环境[t]
,而不是alignedat*
环境。对于第二个\item
,我会使用单个gather*
环境,而不是嵌套的equation*
/gathered
组合。
\documentclass{extbook}
\usepackage{mathtools,enumitem}
\begin{document}
\begin{enumerate}[label=(\roman*)]
\item Either\quad$\begin{alignedat}[t]{2}
\langle a_0, z \rangle &> 0, \dots, \langle a_q, z \rangle &&> 0, \\
\langle c_1, z \rangle &\geq 0, \dots, \langle c_r, z \rangle &&\geq 0, \\
\text{and\quad}& \\
\langle b_1, z \rangle &= 0, \dots, \langle b_p, z \rangle &&= 0,
\end{alignedat}$
has a solution, or
\item there exist scalars $\alpha_0, \dots,\alpha_q$, $\gamma_1, \dots,\gamma_r$, and $\beta_1, \dots,\beta_p$, not all zero, satisfying
\begin{gather*}
\alpha_0 a_0 + \dots + \alpha_q a_q +
\gamma_1 c_1 + \dots + \gamma_r c_r +
\beta_1 b_1 + \dots + \beta_p b_p = 0, \\
\alpha_i \geq 0, \quad i = 0,\ldots,q, \\
\gamma_i \geq 0, \quad i = 1,\ldots,r,
\end{gather*}
but never both.
\end{enumerate}
\end{document}