对多行文本进行逐项列出,而无需在每行开头明确写上“item”

对多行文本进行逐项列出,而无需在每行开头明确写上“item”

好的,这可能很容易,但我已经进行了很多谷歌搜索但没有成功。

我有一段很长的文本,其中多行由换行符分隔。我想要做的是逐项列出这段文本,以便每行都对应列表中的一项。我绝对可以做到:

\begin{itemize}
   \item
\begin{itemize}

但是行数实在是太多了,根本没法\item在每行开头都添加代码。我当然可以编写一个脚本来自动执行这个过程,但我想知道:有没有办法在 latex 中创建一个列表,其中的项目用换行符分隔,而不是\item在每个项目的开头都写上一行?

如果我能更清楚地解释的话请告诉我。

答案1

扩展 David Carlisle 的建议,您可以发布\obeylines和设置\everypar以产生项目符号和适当间距。将所有内容包含在内\bgroup...\egroup也会限制这些更改的范围。

示例输出

\documentclass{article}

\begin{document}

\noindent
Some text to indicate the left margin.

\bgroup\obeylines\everypar{\hspace*{2em}\textbullet\enspace}
A text line that is to be an item.
A text line that is to be an item.
A text line that is to be an item.
A text line that is to be an item.
A text line that is to be an item.
A text line that is to be an item.
A text line that is to be an item.
A text line that is to be an item.
A text line that is to be an item.
A text line that is to be an item.
A text line that is to be an item.
A text line that is to be an item.
A text line that is to be an item.
A text line that is to be an item.
A text line that is to be an item.
A text line that is to be an item.
A text line that is to be an item.
A text line that is to be an item.
A text line that is to be an item.
A text line that is to be an item.
A text line that is to be an item.
A text line that is to be an item.
A text line that is to be an item.
A text line that is to be an item.
A text line that is to be an item.
A text line that is to be an item.
A text line that is to be an item.
A text line that is to be an item.
\egroup

\end{document}

相关内容