乳胶多重生产线

时间:2010-02-03 22:21:23

标签: latex line-breaks

我使用LaTeX为类输入编程作业。我需要这样做:

my line of text blah blah blah

new line of text with blank line between 

我知道我可以使用双斜线来打破线条\\,但是LaTeX只会占用第一个换行符(抱怨更多)并开始换行,它产生了这个:

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

如何在那里获得额外的换行符,以便在文本行之间留出空格?

10 个答案:

答案 0 :(得分:100)

换行符接受括号中的可选参数,垂直长度:

line 1
\\[4in]
line 2

为了使字体大小更具可伸缩性,您可以使用其他长度,例如\\[3\baselineskip]\\[3ex]

答案 1 :(得分:33)

你想在段落之间留出更多空间吗?然后,您可以更改参数\parskip

例如,尝试

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

这意味着段落之间的空间通常为10pt,但最多可增长或缩小1pt。这意味着您可以让LaTeX将其更改为1pt,以实现更好的页面布局。您可以删除正负部分,使其始终为您指定的长度。

如果您要显示源代码,请尝试listings包或使用verbatim。如果您尝试排版伪代码,请尝试algorithm包。

答案 2 :(得分:29)

插入一些垂直空间

blah blah blah \\
\vspace{1cm}

缩放到字体,使用ex(小写“x”的高度)作为单位,并且various predefined lengths与可用的行间距相关,您可能对此特别感兴趣baselineskip

答案 3 :(得分:7)

对于程序,您最好使用verbatimalltt环境,但如果您想要一个LaTeX不会讨厌的空行,请尝试

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

答案 4 :(得分:5)

虽然verbatim可能是最佳选择,但您也可以尝试\smallskip\medskip或猜测\bigskip

引用此page

  

这些命令只能在以后使用   一个段落(由...制作)   一个完全空行或由   命令\ par)。这些命令输出   柔性或橡胶空间,   大约3pt,6pt和12pt高   分别,但这些命令会   自动压缩或扩展a   位,取决于的要求   页面的其余部分

答案 5 :(得分: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环境精确控制代码的布局。

答案 6 :(得分: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.

但是你说LaTeX只允许你这样做一次是正确的。对于允许您根据需要创建尽可能多的空行的更通用的解决方案,请使用\ 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.

答案 7 :(得分:2)

  

\\\\

这适用于pdfLatex。它为您创建了2条新线。

答案 8 :(得分:0)

也许尝试只插入一个空格的行?

\ \\
\ \\

答案 9 :(得分:-2)

这对我有用:

我试图在 Apple Pages 新的 LaTeX 输入区域中留出一个空间。我输入了以下内容,它留下了一条干净的线。

\mbox{\phantom{0}}\\

相关问题