自动缩进段落的第二行

自动缩进段落的第二行

当处理具有长内容的编号列表时,我得到如下输出: 在此处输入图片描述

不过,我想产生如下输出 在此处输入图片描述

其中“z”和“planes”与单词“Giving”对齐。重复使用 \\,\hskip命令既麻烦又耗时。有没有办法自动缩进“剪切段落”?谢谢。

代码:

\documentclass[12pt,letterpaper]{article}
\usepackage[utf8]{inputenc}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{graphicx}
\usepackage[left=2cm,right=2cm,top=2cm,bottom=2cm]{geometry}
\begin{document}
\noindent (2) Giving the volume of the solid bounded by the surface \\ \hspace{13mm} $z = 10 - 4x - 2y$ below the xy-plane, and on the sides by the \\ \hspace{13mm} planes $y = 0$, $y=3x$ and $x=1$.\\ \vspace{1mm}
\end{document}

答案1

啊,你把 LaTeX 当作 Word 来用。LaTeX 不是 Word。在 Word 中,你可以输入想要在页面上看到的内容,然后通过单击按钮或使用键盘快捷键(Ctrl+i、Ctrl+b 等)来装饰页面。

在 LaTeX 中,我们使用逻辑结构。您必须忘记盖茨和他的 Microsoft Office 的异教方式。不要像编写 Word 文档那样编写文档,然后尝试将其 LaTeX 化,或者找到 x、y、z 的 LaTeX 等效项。

这里有一个枚举列表。所以我们需要环境enumerate。它会自动为我们处理编号以及所有缩进和格式。

\documentclass[12pt]{article}
\pagestyle{plain}
\usepackage[margin=1.8cm]{geometry}
\geometry{a4paper}
\usepackage[parfill]{parskip}
\usepackage{amsmath}

\begin{document}

\begin{enumerate}
  \item Lorem ipsum dolor sit amet, consectetuer adipiscing
  elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis
  natoque penatibus et magnis dis parturient montes, nascetur
  ridiculus mus. Donec quam felis, ultricies nec, pellentesque eu,
  pretium quis, sem. Nulla consequat massa quis enim.
  \item Donec pede justo, fringilla vel, aliquet nec, vulputate eget,
  arcu. In enim justo, rhoncus ut, imperdiet a, venenatis vitae,
  justo. Nullam dictum felis eu pede mollis pretium. Integer
  tincidunt. Cras dapibus. Vivamus elementum semper nisi. Aenean
  vulputate eleifend tellus. Aenean leo ligula, porttitor eu,
  consequat vitae, eleifend ac, enim.
  \item Aliquam lorem ante, dapibus in, viverra quis, feugiat a,
  tellus. Phasellus viverra nulla ut metus varius laoreet. Quisque
  rutrum. Aenean imperdiet. Etiam ultricies nisi vel augue. Curabitur
  ullamcorper ultricies nisi. Nam eget dui.
\end{enumerate}

\end{document}

在此处输入图片描述

这些就是基础知识。

现在,为了让你的列表从 2 开始,你需要执行以下操作:

\setcounter{enumi}{1}

这会将计数器设置为 1。然后当 LaTeX 遇到时,\item它会递增计数器并打印该值。因此,您从 1 开始。然后您得到\item并将计数器移动到 2,然后打印出来。另一个\item将您移动到 ​​3,依此类推。要重现您的特定风格,请使用包enumitem

\documentclass[12pt]{article}
\pagestyle{plain}
\usepackage[margin=1.8cm]{geometry}
\geometry{a4paper}
\usepackage[parfill]{parskip}
\usepackage{amsmath}
\usepackage{enumitem}

\begin{document}

\begin{enumerate}[label=(\arabic*)]
  \setcounter{enumi}{1}
  \item Giving the volume of the solid bounded by the surface $z = 10
  - 4x - 2y$ below the $xy$-plane, and on the sides by the planes $y =
  0$, $y = 3x$ and $x = 1$.
\end{enumerate}

\end{document}

在此处输入图片描述

注意强制换行\\,它们不会结束段落,并且会破坏对齐。注意显式缩进和空白。这两者都有特定的用途,它们也非常适合用于对精确输出进行最终调整,以获得完全正确的视觉效果。作为最后的手段尤其如此。它们应该很少出现在您的文本中。

答案2

使用任何类似列表的结构。下面我使用了enumerate可选参数\item[<label>]

在此处输入图片描述

\documentclass{article}

\begin{document}

\begin{enumerate}
  \item[(2)]
  Giving the volume of the solid bounded by the surface \\
  $z = 10 - 4x - 2y$ below the xy-plane, and on the sides by the \\
  planes $y = 0$, $y = 3x$ and $x = 1$.
\end{enumerate}

\end{document}

答案3

列表结构是您最好的选择(请参阅其他答案)。为了完整起见,可以在段落中使用 和 来\hangafter实现\hangindent

\documentclass[12pt,letterpaper]{article}
\usepackage[utf8]{inputenc}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{graphicx}
\usepackage[left=2cm,right=2cm,top=2cm,bottom=2cm]{geometry}
\begin{document}
\hangafter=1
\settowidth{\hangindent}{(2) }
\noindent (2) Giving the volume of the solid bounded by the surface \\ \hspace{13mm} $z = 10 - 4x - 2y$ below the xy-plane, and on the sides by the \\ \hspace{13mm} planes $y = 0$, $y=3x$ and $x=1$.\\ \vspace{1mm}
\end{document}

绞刑

答案4

如果您想在示例图像之类的列表中执行此操作,可以尝试类似的操作。

\documentclass{article}

\usepackage{lipsum}

\parindent 0.0mm

\begin{document}

\begin{itemize}
\item [(1)] \lipsum[1]
\item [(2)] Giving the volume of the solid bounded by the surface
  $z = 10 - 4x - 2y$ below the $xy$-plane, and on the sides by the
  planes $y = 0$, $y=3x$ and $x=1$.
\end{itemize}
\end{document}

您可能正在寻找列表的自动编号。

\documentclass{article}

\usepackage{lipsum}

\parindent 0.0mm

\begin{document}

\begin{enumerate}
\item \lipsum[1]
\item Two Giving the volume of the solid bounded by the surface
  $z = 10 - 4x - 2y$ below the $xy$-plane, and on the sides by the
  planes $y = 0$, $y=3x$ and $x=1$.
\end{enumerate}
\end{document}

或者甚至description环境是否适合你。

\documentclass{article}

\usepackage{lipsum}

\parindent 0.0mm

\begin{document}

\begin{description}
\item [(1) One] \lipsum[1]
\item [(2) Two] Giving the volume of the solid bounded by the surface
  $z = 10 - 4x - 2y$ below the $xy$-plane, and on the sides by the
  planes $y = 0$, $y=3x$ and $x=1$.
\end{description}
\end{document}

对于一般的文本,如果你使用绞刑包裹。

\documentclass{article}

\usepackage{hanging}

\usepackage{lipsum}

\parindent 0.0mm

\begin{document}

Text without hanging. \lipsum[1]

\hangpara{15.0mm}{1}Single paragraph with hanging. \lipsum[2]

More text without hanging. \lipsum[1]

\begin{hangparas}{15.0mm}{1}
  Multiple paragraphs with hanging. \lipsum[3-10]
\end{hangparas}

\end{document}

相关内容