0.说明
本文使用的LATEX排版工具为CTEX套件,具体可参看上一篇博文。
1.排版实练
1)换行
每行最后加“\”可进行换行,也可以使用 ewline指令。\换行还可以进行行距控制。
this is a line \[1cm]
this is a new line
上述内容表示在原来行间距上加上1cm,值可以是负数,表示减去对应的行间距。不使用换行控制,即使进行回车(enter)也不会进行换行。
2)文档类别
先主要介绍“article”与“report",article没有章(chapter),可以用作短文或者小论文,report则是报告或者大论文。
文档结构主要有chapter/section/subsection/等。
3)简单示例
这里为了能对结果pdf进行很好的截图,使用article文档类别,report文档每个chapter会自动分页。test.tex文件内容如下:
1 documentclass{article} 2 egin{document} 3 This is the first experience of LaTeX. 4 section{Aesop Fables} 5 subsection{The Ant and the Dove} 6 An ant went to the bank of a river to quench its thirst, and 7 being carried away by the rush of the stream, was on the 8 point of drowning. 9 A Dove sitting on a tree overhanging the water plucked a 10 leaf and let it fall into the stream close to her. The Ant 11 climbed onto it and floated in safety to the bank. 12 subsection{The Dog in the Manger} 13 A dog lay in a manger, and by his growling and snapping 14 prevented the oxen from eating the hay which had been 15 placed for them. 16 ‘‘What a selfish Dog!’’ said one of them to his companions; 17 ‘‘he cannot eat the hay himself, and yet refuses to allow 18 those to eat who can.’’ 19 section{The Eagle and the Arrow} 20 An eagle sat on a lofty rock, watching the movements of a 21 Hare whom he sought to make his prey. 22 An archer, who saw the Eagle from a place of concealment, 23 took an accurate aim and wounded him mortally. 24 end{document}
上述代码编译产生的pdf效果如下图:
解释:第3行被当做引言,从而被自动缩进了。section后为节,subsection后为小结,节和小节被自动使用了响应的格式进行了加粗等设置。
4)加入标题(title)等信息
将test.tex的1-3行改为:
documentclass{article}
itle{Aesop Fables}
author{Aesop hanks{Thanks to the reader.}
and Nobody hanks{Thanks to nobody.}}
date{ oday}
egin{document}
maketitle
This is the first experience of LaTeX.
编译的pdf结果如下:
解释: itle指令添加文章标题,author加入作者名字, hanks添加致谢,多位作者用and 进行连接。date加入日期,title的插入式在preamble区,并且需要在文本区(egin{document}后)加入maketitle指令来生成title信息。
5)加入目录
目录的插入非常简单,在上述基础上,在maketitle指令后加入一行:
ableofcontents
LATEX会自动根据章节(chapter)/节(section)/小节(subsection)等内容插入目录,此时需要编译两次,一次用于生成toc文件(table of contents),第二次根据toc真正的编入目录。
本文示例加入目录后,结果如下图:
6)摘要
article/report文档类别可以有摘要,可以在maketitle和 ableofcontents之间插入摘要,如下:
egin{abstract}
The tale, the Parable, and the Fable are all common and popular
modes of conveying instruction. Each is distinguished by its own
special characteristics.
end{abstract}
摘要使用egin{abstract} end{abstract}进行标记,摘要会自动进行左右缩排,排版结果如下图:
7)脚注与边注
可以使用footnote{}加入脚注marginpar{}加入边注,脚注和边注的内容写在{}内。
修改第一小节内容如下:
An antfootnote{mayi in chinese} went to the bank of a river to quench its thirst, and being carried away by the rush of the stream, was on the point of drowning.
A Dovemarginpar{Pigeon} sitting on a tree overhanging the water plucked a leaf and let it fall into the stream close to her. The Ant climbed onto it and floated in safety to the bank.
编译后排版结果如下图:
to be coutinued...