调整嵌套编号列表标签的水平对齐方式

调整嵌套编号列表标签的水平对齐方式

在以下示例中,我已成功将第一级编号(考试文档类的内部编号和 enumitem 包的编号)对齐到左边距之后。我想配置两个列表环境(考试文档类和 enumitem 的内部)的对齐方式,以便下一级嵌套编号列表的标签左边缘与上一级编号的 TEXT 的第一个字母完全对齐。我想使用 latex 的内部长度而不是绝对数字来实现这一点,这样即使我更改文档的几何形状,结果也是相同的。可能吗?

代码是:

\documentclass[12pt]{exam}
\usepackage{calc}
\usepackage{tikz}
\usepackage[a4paper, total={160mm,257mm},left=25mm,top=20mm,showframe]{geometry}
\usepackage{enumitem}
\setlist[1]{left=\hoffset}
\setlist[enumerate,3]{label=(\roman*)}
\renewcommand\subpartlabel{(\thesubpart)}
\renewcommand{\questionshook}{%
    \setlength{\leftmargin}{\labelwidth}}
\begin{document}
\noindent Next list uses internal lists of exam document class:

    \begin{questions}
        \question \tikz[overlay,remember picture]\draw[line width=0.5pt](0,0.5) -- (0,-10);This is a text which is longer than a single line just to check the indentation of this question in respect to the left margin.
            \begin{parts}
                \part \tikz[overlay,remember picture]\draw[line width=0.5pt](0,0.5) -- (0,-10);The left edge of the label of this part I would like to be exactly inline with the first letters of text of the higher level numbering which are the letters T and q above
            \end{parts}
                \begin{subparts}
                    \subpart The left edge of this subpart I would like to be inline (aligned) exactly with te first letter of the previous level of enumeration. 
                \end{subparts}
    \end{questions}

\noindent Next list uses enumitem package:

    \begin{enumerate}
        \item This is the first level of numbering
            \begin{enumerate}
                \item Next level numbering list
                    \begin{enumerate}
                        \item Next Next numbering list
                    \end{enumerate}
            \end{enumerate}
    \end{enumerate}
\end{document}

答案1

您想要的是下面这样的东西吗?

    \documentclass[12pt]{exam}
    \usepackage{calc}
    \usepackage{tikz}
    \usepackage[a4paper, total={160mm,257mm},left=25mm,top=20mm,showframe]{geometry}
    \usepackage{enumitem}
    \setlist[1]{left=\hoffset}
    \setlist[enumerate,3]{label=(\roman*)}
    \renewcommand\subpartlabel{(\thesubpart)}
    \renewcommand{\questionshook}{%
        \setlength{\leftmargin}{\labelwidth}}

    \begin{document}

    \noindent Next list uses enumitem package:

        \begin{enumerate}
            \item This is the first level of numbering
                \begin{enumerate}[wide=0pt, leftmargin=*]
                    \item Next level numbering list
                        \begin{enumerate}[wide=0pt]
                            \item Next Next numbering list
                        \end{enumerate}
                \end{enumerate}
        \end{enumerate}

    \end{document} 

在此处输入图片描述

相关内容