个性化阅读
专注于IT技术分析

Latex格式

点击下载

本文概述

格式化参数

格式参数用于为文件或文档提供独特的外观。有多种格式化文档的方法, 如下所列:

1.可选参数

流行的可选参数是:

  • twocolumn-它是2列页面
  • titlepage- \ maketitle生成一个标题页
  • openright-如果使用两侧, 则本章从右侧页面开始
  • 景观-用于在景观中展示
  • legno-将方程式编号放在左侧
  • flegn-左对齐方程与中心
  • 双面-双面打印。

一类

此处使用的文档类型是演示文稿和科学期刊中的文章, 报告, 书籍, 幻灯片, poster proc(基于文章类别的类), 信件, beamer(用于编写演示文稿)等。

该类在程序开始时使用, {article}是常用的类。

文档类定义了文档的总体布局。

其他类也包含在大括号中, 如下所示:

  • 报告-用于包含较长文档的章节。
  • 论文-用Latex准备论文。
  • 字母-用于字母写作
  • 书籍-用于书籍
  • 幻灯片-透明胶片。

b)组

为了限制范围并将状态限制为局部, 可以将特定部分局部括在花括号中。但是在某些情况下, 如果无法使用大括号, 则可以分别使用\ bgroup和\ egroup来开始和结束组。

例如, 普通文本{xyz}更普通的文本

这可以写成普通文本\ bgroup xyz \ egroup {}更普通的文本。

c)包装

它是一种向文档提供或添加额外格式设置功能的方法, 例如图片, 书目和链接。它还为Latex添加了新功能。所有软件包必须仅包含在序言中。要加载软件包, 使用的命令是:

\usepackage{packagename}

也可以用作\ usepackage [options] {package}

一些常用的软件包是:

  • 颜色:提供一种使用颜色的方法。
  • 旋转:用于旋转, 尤其是图形和表格。
  • fancyhdr:它自定义页眉和页脚。
  • graphicx:这是用于包含图形的命令。
  • setspace:这是更改行距的一种简便方法。

2.结构格式

  • 标题

标题用于信件, 文章, 报告, 书类等大多数纸张格式。要创建标题, 你需要指定作者, 标题和日期的文本, 然后使用\ maketitle命令, 标题页由Latex生成。必须在开始时使用\ begin {document}。用于制作标题的命令是\ maketitle。创建标题的代码如下:

\documentclass{article}
\begin{document}
\title{This is my title} % defines the title info
\author{ The author name}  % you can specify any name
\date{ The date} % used to display the date
\maketitle
\end{document}

输出如下图所示:

Latex格式

如果根本不需要日期, 可以使用\ date {}命令。

要显示当前日期, 可以使用\ date {\ today}命令。

  • 栏目

你可以将文档分为几个小节。用于创建这些部分的命令是:

  • \部分{..}
  • \ subsection {..}
  • \ subsubsection {..}
  • \段{..}
  • \ subsection {..}

这些是articles类的常用命令。你还可以对书籍和报告类使用\ chapter {..}命令。

以下部分的代码如下:

\documentclass{article}
\begin{document}
\title{This is my title} 
\author{ The author name} 
\date{ The date}
\maketitle
\section{Introduction}
This the section for the Introduction.
\section{Methods}
You can use this section for the methods.
\subsection{}
The first part of the method.
\subsection{}
The second part of the method.
\section{Results}
This is the section for the results
\end{document}

输出如下图所示:

Latex格式
  • 标记要引用文档的其他部分, 可以标记任何section命令。你可以使用\ label {labelname}标记该部分。如果要参考标签的部分或页码;你可以使用\ ref {labelname}和\ pageref {labelname}。代码如下所示:
\documentclass{article}
\begin{document}
\title{This is my title} 
\author{ The author name} 
\date{ The date}
\maketitle
\section{Introduction}
This the section for the Introduction.
\section{Methods}
You can use this section for the methods.
\subsection{}
\label{sec1}
The first part of the method.
\subsection{}
The second part of the method.
\section{Results}
This is the section for the results. You can refer to the section \ref{sec1} on page \pageref{sec1}.
\end{document}

输出量

Latex格式

对于多页或文件, 你可以根据需要轻松参考页码和部分。

  • 目录

如果要在文档中创建目录, 可以键入命令\ tableofcontents。

  • 页码

此格式用于在编写文档之前对页面进行编号。它还可以确保主文档从第1页开始。可以在罗马和阿拉伯语之间切换页码。用于对页进行编号的命令是\ pagenumbering {..}, 在\ maketitle命令之后声明。

上面方法的代码如下:

\documentclass{article}
\begin{document}
\title{This is my title} 
\author{ The author name} 
\date{ The date}
\maketitle
\pagenumbering{roman} % you can use \pagenumbering{arabic} if you want in Arabic format     \tableofcontents
\newpage
\end{document}

输出如下图所示:

Latex格式

F。页眉和页脚

出现在头部或脚部。输出屏幕包括头部, 身体和脚。默认情况下, 除字母外的所有类别均打印页码。

要修改默认操作, 可以使用\ pagestyle命令, 该命令恰好位于\ chapter或与此类似的命令之后。

标准页面样式的类型如下:

  • \ pagestyle {plain}这是报表类和文章的默认样式。当头为空时, 页码在脚上列出。
  • \ pagestyle {headings}这种样式的脚是空的。标题和页码放在标题中。
  • \ pagestyle {myheadings}指定标题中使用的信息;使用以下命令。
\markboth{leftheader}{rightheader}
\markright{rightheader}

\ markboth用于双面文件或文档, 而\ markright用于双面文档。

  • \ pagestyle {empty}在此样式中, 页眉和页脚均为空。
  • \ thispagestyle {style}仅用于更改当前页面的样式。例如, \ thispagestyle {empty}用于手脚没有任何东西。仅对当前页面执行此命令, 而不会影响其他页面。

如果要以其他方式格式化或自定义页眉和页脚。你可以使用fancyhdr命令。 Latex中的此命令用作\ usepackage {fancyhdr}。此处使用的包可以使页眉和页脚在左侧, 右侧和中心对齐。你还可以定义多行标题和过滤器, 用于偶数和奇数页的单独标题等。

\ pagestyle {fancy}也在这里使用。

{}(大括号)中可以包含以下命令:\ lhead {}, \ chead {}, \ rhead {}, \ lfoot {}, \ cfoot {}, \ rfoot {}。

如果要隐藏默认情况下绘制的标题下的水平线, 可以使用\ renewcommand {\ headrulewidth} {0pt}命令。

G。保证金

这些命令用于手动设置边距。内部页边距默认为1英寸。因此, 如果要将边距设置为0.5英寸, 则必须提及该边距-0.5英寸。你还可以使用textheight和textwidth命令设置文本区域的高度和宽度。

下表列出了可用的设置边距的命令:

保证金 命令
左页边距(如果使用单面, 则为奇数页) \oddsidemargin
左页边距(如果使用双面, 则为偶数页) \evensidemargin
right margin \textwidth
上边距 \topmargin
bottom margin \textheight

用于设置页边距英寸的命令为:

  • 要将上边距设置为0.7英寸, \ setlength {\ topmargin} {-0.7in}
  • 要在右侧页面上将页边距设置为1英寸, 请设置\ setlength {\ oddsidemargin} {0in}
  • 要在双面文档的左侧页面上将页边距设置为1英寸, 请设置\ setlength {\ evensidemargin} {0in}
  • 为了留出足够的空白, \ setlength {\ textwidth} {0in}
  • 要为文本保留9英寸, \ setlength {\ textheight} {9in}

H。段

要开始一个段落, 可以使用控制顺序\ par, 也可以留一个空格。段落的缩进默认为1.5em(是当前字体的磅值的1.5倍)。段落之间没有插入多余的空间。为了控制段落的分隔和缩进, 使用命令\ parindent和\ parskip。让我们考虑以下示例:

本示例包含一个简单的段落。代码如下:

\documentclass{article}
\begin{document}
\title{This is my title} 
\author{ The author name} 
\date{ The date}
\maketitle
The purpose of this topic is to explain the formats of Latex in detail. It will include all the commands and different styles as well for the procedure. You can go to a particular section and study the topic of your choice. The output is displayed on the screen with no possible errors.
This is the topic of your choice.

\end{document}

下图给出了输出:

Latex格式

本示例包含一个带有段落分隔和缩进命令的段落。代码如下:

本示例包含一个简单的段落。代码如下:

\documentclass{article}
\begin{document}
\title{This is my title} 
\author{ The author name} 
\date{ The date}
\maketitle
\parindent=3in
\parskip=15pt % for both the commands you can change the number according to the requirements

 The purpose of this topic is to explain the formats of Latex in detail. It will include all the commands and different styles as well for the procedure. You can go to a particular section and study the topic of your choice. The output is displayed on the screen with no possible errors.
 
 \parindent=0in
 \parskip=30pt
This is the topic of your choice.
\end{document}

下图给出了输出:

Latex格式

你会注意到上面两个示例之间的区别。

一世。参考文献

也称为交叉引用, 用于截面, 图形, 方程式或表格。使用的命令如下:

  • \ pageref {marker}, 它包含与\ label命令相关的页码。
  • \ label {marker}用于设置标记以供将来参考。
  • \ ref {marker}由与\ label命令相关的部分, 图形等组成。

3.绘图规则

Latex格式

如果要在文档页面上绘制水平或垂直线, 可以使用\ rule命令。在Latex中, 它将写为:

\rule[lift]{width}{height}

提升是可选参数, 它是提高到基线以上的量。宽度是水平尺寸, 而高度是垂直尺寸。例如, 如果要绘制下面给出的线:


你可以使用\ rule {\ textwidth} {2pt}命令。

上面示例的代码或程序如下:

\documentclass{article}
\begin{document}
\title{This is my title} 
\author{ The author name} 
\date{ The date}
\maketitle
\rule{\textwidth}{1pt}
\section{Introduction}
This the section for the Introduction.
\section{Methods}
You can use this section for the methods.
\subsection{}
\label{sec1}
The first part of the method.
\subsection{}
The second part of the method.
\end{document}

输出如下图所示:

Latex格式

你可以根据要求绘制多条线。

例如, 要绘制两条线, 代码如下:

\documentclass{article}
\begin{document}
\title{This is my title} 
\author{ The author name} 
\date{ The date}
\maketitle
\rule{\textwidth}{1pt} % you can also set the points accordingly
\section{Introduction}
This the section for the Introduction.

\section{Methods}
You can use this section for the methods.
\subsection{}
\label{sec1}
The first part of the method.
\subsection{}
The second part of the method.

\rule{\textwidth}{1pt}
\end{document}

下图显示了以上示例的输出:

Latex格式
  • 脚注Latex自动为脚注编号。命令\ footnote恰好放置在你希望脚注出现的位置。 \ footnote命令与其之前的文本之间不应有多余的空间。该命令写为\ footnote {注释文本写在这里}。大括号内的文本显示在底部。例如, 考虑以下代码:
\documentclass{article}
\begin{document}
\title{Footnotes} 
\author{ The author name} 
\date{ The date}
\maketitle
Here is the text displayed with the note.\footnote{ the note text is at the bottom of the page}\\
You can also display the other text.\footnote{the second note text}\\
The footnote is numbered automatically by the Latex.\footnote{Latex note text}
\end{document}

输出如下图所示:

Latex格式

脚注将出现在底部。对于上面的示例, 脚注如下图所示:

Latex格式
  • 居中如果你只在中心放置一条线, 请选择“居中”。那么你可以使用\ centerline命令。例如, \ centerline {这里提到的行将显示在中心}。让我们考虑以下示例:
\documentclass{article}
\begin{document}
\title{This is my title} 
\author{ The author name} 
\date{ The date}
\maketitle
The purpose of this topic is to explain the formats of Latex in detail. It will include all the commands and different styles as well for the procedure.\\\\ % two-time \\ is used to maintain the space.
\centerline{It will make the document attractive.}
\end{document}

输出如下图所示:

Latex格式

如果要显示多行, 则可以按以下方式编写。

\begin{center}
.........
\end{center}
  • 报价报价可以在以下环境中使用:
\begin{quote}
..........
\end{quote}

在各段中, 各节中的引号之间没有空白行分隔和意图。


赞(0)
未经允许不得转载:srcmini » Latex格式

相关推荐

评论 抢沙发

评论前必须登录!