![不需要的縮排](https://rvso.com/image/286349/%E4%B8%8D%E9%9C%80%E8%A6%81%E7%9A%84%E7%B8%AE%E6%8E%92.png)
使用以下程式碼,「包含 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
在任何新段落之前添加。預設情況下,第一段不縮排,所有後續段落均縮排。 a 後面\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}