열거 항목 목록을 재개하기 전에 단락을 레이블과 정렬하는 방법

열거 항목 목록을 재개하기 전에 단락을 레이블과 정렬하는 방법

enumitem중단했다가 다시 시작하는 열거 목록이 있습니다 . 중단 전 마지막 항목과 재개 후 첫 번째 항목 사이에 텍스트 단락을 삽입합니다. 다음과 같이 해당 단락을 수평으로 정렬하려면 어떻게 해야 합니까?

  1. 해당 단락의 첫 번째 줄은 가로로 정렬됩니다.왼쪽항목 라벨의 끝(여기 끝에 표시된 출력에 표시됨) 그리고 대신
  2. 전체 단락의 왼쪽 가장자리가왼쪽아이템 라벨 끝.

내가 시도한 것은 다음과 같습니다.

\documentclass[12pt]{article}
\usepackage{calc}
\usepackage{enumitem}

\newlist{myenum}{enumerate}{1}
\setlist[myenum,1]{label= \upshape(\arabic*), ref={\arabic*}}

\begin{document}

\noindent Here is a list.

\begin{myenum}
  \item
    One
  \item
    Two
\end{myenum}

\hspace{\the\labelindent}%
Some other text will go here that may or may not fill out more than a single line of text on the page.

\begin{myenum}[resume*]
  \item 
    Three
  \item
    Four
\end{myenum}

\end{document}

중간 단락의 원하는 정렬입니다.

나는 다음과 같은 길이의 산술적 조합을 원한다고 생각합니다.

\hspace{\the\labelwidth-\the\labelsep}

...그리고 이 작업을 수행하기 위해 패키지의 일부 명령을 사용할 것으로 예상 calc하지만: (a) 이러한 길이를 결합하는 방법을 모르겠습니다. (b) 결합해야 하는 길이가 정확히 어느 정도인지 알 수 없습니다.

답변1

이것은 일을하는 것 같습니다 :

\documentclass[12pt]{article}
\usepackage{calc}
\usepackage{enumitem}

\newlist{myenum}{enumerate}{1}
\setlist[myenum,1]{label= \upshape(\arabic*), ref={\arabic*}}

\newdimen\midlistindent
\settowidth{\midlistindent}{(1)\kern-\labelindent\kern-\labelsep}
\newcommand{\midlist}[1]{%
  \begingroup
  \leftskip\midlistindent
  \noindent #1\unskip\par
  \endgroup}

\begin{document}

\noindent Here is a list.

\begin{myenum}
  \item
    One
  \item
    Two
\end{myenum}

\midlist{%
Some other text will go here that may or may not fill out more than a single line of text on the page.
}

\begin{myenum}[resume*]
  \item 
    Three
  \item
    Four
\end{myenum}

\end{document}

예제 코드 출력

답변2

당신은 올바른 생각을 가지고 있습니다! 그러나 calc환경 을 이용하는 대신 enumitem자체적으로 처리할 수 있습니다. 참고로 enumitem패키지 설명서의 치수 수치는 다음과 같습니다.

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

왼쪽 여백을 0으로 설정하고 레이블 너비를 항목 들여쓰기와 동일하게 설정하려는 것으로 보입니다.

이는 다음과 같은 환경 조정을 통해 달성됩니다 enumerate.

\begin{enumerate}[
    align=left, 
    leftmargin=0pt, 
    itemindent=\labelwidth, 
    labelsep=0pt
]
\end{enumerate}

귀하의 문서에서는 이렇게 보입니다. 이게 당신이 쫓던 것인가요?

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

MWE:

\documentclass[12pt]{article}
\usepackage{enumitem}

\newlist{myenum}{enumerate}{1}
\setlist[myenum,1]{label= \upshape(\arabic*), ref={\arabic*},
    align=left, 
    leftmargin=0pt, 
    itemindent=\labelwidth, 
    labelsep=0pt}

\begin{document}

    \noindent Here is a list.
    
    \begin{myenum}
      \item One
      \item Two
    \end{myenum}
    
    \noindent Some other text will go here that may or may not fill out more than a single line of text on the page.
    
    \begin{myenum}[resume*]
      \item Three
      \item Four
    \end{myenum}

\end{document}

관련 정보