如何在簡歷枚舉列表之前將段落與標籤對齊

如何在簡歷枚舉列表之前將段落與標籤對齊

我創建了一個枚舉列表,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

在此輸入影像描述

看來您希望將左邊距設為零,並且標籤寬度等於項目縮排。

這是透過對環境進行以下調整來實現的enumerate

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

這在你的文件中看起來是這樣的。這就是你所追求的嗎?

在此輸入影像描述

微量元素:

\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}

相關內容