LaTeX 换行、换页、空白空间

article/2025/11/9 2:36:14

原  文:Line breaks and blank spaces
译  者:Xovee
翻译时间:2021年8月19日

换行、换页、空白空间

一般来说,我们不推荐你改变默认的 LaTeX 文档结构。当然,我们有时候也有这个需求。所以,在本文中,我们将解释如何在文档中插入空行,以及插入任意的空白。

文章目录

  • 换行、换页、空白空间
  • 介绍
  • 换行
  • 换页
  • 水平空白空间
  • 垂直空白空间
  • 参考指南

介绍

分割文字的最佳方法是创建一个新的段落。你只需要在代码中添加一个空白行就可以了:

\documentclass{article}
\begin{document}
This paragraph contains no information
and its purpose is to provide an example on how to start a new paragraph.
As you can see,
single line
break in the code
acts as a space in text.However, leaving an empty line starts a new paragraph.
\end{document}

在这里插入图片描述

这并不是唯一的添加换行的办法,我们接下来介绍另外两种方法。

换行

\documentclass{article}
\usepackage[utf8]{inputenc}\begin{document}
Something in this document. This paragraph contains no information 
and its purposes is to provide an example on how to insert white 
spaces and lines breaks.\\
When a line break is inserted, the text is not indented, there 
are a couple of extra commands do line breaks. \newline
This paragraph provides no information whatsoever. We are exploring 
line breaks. \hfill \break
And combining two commands
\end{document}

在这里插入图片描述
上面的文档中出现的三个命令都有着相同的功能:
-\\(两个反斜杠)

  • \newline
  • \hfill \break

换页

你可以使用这两个命令来插入换行符:

  • clearpage
  • newpage
\documentclass{article}
\usepackage[utf8]{inputenc}\begin{document}
Something in this document. This paragraph contains no information and 
its purposes is to provide an example on how to insert white spaces 
and lines breaks.\\
When a line break is inserted, the text is not indented, there are a 
couple of extra commands do line breaks. \newline
This paragraph provides no information whatsoever. We are exploring 
line breaks. \hfill \break
And combining two commands
...
...\begin{figure}
\centering
\includegraphics[width=3cm]{overleaf-logo}
\caption{Overleaf logo}
\end{figure}Hello,  here  is  some  text  without  a  meaning...
\clearpage

在这里插入图片描述
如果你使用了\clearpage命令,并且页面上有着多个浮动元素(例如表格和图片等),它们将会挤压到下一页。例如,在上面的例子中,我们插入了三张同样的图片。因为换页符插入的位置处于三张图片均展示之前,剩余的图片将会在一个空白页展示,即在换行符之后的文本之后。

如果你不想这样,那么你可以使用\newpage命令。

\documentclass{article}
\usepackage[utf8]{inputenc}\begin{document}
\documentclass{article}
\usepackage[utf8]{inputenc}\begin{document}
Something in this document. This paragraph contains no information and 
its purposes is to provide an example on how to insert white spaces 
and lines breaks.\\
When a line break is inserted, the text is not indented, there are a 
couple of extra commands do line breaks. \newline
This paragraph provides no information whatsoever. We are exploring 
line breaks. \hfill \break
And combining two commands
...
...\begin{figure}
\centering
\includegraphics[width=3cm]{overleaf-logo}
\caption{Overleaf logo}
\end{figure}Hello,  here  is  some  text  without  a  meaning...
\newpage

在这里插入图片描述
在这个例子中,图像的位置将会配合文字的排版。

水平空白空间

插入水平空白空间的命令是\hspace

Horizontal \hspace{1cm} spaces can be inserted manually. Useful 
to control the fine-tuning in the layout of pictures.Left Side \hfill Right Side

\hspace{1cm}
插入长度为一厘米的水平空白空间。你也可以使用其他类型的 LaTeX 单位。

\hfill
填满剩余的水平空间。

命令\hrulefill\dotfill的行为和\hfill类似,不过它们插入的不是空白,而是线条和点。

垂直空白空间

类似于水平空白空间:

Text at the top of the page. Text at the top of the page. 
Text at the top of the page. Text at the top of the page. 
Text at the top of the page. Text at the top of the page. 
Text at the top of the page.\vspace{5mm} %5mm vertical spaceThis text still at the top, 5mm below the first paragraph.\vfillText at the bottom of the page.

在这里插入图片描述
\vspace{5mm}
插入长度为五毫米的垂直空间。你也可以使用其他 LaTeX 长度单位。

\vfill
填满剩余的垂直空间。

\smallskip
插入一个长度为 3pt 加减 1 的垂直空间(具体取决于文档类型、剩余的可用空间等)

\medskip
插入一个长度为 6pt 加减 2 的垂直空间(具体取决于文档类型、剩余的可用空间等)

\bigskip
插入一个长度为 12pt 加减 4 的垂直空间(具体取决于文档类型、剩余的可用空间等)

参考指南

其他换行命令

  • \\*
    (两个反斜杠和一个星号)换行,但不允许换页
  • \break
    换行,但不填满当前行。这样做会使得排版很难看。为了填满当前行,你可以这样做:\hfill\break。这样做的效果与\newline\\相同。
  • \linebreak[number]
    这个命令的效果是换行。命令的参数是零到四,零的意思是这个命令很容易被忽略,四的意思是它无论如何都要换行。如果你使用了这个命令,LaTeX 会尝试找到最佳的换行方式。

http://chatgpt.dhexx.cn/article/XT3xd8nb.shtml

相关文章

LaTeX 换行

LaTeX换行的几种方法 方法一:输入 \\ 结果即只进行单纯换行,并无缩进 方法二:输入 \par 显示结果为自动换行加缩进 公式换行等号对齐 用\\ 进行换行,然后用& 可以对齐每行。 代码示例 \begin{equation*} %加*表示不对…

React 学习之父子组件传值

父组件可以通过props、原型方法向子组件通信,子组件可以通过回调函数、事件冒泡向父组件通信。 1. 父组件向子组件通信 父组件向子组件传值之props方法: 父组件 import React from react import Child from "../Child";function CounterHo…

Vue非父子组件传值

提示:文章写完后,目录可以自动生成,如何生成可参考右边的帮助文档 文章目录 前言一、非父子组件传值二、事件总线2.$attrs / listenersVueX是笔者认为最稳定的非父子传值的方法,笔者也会单独写出文章详解 总结 前言 本节紧接这上…

vue2父子组件传值

1.父传子 父传子&#xff1a;主要是在父组件引入子组件&#xff0c;将要传值的值绑定指定的属性上如 然后在子组件用props接收即可在页面展示 1.父组件 <template><div class"home"><HelloWorld :msg title></HelloWorld></div> &l…

VUE父子组件传值(含实例)

vue父子组件通信 这里的movies数组和message字符串&#xff0c;相当于是在父组件中对要传给子组件的数据做赋值或者计算等操作。 1.父传给子&#xff08;在子组件中改数据&#xff09; 父组件&#xff1a; 1.在子组件上绑定数据arrData 2.在data()中给出定义&#xff08;注意…

vue3.0 父子组件传值问题

使用vue3.0时遇到父子传值的问题&#xff0c;顺便记录一下 问题背景&#xff1a; 如图所示&#xff0c;编辑按钮是父组件的部分&#xff0c;下面的表单是子组件 需要&#xff1a;按下父组件中的编辑按钮时&#xff0c;子组件的表单需要变成可编辑状态&#xff0c;在可编辑状…

微信小程序:父子组件传值

在微信小程序里&#xff0c;父组件可以向子组件传值&#xff0c;子组件也可以向父组件传值&#xff0c;不过这两种传值方式不大相同&#xff0c;下面先简单介绍这两种传值的区别。 两者的区别 父组件向子组件传值&#xff0c;使用的是 属性绑定 的方法&#xff0c;并且只能传…

vue 实现父子组件传值和子父组件传值

先上一张图&#xff0c;vue 父子组件传值都用的图片。从张图入手了解如何传参。 一、父组件 1.引入子组件 import random from "./child-random-paper"; 2.注册子组件 components: {random,}, 3. 静态组件&#xff0c;循环体 <liv-for"(item, index) i…

Vue.js父子组件如何传值 通俗易懂

父子组件传值原理图 一般页面的视图App.vue应为这样 一.父组件向子组件传值 1.创建子组件&#xff0c;在src/components/文件夹下新建一个Child.vue 2.Child.vue的中创建props&#xff0c;然后创建一个名为message的属性 3.在App.vue中注册Child组件&#xff0c;并在template中…

Vue3 父子组件传值 ts

父子组件传值 父子组件传值&#xff0c;父组件通过子组件的v-bind定义一个属性将父子的数据传递给子组件&#xff0c;子组件通过defineProps传递纯类型参数的方式来声明,接收父组件传过来的数据。子组件通defineEmits派发一个事件来传递给父组件 父组件 <template> <d…

vue父子组件传值的方法总结

一&#xff0c;父向子传值 1.通过props 使用技巧&#xff1a; 子组件内, props定义变量, 在子组件使用变量 父组件内, 使用子组件, 属性方式给props变量传值 注意事项&#xff1a; 父组件的数据发生了改变&#xff0c;子组件会自动跟着变 子组件不能直接修改父组件传递过来…

Vue2-父子组件传值

在日常开发中&#xff0c;我们经常会在一个组件中嵌套另外一个组件&#xff0c;那么如果我们父组件要向子组件传值该怎么办&#xff1f;子组件向父组件通信又该怎么办&#xff1f;本文将详细举例说明这些问题。 父向子通信 问题描述 现在我们有个需求&#xff0c;我们要分别…

Vue父子组件传值的方法

1.父向子传值props 父组件&#xff1a;<child :inputName"name"> 子组件&#xff1a; &#xff08;1&#xff09;props: { inputName: String, required: true } &#xff08;2&#xff09;props: ["inputName"] 2.子组件向父组件传值$emit 子组…

Vue中父子组件传值的多种方式

vue中父子组件传值 vue中的父子组件传值&#xff0c;值得注意的是要遵守单向数据流原则。所谓单向数据流原则&#xff0c;简单的说就是父组件的数据可以传递给子组件&#xff0c;子组件也可以正常获取并使用由父组件传过来的数据&#xff1b;但是&#xff0c;子组件中不能直接修…

vue父子组件传值

记录一下项目中遇到的问题。 因为一个流程对应一种单据&#xff0c;所以每次点击单据详情&#xff0c;应该出现相应的单据内容。在另一个页面&#xff0c;也需要调用这个单据内容。 因为vue不能直接调用弹出框&#xff0c;所以老师把单据内容写成了组件&#xff0c;在另一个页…

Vue中父子组件如何传值

关键词&#xff1a;props、$emit()、绑定的数据和事件 文章目录 前言一、将子组件引入父组件二、父组件如何传值给子组件三、子组件如何接收父组件传过来的值并使用(props)四、子组件如何传值给父组件($emit)五、父组件使用子组件传过来的值总结 前言 提示&#xff1a;这里可以…

父子组件之间的传值

&#xff08;1&#xff09;子组件给父组件传值 子组件 &#xff08;1.1&#xff09;子组件Child.vue&#xff0c;在button按钮上通过点击passToparent事件&#xff0c;在子传父的this.$emit方法上自定义事件名&#xff0c;以及需要传递的值&#xff08;可以是数组、对象、字符…

父子组件传值

1.父组件——子组件 想象一下&#xff0c;父子组件传值&#xff0c;就类似于父亲给儿子东西&#xff0c;父亲给儿子的东西要有名字吧&#xff0c;名字就是属性&#xff0c;父亲给儿子东西&#xff0c;儿子要用手接过来&#xff0c;那手就相当于子组件里的props。 用个例子来更…

组件之间父子组件传值

组件之间父子组件传值 在components新建父组件和子组件 在父组件里引入子组件 子组件接收父组件中的数据,用props 在子类props里定义接收的参数 在子组件标签上引用 然后在父组件写上准备传递的参数 子组件拿到父组件的背景颜色,就会去覆盖默认的背景颜色

Stanford UFLDL教程 独立成分分析

独立成分分析 Contents [hide] 1概述2标准正交ICA3拓扑ICA4中英文对照5中文译者 概述 试着回想一下&#xff0c;在介绍 稀疏编码算法中我们想为样本数据学习得到一个超完备基&#xff08;over-complete basis&#xff09;。具体来说&#xff0c;这意味着用稀疏编码学习得到…