LaTeX 段落和换行

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

LaTeX 段落和换行

目录

  • LaTeX 段落和换行
    • 第一个例子
    • 开始一个新段落
    • 段落对齐
      • flushleft and flushright environments
      • `\raggedright和\raggedleft`
    • 段落缩进
      • 缩进相关命令注意事项

本文介绍了基本的 LaTeX 段落格式,包括如何更改文本对齐方式。可以在文章文本对齐和段落格式中找到更多详细信息和更多示例。

第一个例子

center让我们从一个示例开始,该示例通过在环境中编写两个居中的段落来排版它们。请注意如何通过在它们之间插入一个空行来开始一个新段落——尽管这是一种常用的方法,但这并不是开始一个新段落的唯一方法。

\begin{center}
Example 1: The following paragraph (given in quotes) is an 
example of centred alignment using the center environment. ``La\TeX{} is a document preparation system and document markup 
language. \LaTeX{} uses the \TeX{} typesetting program for formatting 
its output, and is itself written in the \TeX{} macro language. 
\LaTeX{} is not the name of a particular (executable) typesetting program, but 
refers to the suite of commands (\TeX{} macros) which form the markup 
conventions used to typeset \LaTeX{} documents."
\end{center}

此示例产生以下输出:
在这里插入图片描述

开始一个新段落

如上所述,开始新段落的一种方法是插入一个空行,但以下代码片段显示了使用该\par命令的替代解决方案:

This is text contained in the first paragraph. 
This is text contained in the first paragraph. 
This is text contained in the first paragraph.\par
This is text contained in the second paragraph. 
This is text contained in the second paragraph.
This is text contained in the second paragraph.

在这里插入图片描述

段落对齐

默认情况下,LaTeX 中的段落是完全对齐的,即与左边距和右边距齐平。如果你想排版一个不合理的段落,你可以使用flushleft或者flushright环境。

flushleft and flushright environments

下一个示例演示了在flushleft和flushright环境中排版段落- 有关环境示例:

\section*{A paragraph typeset flush left}\begin{flushleft}
La\TeX{} is a document preparation system and document markup 
language. \LaTeX{} uses the \TeX{} typesetting program for formatting 
its output, and is itself written in the \TeX{} macro language. 
\LaTeX{} is not the name of a particular (executable) typesetting program, but 
refers to the suite of commands (\TeX{} macros) which form the markup 
conventions used to typeset \LaTeX{} documents.
\end{flushleft}\section*{A paragraph typeset flush right}\begin{flushright}
La\TeX{} is a document preparation system and document markup 
language. \LaTeX{} uses the \TeX{} typesetting program for formatting 
its output, and is itself written in the \TeX{} macro language. 
\LaTeX{} is not the name of a particular (executable) typesetting program, but 
refers to the suite of commands (\TeX{} macros) which form the markup 
conventions used to typeset \LaTeX{} documents.
\end{flushright}

此示例产生以下输出:
在这里插入图片描述

\raggedright和\raggedleft

使用环境的替代方法,例如flushleft,flushright或center是所谓的“切换”命令:

\raggedright, 替代使用flushleft环境
\raggedleft, 替代使用flushright环境
\centering, 替代使用center环境
这些切换命令会更改从插入点到文档末尾的文本对齐方式——除非它们的效果被限制在一个组中或被另一个切换命令更改。

在以下示例中\raggedright,\raggedleft和的效果\centering已本地化,因为它们在由创建的组\begingroup ... \endgroup中使用。此外,请注意,在每种情况下,段落文本后面都有一个空行,在\endgroup命令之前,这会触发 LaTeX 排版段落,同时\raggedright,\raggedleft和应用的设置\centering仍然有效。
在这里插入图片描述

段落缩进

默认情况下,新段落的缩进量通常由一个参数控制,该参数\parindent的值可以使用命令设置\setlength;例如:

\setlength { \parindent }{ 20pt }

设置\parindent为 20pt。\parindent您可以通过设置为 0pt(或 0mm、0cm 等)或\noindent在段落开头使用命令来避免缩进。默认情况下,LaTeX 不会缩进文档部分中包含的第一段,如下例所示:

\setlength{\parindent}{20pt}\section*{This is a section}
\textbf{First paragraph} of a section which, as you can see, is not indented. This is more text in the paragraph. This is more text in the paragraph.\textbf{Second paragraph}. As you can see it is indented. This is more text in the paragraph. This is more text in the paragraph. \noindent\textbf{Third paragraph}. This too is not indented due to use of \texttt{\string\noindent}. This is more text in the paragraph. This is more text in the paragraph.  The current value of \verb|\parindent| is \the\parindent. This is more text in the paragraph.

在这里插入图片描述

缩进相关命令注意事项

段落缩进受三个命令控制或影响:

  • \parindent: 存储段落缩进当前大小的参数
  • \indent:此命令的效果取决于它的使用位置:
      • 在水平模式(在一个段落或一个\hbox)或数学模式下,它插入一个宽度的空格(一个空框)\parindent
      • 在垂直模式下(在段落之间或在 a 中\vbox)它触发开始一个新的缩进段落
  • \noindent:此命令的效果还取决于它的使用位置:
      • 在垂直模式下(段落之间或 a 中\vbox)它还会触发一个新的非缩进段落
      • 在水平模式(在一个段落或一个\hbox)或数学模式下它没有效果:它被忽略

以下示例演示\indent:

\noindent A new paragraph with some text, then an \verb|\indent|\indent command. Next, some inline math which also has an indent $y\indent x$. \verb|\indent| also works when used in an \verb|\hbox| such as \verb|\hbox{A\indent B}| which produces \hbox{A\indent B}.

在这里插入图片描述
PS:该文是从overleaf帮助文档翻译,链接:Paragraphs_and_new_lines


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

相关文章

latex 公式如何换行

参考latex 公式如何换行 - 云社区 - 腾讯云 1、如图所示,我们先写个长公式。 2、可以看到,公式没有自动换行,而是跨过了一栏。 3、如图所示,在公式上下两端加上split。同时使用\\指明换行的位置。 4、如图所示,公式实…

Latex 如何换行,分段,换页

Latex 如何换行,分段,换页 1.换行(三个方法) \newline 另起一段是空一行 \ 2.分段 \par 3.换页 \newpage 新的改变 我们对Markdown编辑器进行了一些功能拓展与语法支持,除了标准的Markdown编辑器功能,…

LaTeX 换行、换页、空白空间

原  文:Line breaks and blank spaces 译  者:Xovee 翻译时间:2021年8月19日 换行、换页、空白空间 一般来说,我们不推荐你改变默认的 LaTeX 文档结构。当然,我们有时候也有这个需求。所以,在本文中&…

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;可以是数组、对象、字符…