如何使用左对齐标签对齐枚举环境中每个 \item 的开头?

如何使用左对齐标签对齐枚举环境中每个 \item 的开头?

这是我使用 LuaLaTeX 和scrbookKOMA-Script 类的 MWE:

\documentclass[%
% draft,
twoside,
headings=openany, % parts/chapters start on any page whether it's odd or even
DIV=15, % division factor
BCOR=12.5mm, % binding correction
headsepline=1.5pt, % header line
footsepline=0.4pt, % footer line
numbers=noenddot, % no dots at the end of section numbering
% chapterprefix
]{scrbook} % 11pt, a4paper (default)
\usepackage{scrhack}
\usepackage[automark]{scrlayer-scrpage}
\usepackage[english]{babel}
\usepackage[babel]{microtype}
\usepackage{mathtools, amssymb}
\usepackage[warnings-off={mathtools-colon,mathtools-overbracket}]{unicode-math} % Math fonts
    \setmathfont{Latin Modern Math}
\usepackage{setspace}\setdisplayskipstretch{}
\usepackage{enumitem}
    \setlist[enumerate]{font={\bfseries}}
    \setlist[enumerate,2]{label=(\roman*), align=left}
    % shift footer down
    \ModifyLayer[addvoffset=.6ex]{scrheadings.foot.odd}
    \ModifyLayer[addvoffset=.6ex]{scrheadings.foot.even}
    \ModifyLayer[addvoffset=.6ex]{scrheadings.foot.oneside}
    \ModifyLayer[addvoffset=.6ex]{plain.scrheadings.foot.odd}
    \ModifyLayer[addvoffset=.6ex]{plain.scrheadings.foot.even}
    \ModifyLayer[addvoffset=.6ex]{plain.scrheadings.foot.oneside}
\begin{document}
    \onehalfspacing
    \KOMAoptions{DIV=current}
    \addtokomafont{pagenumber}{\normalsize\bfseries\sffamily} % page number font
    \ifoot*{} % inner footer
    \cfoot*{} % central footer
    \ofoot*{\pagemark} % outer footer
\begin{enumerate}
% No. 05
\item[5.] Prove the following:
    \begin{enumerate}
            % (i)
            \item If \(a < b\) and \(c < d\), then \(a + c < b + d\).
            % (ii)
            \item If \(a < b\), then \(-b < -a\). 
            % (iii)
            \item If \(a < b\) and \(c > d\), then \(a - c < b - d\). 
            % (iv)
            \item If \(a < b\) and \(c > 0\), then \(ac < bc\).
            % (v)
            \item If \(a < b\) and \(c < 0\), then \(ac > bc\).
            % (vi)
            \item If \(a > 1\), then \(a^2 > a\).
            % (vii)
            \item If \(0 < a < 1\), then \(a^2 < a\).
            % (viii)
            \item If \(0 \leq a < b\) and \(0 \leq c < d\), then \(ac < bd\).
            % (ix)
            \item If \(0 \leq a < b\), then \(a^2 < b^2\). (Use \textbf{(viii)}.)
            % (x)
            \item If \(a, b \geq 0\) and \(a^2 < b^2\), then \(a < b\).  (Use \textbf{(ix)}, backwards.)
    \end{enumerate}
\end{enumerate}
\end{document}

这是编译的结果。

在此处输入图片描述

我的问题是:我如何对齐每个的开头\item(在这个特定情况下是“如果”)?

我尝试阅读enumitem包文档以获取有关如何使用和调整参数的更多信息:leftmargin,,,,,,等。labelindentlabelwidthlabelseplabelsep*itemindent

在此处输入图片描述

在此处输入图片描述

并且我已经阅读了几个不同但相关的 TeX SE 问题,但是在对它们的使用进行修改之后我仍然感到困惑,\setlist并且在使用嵌套的enumerates 时它们经常会表现得很奇怪(第一层和第二层标签会相互接触或者第二层标签和项目之间的水平空间会太大)。

我的目标是排版如下:

在此处输入图片描述

任何帮助我都会非常感激。谢谢。

答案1

编辑:

对于第二级,enumerate您需要增加labelwidth项目标签,使其更宽,并且枚举的leftmargin数量与labelsep第一级相同。例如:

    \setlist[enumerate,1]{label=\textbf{\arabic*.},  % <--- ccorrected
                          labelsep=1em}  % <--- added
    \setlist[enumerate,2]{label=(\roman*), align=left,
                          labelwidth=2.2em, leftmargin=3.2em} % <--- added

经过这一更改后,列表将如下所示:

在此处输入图片描述

完整(真实)的 MWE 可以是:

\documentclass{scrbook} % 11pt, a4paper (default)
\usepackage[automark]{scrlayer-scrpage}
\usepackage[english]{babel}
\usepackage[babel]{microtype}
\usepackage[warnings-off={mathtools-colon,
                          mathtools-overbracket}]{unicode-math} % Math fonts
    \setmathfont{Latin Modern Math}

\usepackage{setspace}
    \setdisplayskipstretch{}

\usepackage{enumitem}
    \setlist[enumerate,1]{label=\textbf{\arabic*.},  % <--- ccorrected
                          labelsep=1em}  % <--- added
    \setlist[enumerate,2]{label=(\roman*), align=left,
                          labelwidth=2.2em, leftmargin=3.2em} % <--- added
\begin{document}
\begin{enumerate}
\item Prove the following:
    \begin{enumerate}[start=5] % in real document remove this option
\item If \(a < b\) and \(c < d\), then \(a + c < b + d\).
\item If \(a < b\), then \(-b < -a\).
\item If \(a < b\) and \(c > d\), then \(a - c < b - d\).
\item If \(a < b\) and \(c > 0\), then \(ac < bc\).
\item If \(a < b\) and \(c < 0\), then \(ac > bc\).
\item If \(a > 1\), then \(a^2 > a\).
\item If \(0 < a < 1\), then \(a^2 < a\).
\item If \(0 \leq a < b\) and \(0 \leq c < d\), then \(ac < bd\).
\item If \(0 \leq a < b\), then \(a^2 < b^2\). (Use \textbf{(viii)}.)
\item If \(a, b \geq 0\) and \(a^2 < b^2\), then \(a < b\).  (Use \textbf{(ix)}, backwards.)
    \end{enumerate}
\end{enumerate}
\end{document}

相关内容