不需要的缩进

不需要的缩进

使用以下代码,“包含 3 名海盗的场景..”及其以下的所有内容都相对于上面的文本进行了缩进。

\documentclass{article}
\title{Assignment \#1}
\author{Giri}
\date{March 20, 2014}
\begin{document}
\maketitle     
\section*{Question 1}
\textit{Scenario containing 2 pirates :} \\*\\*
 Regardless of how the gold is split, the 2nd pirate will vote against the 1st pirate and take all the gold. \\*\\*

\textit{Scenario containing 3 pirates:} 

\begin{table}[ht]
\caption{3 Pirates}
\centering
\begin{tabular}{c c c}
\hline\hline
Pirate\#1 & Pirate\#2 & Pirate\#3 \\  
\hline
x & x & x \\
\hline
\end{tabular}
\end{table}

In this...

\end{document}

有人能告诉我为什么会发生这种情况吗?

答案1

如果你不想缩进任何内容,最好加载parskip。这会将段落缩进设置为零,并使用增加的垂直跳过标记段落,同时保持使用等的环境的正确格式\parindent\parskip

\documentclass{article}
\usepackage{parskip}% if you don't want paragraphs indented but would prefer to mark them by increased vertical spacing
\title{Assignment \#1}
\author{Giri}
\date{March 20, 2014}
\begin{document}
\maketitle
\section*{Question 1}
\textit{Scenario containing 2 pirates :} \\*\\*
 Regardless of how the gold is split, the 2nd pirate will vote against the 1st pirate and take all the gold. \\*\\*

\textit{Scenario containing 3 pirates:}

\begin{table}[ht]
\caption{3 Pirates}
\centering
\begin{tabular}{c c c}
\hline\hline
Pirate\#1 & Pirate\#2 & Pirate\#3 \\
\hline
x & x & x \\
\hline
\end{tabular}
\end{table}

In this...

\end{document}

未签约海盗

或者,您可能会发现使用列表环境更容易保持格式一致。例如:

\documentclass{article}
\usepackage{enumitem}
  \newlist{pirates}{description}{1}
  \setlist[pirates,1]{font=\normalfont\itshape,style=nextline,labelindent=0pt,leftmargin=0pt,itemsep=1.5em}
\title{Assignment \#1}
\author{Giri}
\date{March 20, 2014}
\begin{document}
\maketitle
\section*{Question 1}

\begin{pirates}
    \item[Scenario containing 2 pirates:] \mbox{}\\
      Regardless of how the gold is split, the 2nd pirate will vote against the 1st pirate and take all the gold.
    \item[Scenario containing 3 pirates:] \mbox{}\\
      \begin{table}[ht]
      \caption{3 Pirates}
      \centering
      \begin{tabular}{c c c}
      \hline\hline
      Pirate\#1 & Pirate\#2 & Pirate\#3 \\
      \hline
      x & x & x \\
      \hline
      \end{tabular}
      \end{table}
\end{pirates}
In this...

\end{document}

这基本上设置了一个pirates以特定方式格式化的新的专用列表。示例如下:

海盗名单

答案2

您需要\noindent在任何新段落前添加。默认情况下,第一段不缩进,所有后续段落都缩进。在后面,\section很明显这是新段落的开始。但为了区分后续段落,通常的方法是让它们缩进。

如果你有更长的文本,这一点会变得更加清晰:

在此处输入图片描述

笔记:

  • 表格后面的段落很好地说明了为什么后续段落要缩进。如果此段落没有缩进,读者将无法知道这是否是后续段落的开头。

  • 如果您根本不想缩进段落,可以使用:

    \usepackage[parfill]{parskip}
    

代码:

\documentclass{article}

\title{Assignment \#1}
\author{Giri}
\date{March 20, 2014}
\begin{document}
\maketitle     
\section*{Question 1}
\textit{Scenario containing 2 pirates :} \\*\\*
 Regardless of how the gold is split, the 2nd pirate will vote against the 1st pirate and take all the gold. \\*\\*

Here is some longer text to show that only the start of that paragraph is indented.
\textit{Scenario containing 3 pirates:} 

\begin{table}[ht]
\caption{3 Pirates}
\centering
\begin{tabular}{c c c}
\hline\hline
Pirate\#1 & Pirate\#2 & Pirate\#3 \\  
\hline
x & x & x \\
\hline
\end{tabular}
\end{table}

In this, and some more text here again to show that only the start of the paragraph is indented.

\end{document}

相关内容