Latex
Table of Contents
1 Latex基本用法
1.1 Latex
LATEX is a macro package that enables authors to typeset and print their work at the highest typographical quality, using a predefined, professional layout.
1.2 基本语法
- 空格语法与markdown相同,多个空格算一个,空行新起段落。
- 特殊符:#,$,%,^,&,_,{ , },~,\ , 使用\转义,\\新起一行
- 命令以\开头,Latex命令后不识别空格,命令后使用{}来空格。
- 命令参数写在{}里面,参数选项写在[]里面。
- 使用%注释,或者
\begin{comment}, \end{comment}
1.2.1 段落
- \\ or \newline新起一行,\newpage新起一页
1.2.2 断字
- \hyphenation{ word list },for example: `\hyphenation{FORTRAN Hy-phen-a-tion}`
- \mbox
- \fbox
-
1.2.3 预定义String
- \today , 输入当前日期
- \Tex, 输出Tex
- \Latex , 输出Latex
- \LaTeXe, 输出Latex当前版本?
1.2.4 字型
- < Italic
- \sl slant
- \bf boldface
1.2.5 条列
- 无序
\begin{itemsize}
\item test1
\item test2
\item test3
\end{itemsize}
- 有序
\begin{enumerate}
\item test1
\item test2
\item test3
\end{enumerate}
1.2.6 特殊标点
1.2.7 文件基本结构
\documentclass[a4paper,11pt]{article}
# % define the title
\author{H.~Partl}
\title{Minimalism}
\begin{document}
# % generates the title
\maketitle
# % insert the table of contents
\tableofcontents
\section{Some Interesting Words}
Well, and here begins my lovely article.
\section{Good Bye World}
\ldots{} and here it ends.
\end{document}
1.3 运行方式
latex example.tex //编译成.dvi xdvi example.dvi & //预览生成的pdf dvipdf example.dvi //生成PDF
1.4 文档布局
1.4.1 documentclass
\documentclass[options]{class}指定特定的样式,如 `\documentclass[11pt,twoside,a4paper]{article}`
Document Class 常见类型:
| class | 描述 |
| article | 文章类型 |
| report | 长报告 |
| book | 出版书的类型 |
| slides | 幻灯片 |
Document Options 常见选项:
| options | 描述 |
| 10pt,11pt | 主文档的字体大小,默认10pt |
| a4paper,letterpaper | 纸张大小,默认是letterpaper |
| fleqn | 左对齐 |
| leqno | 编号放左侧 |
| titlepage,notitlepage | 标题要不要单独成一个页面,artile默认不单独,book和report默认单独 |
| onecolumn,twocolumn | 分成几列 |
| twoside, oneside | 单面or双面 |
| landscape | 以landscape格式打印 |
| openright,openany | … |
1.4.2 usepackage
`\usepackage[options]{package}`
1.4.3 pagestyle
`\pagestyle{style}` / 改变所有页样式 `\thispagestyle{style}` / 改变当前页样式
常见样式:
| style | 描述 |
|---|---|
| plain | 页码在页脚中央,默认 |
| headings | 页码在页眉处 |
| empty | 页眉和页脚为空 |