LaTeX documents organizational structure

Verbatim https://www.dazhuanlan.com/2019/08/26/5d62feafd7a14/


The main contents of this paper are:

  • The basic structure of the article LaTeX
  • Method of generating directory
  • Cross-reference method
  • Insert lists, tables, images method

LaTeX provides many articles to make more orderly way, such as support for chapter markers articles automatically generated catalog. Next each of these methods.

Chapters, sections and paragraphs

In our commonly used articleclass, LaTeX support article marked by the following command organizational structure: section{·}, subsection{·}, subsubsection{·}, paragraph{·}, subparagraph{·}. Their relative size decreases from left to right.

In the not too much use book, there chapter{·}and part{·}.

Below is an example.

1
2
3
4
5
a header section {} 
subsection {} subheadings
subsubsection {} three title
paragraph of section headings} {paragraphs of
subparagraph {sub} sub-paragraphs of section headings

table of Contents

Zhang introduced in the text, marking the festival, we can use in the text area tableofcontentsto let LaTeX automatically generates lists of articles.

Below is an example.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
ctexart} {DocumentClass 
title {LaTeX tutorial zero (IV): Structure}
author {Qian cyan}
DATE} {Today
the begin {} Document
maketitle
TableOfContents

section {} reason chemistry major
chemical is a central discipline.
Which strong subsection {} study chemistry
to find wudaokou Tsinghua University Department of Chemistry.
subsubsection {Tsinghua University Department of Chemistry how strong}
paragraph {} US News ranked
the world's tenth, far more than the next.
Other advantages {} subparagraph Chemistry Department of Tsinghua
strong teacher.
end {document}

This is the output of the above example:

cross reference

At the time of writing the article always encounter similar expressions need "shown in the following map". You can more easily and accurately in LaTeX in to do this. We can use label{marker}, ref{marker}and pageref{marker}to be cross-referenced to our chart, formula paragraphs. Which were wrapped in braces markeris our own choice as an object code, cross-reference when Always make sure you entered the correct code.

Environment and the floating body

LaTeX environment is a content carrier in order to achieve a special layout designed for the purpose. We use such statements in LaTeX to achieve their own ends:

1
2
3
begin {environment} 
corresponding contents, a variety of forms.
end {environment}

List

We have three list context, namely, to generate a list of free numbers itemize, have generated a list of numbers enumerateand can add a description of the descriptionenvironment. These lists can be nested (though sometimes ineffective), just as the following examples show.

1
2
3
4
5
6
7
8
9
10
11
12
{} the enumerate the begin 
Item first layer is a list of numbers.
} {itemize the begin
Item no is the index into the list of the second layer,
Item [remember] enclosed by the square brackets content may be "subtitle"
End {} itemize
Item you must remember:
the begin {} Description
Item [list does not ] make everything look pretty ordered
item [it can] make something very beautiful way to show it
End the Description} {
End} {the enumerate

This is the output of the above example:

Align

LaTeX There are three basic environment for alignment, respectively flushleft, flushrightand center, and alignment in Microsoft Word is not much difference in their use, simple and intuitive. Below is an example.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
begin {flushleft} 
This word line is left-aligned. You can manually change the line, like this \
or enter two line breaks. Like below.
end {flushleft}

begin {flushright}
these lines is right-aligned.

LaTeX will automatically adjust the position of the character, the text is too long will wrap at the right place.
end {flushright}

begin {center}
I correction stately, towering center.
end {center}

This is the output of the above example:

Quote

In LaTeX, there are several pre-set layout is a good environment to simplify the workload of citations. When referring to a short sentence, we can use the quoteenvironment; when referring to a longer more paragraphs, we can use quotationto indent environment that will paragraph; when referring to poetry, we can use verseenvironment. The following is an example.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
总工程师曾说:
begin{quote}
不管黑猫白猫,能捉老鼠的就是好猫。
end{quote}
在《在武昌、深圳、珠海、上海等地的谈话要点》中,他指出:
begin{quotation}
抓住时机,发展自己,关键是发展经济。现在,周边一些国家和地区经济发展比我们快,如果我们不发展或发展得太慢,老百姓一比较就有问题了。所以,能发展就不要阻挡,有条件的地方要尽可能搞快点,只要是讲效益,讲质量,搞外向型经济,就没有什么可以担心的。低速度就等于停步,甚至等于后退。要抓住机会,现在就是好机会。我就担心丧失机会。不抓呀,看到的机会就丢掉了,时间一晃就过去了。

我国的经济发展,总要力争隔几年上一个台阶。当然,不是鼓励不切实际的高速度,还是要扎扎实实,讲求效益,稳步协调地发展。比如广东,要上几个台阶,力争用二十年的时间赶上亚洲“四小龙”。比如江苏等发展比较好的地区,就应该比全国平均速度快。又比如上海,目前完全有条件搞得更快一点。上海在人才、技术和管理方面都有明显的优势,辐射面宽。回过头看,我的一个大失误就是搞四个经济特区时没有加上上海。要不然,现在长江三角洲,整个长江流域,乃至全国改革开放的局面,都会不一样。
end{quotation}
文章写得极为接地气,令人想吟诗一首:
begin{flushleft}
begin{verse}
力微任重久神疲,再竭衰庸定不支。\
苟利国家生死以,岂因祸福避趋之?\
谪居正是君恩厚,养拙刚于戍卒宜。\
戏与山妻谈故事,试吟断送老头皮。
end{verse}
end{flushleft}

这是上面例子的输出结果:

逐字输出

有些时候(比如编程教程),我们需要将一些字符原封不动地输出,让LaTeX无视其中的所有命令。这个时候verbatim环境就非常有用了。在begin{verbatim}end{verbatim}之间的文本将直接输出,包括所有的换行符和空格,就像在打字机上键入一样,不会执行任何LaTeX命令。当然,如果只是需要在一个段落中使用这个环境,也有相应的简化版命令verb+·+来完成,下面是一个例子。

1
2
3
4
5
6
在段落中,该功能可由verb|verb+text+|完成。+仅是分隔符的一个例子。除了*或空格,可以使用任意一个字符。
begin{verbatim}
begin{document}
Hello, verbatim!
end{document}
end{verbatim}

这是上面例子的输出结果:

浮动体

在一篇文章中,插图和表格通常需要占据大块空间,同时也不可被分割;所以在文字处理软件中我们经常需要调整他们的位置。figure 和 table 环境可以自动完成这样的任务;这种自动调整位置的环境称作浮动体(float)。

表格

在LaTeX中,tabular环境能够用来绘制最基础的表格。我们可以用这样的命令来进入tabular环境:begin{tabular}{table spec}。其中第二个花括号里面的table spec定义了表格的样式。

在这个环境中:hline命令表示横线,|表示竖线;用&来分列,用\来换行;每列可以分别采用居左、居中、居右等横向对齐方式,分别在{table spec}里面用l、c、r来表示。

下面是一个例子:

1
2
3
4
5
6
7
8
9
begin{tabular}{|l|c|r|}
hline
操作系统 & 发行版& 编辑器\
hline
Windows & TeX Live & Texstudio \
Unix/Linux & teTeX & Kile \
Mac OS & MacTeX & TeXShop \
hline
end{tabular}

这是上面例子的输出结果:

而进阶的table环境则支持增加标题、标签,并且是一个浮动体,在排版上更加智能。

图片

在LaTeX中插入图片建议使用graphicx宏包。插入图片的基础命令是:includegraphics[key=value, ...]{filename}。在插入图片时,有几种可选参数可以调节,分别是:

  • width:把图形缩放到指定的宽度
  • height:把图形缩放到指定的高度
  • angle:逆时针旋转图形
  • scale:缩放图形

下面是一个例子:

1
2
3
4
5
6
begin{figure}
centering
includegraphics[angle=45, width=0.7textwidth]{sign.eps}
caption{Signature}
label{fig:sign}
end{figure}

这是上面例子的输出结果:

重磅预告

下一期教大家如何快速简便地在LaTeX里画结构式和反应式,请大家敬请期待!!!

Guess you like

Origin www.cnblogs.com/petewell/p/11410463.html
Recommended