enumitem
我对包和嵌套列表有疑问。我正在克隆description
基本列表(将其命名为notacion
)。正如您在下面的 MWE 中看到的,当列表类型相同时,没有问题,并且每个级别定义都可以正常工作,但是,当类型不同时,不会采用第二级设置。
如果您编译下面的示例,当定义有效时,列表项采用正常字体,但当定义无效时,列表项将以粗体显示。(\normalfont
这是第二级的手动设置)。
\documentclass[a4paper]{scrartcl}
\usepackage[english]{babel}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{enumitem}
\usepackage{showframe}
\usepackage{layouts}
\newlength{\margenbasico}
\setlength{\margenbasico}{1cm}
\setlength{\leftskip}{\margenbasico}
\setlength{\parskip}{4pt} % Separación vertical entre párrafos
\setlength{\parindent}{0pt} % Elimina la sangría de primera línea
\setlist[1]{labelindent=\margenbasico,leftmargin=*,align=left} % Global initial settings for all lists
\newlist{notacion}{description}{2} % Cloning description list
\setlist[notacion]{style=nextline, noitemsep,align=left}
\setlist[notacion,1]{%
labelindent=\margenbasico,%
leftmargin=35mm,% \margenbasico+25mm
} %
\setlist[notacion,2]{leftmargin=25mm,font=\normalfont}%
\makeatletter
\newcommand{\level}{\the\@listdepth}
\makeatother
\begin{document}
\section{A section}
If both lists are same type, second level nested list works correctly:
\begin{notacion}
\item [level] \level
\item [leftmargin] \printinunitsof{mm}\prntlen{\leftmargin}
\item [labelindent] \printinunitsof{mm}\prntlen{\labelindent}
\item [labelwidth] \printinunitsof{mm}\prntlen{\labelwidth}
\item [labelsep] \printinunitsof{mm}\prntlen{\labelsep}
\item [itemindent] \printinunitsof{mm}\prntlen{\itemindent}
\begin{notacion}
\item [level] \level
\item [leftmargin] \printinunitsof{mm}\prntlen{\leftmargin}
\item [labelindent] \printinunitsof{mm}\prntlen{\labelindent}
\item [labelwidth] \printinunitsof{mm}\prntlen{\labelwidth}
\item [labelsep] \printinunitsof{mm}\prntlen{\labelsep}
\item [itemindent] \printinunitsof{mm}\prntlen{\itemindent}
\end{notacion}
\end{notacion}
\begin{enumerate}
\item But if list type differ (in this case, into a \texttt{enumerate}
environment), the second level settings are not taken, even if list
depth seems be correct: level \level
\begin{notacion}
\item [level] \level
\item [leftmargin] \printinunitsof{mm}\prntlen{\leftmargin}
\item [labelindent] \printinunitsof{mm}\prntlen{\labelindent}
\item [labelwidth] \printinunitsof{mm}\prntlen{\labelwidth}
\item [labelsep] \printinunitsof{mm}\prntlen{\labelsep}
\item [itemindent] \printinunitsof{mm}\prntlen{\itemindent}
\end{notacion}
\end{enumerate}
\begin{itemize}
\item Neither in \texttt{itemize} lists (level \level)
\begin{notacion}
\item [level] \level
\item [leftmargin] \printinunitsof{mm}\prntlen{\leftmargin}
\item [labelindent] \printinunitsof{mm}\prntlen{\labelindent}
\item [labelwidth] \printinunitsof{mm}\prntlen{\labelwidth}
\item [labelsep] \printinunitsof{mm}\prntlen{\labelsep}
\item [itemindent] \printinunitsof{mm}\prntlen{\itemindent}
\end{notacion}
\end{itemize}
\end{document}
这给出:
谁能帮我?
提前致谢