700字范文,内容丰富有趣,生活中的好帮手!
700字范文 > LaTeX 段落:段落缩进 段落间距 行距

LaTeX 段落:段落缩进 段落间距 行距

时间:2021-02-24 09:50:25

相关推荐

LaTeX 段落:段落缩进 段落间距 行距

原文:Paragraph formatting

译者:Xovee

翻译时间:8月12日

LaTeX 段落

LaTeX 默认的段落是比较容易阅读的。当然,有时候你也需要一种不同的段落样式。本文介绍如何更改默认的段落样式,例如行距等。

文章目录

LaTeX 段落介绍开始一个新的段落段落缩进段落间距行距参考指南

介绍

改变某些特定元素的长度也许会改变整个文档的结构。

\documentclass{article}\usepackage[utf8]{inputenc}\usepackage[english]{babel}\setlength{\parindent}{4em}\setlength{\parskip}{1em}\renewcommand{\baselinestretch}{2.0}\begin{document}This is the first paragraph, contains some text to test the paragraphinterlining, paragraph indentation and some other features. Also, is easy to see how new paragraphs are defined by simply entering a double blank space.Hello, here is some text without a meaning. This text shouldshow what a printed text will look like at this... \end{document}

在上面的例子中,我们使用一个空行来分割不同的段落,每个段落的第一行会有缩进,我们还设置了行距和段落之间的间距。

开始一个新的段落

在 LaTeX 文档中开始一个新的段落的方式非常简单:插入一个空行。

你也可以使用另外一种方法:

This is the text in first paragraph. This is the text in first paragraph. This is the text in first paragraph. \parThis is the text in second paragraph. This is the text in second paragraph. This is the text in second paragraph.

使用\par命令即可开始一个新的段落而无需一个空白行。

段落缩进

默认情况下,LaTeX 不对章或者节内的第一个段落进行缩进。之后的段落的缩进大小取决于\parindent

\setlength{\parindent}{4em}\begin{document}This is the text in first paragraph. This is the text in first paragraph. This is the text in first paragraph. \parThis is the text in second paragraph. This is the text in second paragraph. This is the text in second paragraph.This is another paragraph, contains some text to test the paragraphinterlining, paragraph indentation and some other features. Also, is easy to see how new paragraphs are defined by simply entering a double blank space....\end{document}

\parindent的默认大小取决于文档的类型。你也可以手动设置它。在上面的例子中,每个段落的首行都缩进了4em(一个em的宽度等于字母m的宽度):\setlength{\parindent}{4em}。一般来说,我们推荐在文档的 preamble 中使用这个命令,当然,它也可以放在其他任何地方。

如果你想创建一个没有缩进的段落,在段落的开头使用\noindent命令。如果你希望文档的所有段落都没有缩进,那么将缩进的大小设置为零:\setlength{\parindent}{0pt}

另一方面,如果你想要对一个段落进行缩进,在段落之前使用\indent命令。这个命令只有在\parindent不等于零的时候才有效。

段落间距

决定段落间距的参数为\parskip,它是一个段落和之前的文字的间距大小。

\documentclass{article}\usepackage[utf8]{inputenc}\usepackage[english]{babel}\setlength{\parindent}{4em}\setlength{\parskip}{1em}\begin{document}This is the text in first paragraph. This is the text in first paragraph. This is the text in first paragraph. \parThis is the text in second paragraph...\end{document}

在这个例子中,命令\setlength{\parskip}{1em}将段落之间的间距设置为1em

行距

LaTeX 有三个命令来控制行距,下面这个例子重定义了\baselinestretch的长度:

\documentclass{article}\usepackage[utf8]{inputenc}\usepackage[english]{babel}\setlength{\parindent}{4em}\setlength{\parskip}{1em}\renewcommand{\baselinestretch}{1.5}\begin{document}This is the text in first paragraph. This is the text in first paragraph. This is the text in first paragraph. \parThis is the text in second paragraph...\end{document}

上面的例子使用命令\renewcommand{\baselinestretch}{1.5}来将行距设置为默认的 1.5 倍。当然,你可以使用任何其他数字。

此外,还要两个参数可以影响行距:

\baselineskip

控制一个段落中最后两行的最小距离。你可以在 preamble 中改变它的值:\setlength{\baselineskip}{value}

\linespread{value}

设置行距的大小。在这里,value的大小是很有点迷惑的:

参考指南

段落中长度的原理图:

\parindent:段落缩进\parskip:段落间距

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。