latex教程——语法(一)

latex的每一行称作为语句(statement)
语句(statement)又分为以下三种:

  • 命令(command)
    • 普通命令(normal command)
      • 普通命令以 \ 作为开头,通常只有一行。
    • 环境 (environment)
      • 环境包含开头(start)和结尾(end),二者成对出现,通常在多行的情况下使用。
    • 普通命令和环境命令可以一起使用
  • 数据(data)
    • 数据是我们需要书写的内容
  • 注释(comment)
    • %作为开头,在编译的时候注释的内容会被忽略。

latex文档的结构
latex文件通常以.tex作为结尾,.tex源文件中包含三个部分:

  • 文档声明(document class)
    • 包括article, letter, report, book四种类型
  • 序言(preamble)
    • 设置包(package),定义命令(command),设置环境(environment)
  • 正文(main text)
    • 正文写在\begin{document}\end{document}之间

写一份latex文档时,首先我们需要写文档声明,然后写序言。序言包括一些包(package),有时也会定义一些命令,设置一些环境。我们实际需要写的文本则会放到正文。
语法示例

\documentclass[options]{class}  %文档类的声明
\usepackeage[options]{packagge} %引入的宏包
...
\begin{document}                %正文 
...            
\end{document}

LATEX 文档分为四类,article,book,report,和letter。

  • articleletter类可以有 part,section,subsection等,但是没有chapter。摘要紧接着标题位于第一页上。
  • report 类可以有 part,chapter,section,subsection等,也有abstract,且abstract于单独一页上,有页码。
  • book 类可以有 part,chapter,section,subsection等,但没有abstract。

对于会议和期刊的文章,使用的类别通常是article和letter类;对于学位论文,用 report或是book类型。但是建议使用report类,比如dlut学位论文模板用的是report类。此外使用演示文稿时,会用到slide,不过 slider不是标准的文档类,而是一个environment。
Available document structure commands:

Book: \part{}, \chapter{}, \section{}, \subsection{}, \subsubsection{}, \paragraph{}, \subparagraph{}.

Report: \part{}, \chapter{}, \section{}, \subsection{}, \subsubsection{}, \paragraph{}, \subparagraph{}.

Article: \part{}, \section{}, \subsection{}, \subsubsection{}, \paragraph{}, \subparagraph{}.

Letter: A letter does not know the same structuring commands as other formats, but more specific commands like \signature{}, \address{}, \opening{} and \closing{}.

Except \part{}, all structuring commands build a hierarchy. They have a standard formating and numeration.

Other less common document-classes:

“proc” for a protocol (two columns by default and smaller borders on the left and right)
“slides” for a presentations
“minimal, a prototype for your own document type
You can always change the standard document types, by adapting the *.cls-file to your needs.

经常使用的相关配置
10pt, 11pt, 12pt 正文字体(Maintext font )默认设置为10pt.LaTeX 基于正文的字体来设置use adjust the font for title,chapter heading and etc based on the main text font.
letterpaper, a4paper 纸张大小(Papersize)默认设置为 letterpaper。
notitlepage, titlepage 这两个配置决定写完标题之后是否另起一页再来写剩下的内容(也就是是否有标题页)。对于article,默认设置为notitlepage(无标题页);对于 report和 book,默认是 titlepage(有标题页)。
onecolumn,twocolumn 默认设置为onecolumn (除了book之外的所有类别)

本文许可证

本仓库遵循 CC BY-NC-SA 4.0(署名 - 非商业性使用 - 相同方式共享) 协议,转载请注明出处,不得用于商业目的。
CC BY-NC-SA 4.0

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值