2010-02-03 31 views
50

我使用LaTeX爲類編寫編程作業。我需要這樣做:Latex Multiple Linebreaks

my line of text blah blah blah 

new line of text with blank line between 

我知道我可以使用雙斜線打破行\\,但乳膠只會採取先換行符(抱怨更多),並開始一個新行,它會產生這樣的:

my line of text blah blah blah 
new line of text with blank line between 

如何在那裏獲得額外的換行符,以便我的文本行之間有空格?

+1

現在重複,重複qn也許有更強的答案:http://stackoverflow.com/questions/3159606/latex-have-new-line-between-paragraphs-no-indentation – 2010-07-04 20:20:39

+0

屬於[Tex](http ://tex.stackexchange.com/),但沒有辦法在那裏移動它。 – 2012-01-06 18:34:14

回答

33

段落之間想要更多空間嗎?然後您可以更改參數\parskip

例如,嘗試

\setlength{\parskip}{10pt plus 1pt minus 1pt} 

這意味着,段落之間的空間通常是10PT,但可能會增大或縮小通過高達1點。這意味着您可以讓LaTeX將其更改爲1pt,以實現更好的頁面佈局。您可以刪除正和負部分,使其始終保持您指定的長度。

如果您嘗試顯示源代碼,請嘗試使用listings程序包或使用verbatim。如果您嘗試排版僞代碼,請嘗試使用algorithm軟件包。

+0

成長還是縮小..? – 2010-02-03 22:35:45

+1

我用更好的解釋更新了它。 – tkerwin 2010-02-03 22:55:06

27

插入一些垂直空間

blah blah blah \\ 
\vspace{1cm} 

擴展到字體,使用ex(小寫的「x」的高度)爲單位,並有相關的行間距various predefined lengths用,則可能對baselineskip特別感興趣。

4

可以使用setspace包,讓你間距的環境,例如:

\documentclass{article} 
\usepackage{setspace} 
\begin{document} 
\doublespace 
my line of text blah blah blah 

new line of text with blank line between 
\end{document} 

或者使用verbatim環境精確地控制你的代碼的佈局。

+0

沒錯。如果這是編寫作業,即源代碼,然後使用逐字。 – 2010-02-03 22:52:04

94

換行符接受括號一個可選參數,垂直長度:

line 1 
\\[4in] 
line 2 

爲了使這種相對於字體大小更可擴展的,可以使用其他長度,如\\[3\baselineskip],或\\[3ex]

7

對於節目你真的富裕了verbatimalltt環境,但如果你想有一個空行LaTeX可以不捱罵,嘗試

my line of text blah blah blah\\ 
\mbox{ }\\ %% space followed by newline 
new line of text with blank line between 
4

雖然verbatim可能是最好的選擇,你可以也請嘗試命令\smallskip,\medskip或猜一下,\bigskip

從這個page引用:

這些命令只能 段落分隔符(其由 一個完全空白線或由 命令\帕製造)後使用。這些命令輸出 柔性或橡膠空間, 大約3點,6PT,和12磅分別高 ,但這些命令將 自動壓縮或擴大一個 位,這取決於 其餘的頁面

的需求
4

我發現,當我在\\後在源文件中包含一個空行時,我的輸出中也會出現空行。例如:

It's time to recognize the income tax as another horrible policy mistake like banning beer, and to return to the tax policies that were correct in the Constitution in the first place. Our future depends on it. 
\\ 

Wherefore the 16th Amendment must forthwith be repealed. 

然而,你是正確的,乳膠只允許你這樣做一次。對於允許您根據需要製作儘可能多的空行的更一般的解決方案,請使用\ null來創建空白段落。例如:

It's time to recognize the income tax as another horrible policy mistake like banning beer, and to return to the tax policies that were correct in the Constitution in the first place. Our future depends on it. 

\null 

\null 

\null 

Wherefore the 16th Amendment must forthwith be repealed. 
2

\\\\

這部作品pdfLatex。它會爲您創建2個新行。