在列表中的 \\ 后缩进部分段落

在列表中的 \\ 后缩进部分段落

梅威瑟:

\documentclass{article}
\begin{document}
A list:

\begin{itemize}
\item \texttt{abc def ghi}\\
This needs to be indented.
\item \texttt{jkl mno pqr}\\
This needs to me indented, too.
\item \texttt{stu vwx yz}\\
But this musn't be indented.
\end{itemize}
\end{document}

\\我需要在后面缩进一点文本\item。我不需要全局更改,因为某些文本(可能在另一个列表中)不能缩进。

编辑:

\documentclass{article}
\usepackage{enumitem}
\setlist{parsep=0pt,listparindent=\parindent}

\begin{document}
A list:
\begin{itemize}
\item \texttt{abc def ghi}

This needs to be indented.
\item \texttt{jkl mno pqr}

This needs to me indented, too. It is a very long text and I need it to be moved right, not only the first line.
\item \texttt{stu vwx yz}\\
But this musn't be indented.
\end{itemize}
\end{document}

我之前说的和我想表达的意思不一样。我不想要缩进(将第一行向右移动)。我想将所有行都向右移动。

答案1

加载enumitem包来更改列表内的(后续)段落间距和缩进,并在文本主体中的\\适当位置使用段落(空行)代替。

\documentclass{article}

\usepackage{enumitem}
\setlist{parsep=0pt,listparindent=\parindent}

\begin{document}

A list:

\begin{itemize}
\item \texttt{abc def ghi}

This needs to be indented.
\item \texttt{jkl mno pqr}

This needs to me indented, too.
\item \texttt{stu vwx yz}\\
But this musn't be indented.
\end{itemize}

\end{document}

在此处输入图片描述

编辑:您的修改要求可以通过例如使用包addmargin的环境scrextend(部分)来解决KOMA-Script):

\documentclass{article}

\usepackage{enumitem}
\setlist{parsep=0pt,listparindent=\parindent}

\usepackage{scrextend}

\begin{document}

A list:

\begin{itemize}
\item \texttt{abc def ghi}

This needs to be indented.
\item \texttt{jkl mno pqr}

\begin{addmargin}[\parindent]{0pt}% optional: additional left margin, mandatory: additional margin
This needs to me indented, too. It is a very long text and I need it to be moved right, not only the first line.
\end{addmargin}
\item \texttt{stu vwx yz}\\
But this musn't be indented.
\end{itemize}

\end{document}

在此处输入图片描述

相关内容