枚举包

枚举包

我正在尝试使用 LaTeX 写一份试卷。我使用 enumerate 包,例如

\begin{enumerate}
  \item This question is about balloons.
    \begin{enumerate}
      \item What shape are balloons?
      \item What colour are balloons?
    \end{enumerate}
\end{enumerate}

问题出现在我想对问题进行评论的时候。目前,枚举的第一级给我一个数字,第二级给我一个字母。但在字母之间,我可能想对问题的下一部分说些什么,我希望它缩进,即不与问题的字母部分处于同一级别。我有一个解决方法:

\begin{enumerate}
  \item This question is about balloons.
    \begin{enumerate}[(a)]
      \item What shape are balloons?
    \end{enumerate}
  Assume that all balloons are the same shape.
    \begin{enumerate}[(b)]
      \item What colour are balloons?
    \end{enumerate}
\end{enumerate}

这真是太痛苦了。如果这样做,最后一个枚举环境中的所有内容都会被标记为(b)。所以我必须\begin{enumerate}标记\end{enumerate} 每个后续部分:

\begin{enumerate}
  \item This question is about balloons.
    \begin{enumerate}[(a)]
      \item What shape are balloons?
    \end{enumerate}
  Assume that all balloons are the same shape.
    \begin{enumerate}[(b)]
      \item What colour are balloons?
    \end{enumerate}
    \begin{enumerate}[(c)]
      \item Why do I have to keep doing this?
    \end{enumerate}
    \begin{enumerate}[(d)]
      \item Why do I have to keep doing this?
    \end{enumerate}
\end{enumerate}

答案1

这很容易enumitem

\documentclass{article}
\usepackage{enumitem}
\newlist{subquestion}{enumerate}{1}
\setlist[subquestion,1]{label=(\alph*)}

\begin{document}
\begin{enumerate}
\item This question is about balloons.
   \begin{subquestion}
   \item What shape are balloons?
   \end{subquestion}
Assume that all balloons are the same shape.
  \begin{subquestion}[resume]
  \item What colour are balloons?
  \item Why do I have to keep doing this?
  \end{subquestion}
Something else.
  \begin{subquestion}[resume]
  \item Why do I have to keep doing this?
  \end{subquestion}
\end{enumerate}
\end{document}

在此处输入图片描述

相关内容