단일 항목에 대해 여러 숫자(쉼표로 구분)로 열거

단일 항목에 대해 여러 숫자(쉼표로 구분)로 열거

다음과 같은 목록을 얻고 싶습니다.

1. Text addressing #1.

2,3. Text addressing #2 and #3 together.

4. Text addressing #4.

동기는 목록 항목이 이전 목록을 참조한다는 것입니다. enumerate를 사용하여 이 작업을 쉽게 수행하는 방법에 대한 아이디어가 있습니까? (또는 열거 환경과 일관되게 보이는 다른 방법, 즉 바로 위에 열거 목록이 있는 경우 두 항목의 형식은 2,3 부분을 제외하고는 동일하게 보일 수 있습니다.)

답변1

더 큰 일반성이 필요하지 않으면 다음과 같이 작동할 수 있습니다.

\documentclass{article}
\newcommand{\doubleitem}{%
  \begingroup
  \stepcounter{enumi}%
  \edef\tmp{\theenumi, }%
  \stepcounter{enumi}
  \edef\tmp{\endgroup\noexpand\item[\tmp\labelenumi]}%
  \tmp}

\begin{document}
\begin{enumerate}
\item A
\item B
\item C
\item D
\end{enumerate}
Another
\begin{enumerate}
\item about A
\doubleitem about B and C
\item D
\end{enumerate}
\end{document}

여기에 이미지 설명을 입력하세요

관련 정보