间距和换行

间距和换行

我想按照以下格式写几行。例如:

This is my request for better writing:
   a. I want to break the first line in a the next few words and
      to continue here for next few more words.
   b. I want to break the first line in a the next few words and
      to continue here for next few more words.
   c. I want to break the first line in a the next few words and
      to continue here for next few more words.

我希望行号“a”在几个空格后开始。当相应的行中断时,它应该在它开始的第一个单词下继续,例如在行 a(以“I”开头,I 下的单词是 to... b 和 c 也需要相同的行为。

有人可以帮忙解决吗?

答案1

听起来你正在寻找环境enumerate。你可以使用enumitem 包。您可以用 来断行,\\或者用一个空行或 来开始一个新段落\par

编辑leftmargin:您可以使用、itemindent、和键自定义水平间距,labelindent请参阅labelwidthlabelsepenumitem 包文档

\documentclass{article}
\usepackage[showframe]{geometry}% display page margins to make effect of leftmargin better visible
\usepackage{enumitem}% to customize enumerate/itemize/description
\setlist[enumerate,0]{% global customization of enumerate environment, see page 9 of enumitem package documentation.
    label=\alph*.,
    leftmargin=1cm,
}

% a custom command to save some typing, displays the value of a dimension in a table
\newcommand{\displaydimension}[1]{#1 & \the\csname #1\endcsname \\}

\begin{document}
\begin{enumerate}
\item you can \\
    break a line
\item and you can \par
    start a new paragraph
\item current values for horizontal spacing:

    \begin{tabular}[t]{@{}ll@{}}
        \displaydimension{leftmargin}
        \displaydimension{itemindent}
        \displaydimension{labelindent}
        \displaydimension{labelwidth}
        \displaydimension{labelsep}
    \end{tabular}
    \[ \texttt{leftmargin} +  \texttt{itemindent} = \texttt{labelindent} + \texttt{labelwidth} + \texttt{labelsep} \]
    \hfill\scriptsize (according to \texttt{enumitem} package documentation page~4)
\end{enumerate}
\end{document}

在此处输入图片描述

请注意,屏幕截图上的值不是默认值,而是leftmargin=1cm源代码中显示的。默认值为leftmargin=25.00003pt

答案2

我不知道您是否希望使用等宽字体,还是使用普通文本。对于后者,请查看枚举和列表:

\documentclass{article}

\usepackage{enumitem} % for resizing spaces in enumeration

\setlist{parsep=0pt,
    itemsep=0pt,
    %topsep=0pt
}

\usepackage{blindtext}

\renewcommand{\theenumi}{\alph{enumi}}
\begin{document}

Some Text. \blindtext
\begin{enumerate}
    \item Test 1
    \item Test 2
\end{enumerate}

More text. \blindtext
\end{document}

我使用将renewcommand枚举从 1.、2.、.. 更改为 a.、b.、...,如有必要,还请参阅如何更改“枚举”列表格式以使用字母而不是默认的阿拉伯数字?

相关内容