Begin to use Tex Example

1. Attention: need to save before compiling

2. 标题、作者和注释
建立一个新文档,将以下内容复制进入文档中,保存,保存类型选择为UTF-8,编译并观察现象。

\documentclass{article}
\author{My Name}
\title{The Title}
\begin{document}
\maketitle
hello, world % This is comment
\end{document}

3. 章节和段落
建立一个新文档,将以下内容复制进入文档中,保存,保存类型选择为UTF-8,编译并观察现象。

\documentclass{article}
\title{Hello World}
\begin{document}
\maketitle
\section{Hello China} China is in East Asia.
\subsection{Hello Beijing} Beijing is the capital of China.
\subsubsection{Hello Dongcheng District}
\paragraph{Tian‘anmen Square}is in the center of Beijing
\subparagraph{Chairman Mao} is in the center of Tian‘anmen Square
\subsection{Hello Guangzhou}
\paragraph{Sun Yat-sen University} is the best university in Guangzhou.
\end{document}

4.加入目录
建立一个新文档,将以下内容复制进入文档中,保存,保存类型选择为UTF-8,编译并观察现象。
与前面的核心区别在于这里在begin{document}之后是\tableofcontents  还是 \maketitle
\documentclass{article}
\begin{document}
\tableofcontents    
\section{Hello China} China is in East Asia.
\subsection{Hello Beijing} Beijing is the capital of China.
\subsubsection{Hello Dongcheng District}
\paragraph{Hello Tian‘anmen Square}is in the center of Beijing
\subparagraph{Hello Chairman Mao} is in the center of Tian‘anmen Square
\end{document}

5.. 关于换行

编辑界面的换行不会读入

额外键入的一个换行可以自动对齐换行

而\\ \\是往前两格换行

\documentclass{article}
\begin{document}
Beijing is
the capital
of China.

New York is

the capital

of America.

Amsterdam is \\ the capital \\
of Netherlands.
\end{document}

6.数学公式
建立一个新文档,将以下内容复制进入文档中,保存,保存类型选择为UTF-8,编译并观察现象。

\documentclass{article}
\usepackage{amsmath}
\usepackage{amssymb}
\begin{document}
The Newton‘s second law is F=ma.

The Newton‘s second law is $F=ma$.

The Newton‘s second law is
$$F=ma$$

The Newton‘s second law is
\[F=ma\]

Greek Letters $\eta$ and $\mu$

Fraction $\frac{a}{b}$

Power $a^b$

Subscript $a_b$

Derivate $\frac{\partial y}{\partial t} $

Vector $\vec{n}$

Bold $\mathbf{n}$

To time differential $\dot{F}$

Matrix (lcr here means left, center or right for each column)
\[
\left[
\begin{array}{lcr}
a1 & b22 & c333 \\
d444 & e555555 & f6
\end{array}
\right]
\]

Equations(here \& is the symbol for aligning different rows)
\begin{align}
a+b&=c\\
d&=e+f+g
\end{align}

\[
\left\{
\begin{aligned}
&a+b=c\\
&d=e+f+g
\end{aligned}
\right.
\]

\end{document}

具体细节可以自行搜索LaTeX的数学符号表或别人给的例子。

8.插入图片
先搜索到一个将图片转成eps文件的软件,很容易找的,然后将图片保存为一个名字如figure1.eps。
建立一个新文档,将以下内容复制进入文档中,保存,保存类型选择为UTF-8,放在和图片文件同一个文件夹里,编译并观察现象。

\documentclass{article}
\usepackage{graphicx}
\begin{document}
\includegraphics[width=4.00in,height=3.00in]{figure1.eps}
\end{document}

9.简单表格
建立一个新文档,将以下内容复制进入文档中,保存,保存类型选择为UTF-8,编译并观察现象。

\documentclass{article}
\begin{document}
\begin{tabular}{|c|c|}
a & b \\
c & d\\
\end{tabular}

\begin{tabular}{|c|c|}
\hline
a & b \\
\hline
c & d\\
\hline
\end{tabular}

\begin{center}
\begin{tabular}{|c|c|}
\hline
a & b \\ \hline
c & d\\
\hline
\end{tabular}
\end{center}
\end{document}

===============================
附录,有关我认为不是新手急需,但是的确比较有用的信息

1.中文支持
曾经的LaTeX的中文支持是比较麻烦的一件事,但是现在使用MikTeX+WinEdt的中文支持非常容易。
只需要把开头的\documentclass{atricle}换成\documentclass{ctexart}就可以了。
如果是第一次使用ctexart的话,会自动下载和安装宏包和模板,之后就不会再下载了。
例子参考如下:
打开WinEdt,建立一个新文档,将以下内容复制进入文档中,保存,保存类型选择为UTF-8。
\documentclass{ctexart}
\begin{document}
你好,世界
\end{document}

2.宏包
\package{}就是在调用宏包,对计算机实在外行的同学姑且可以理解为工具箱。
每一个宏包里都定义了一些专门的命令,通过这些命令可以实现对于一类对象(如数学公式等)的统一排版(如字号字形),或用来实现一些功能(如插入图片或制作复杂表格)。
通常在\documentclass之后,在\begin{document}之前,将文章所需要涉及的宏包都罗列上。
对于新人而言比较常用的宏包有

编辑数学公式的宏包:\usepackage{amsmath}和 \usepackage{amssymb}
编辑数学定理和证明过程的宏包:\usepackage{amsthm}
插入图片的宏包:\usepackage{graphicx}
复杂表格的宏包:\usepackage{multirow}

差不多了,对于新人来说,这五个宏包已经基本够用了。如果有其他的特殊需求,就通过google去寻找吧。
补充说明一下,现在ctexart模板里集成了中文支持,所以CJK宏包并不是必需品。

3.模板
模板就是在\documentclass{}后面的大括号里的内容。
在这一份教程中,我们使用的是LaTeX默认自带的模板article,以及中文模板ctexart。
模板就是实现我之前所介绍的LaTeX的经验总结的第二点的实现方式。
一篇文章,我们定义了section,定义了paragraph,就是没有定义字体字号,因为字体字号这一部分通常来说是在模板中实现的。
一个模板可以规定,section这个层级都用什么字体什么字号怎么对齐,subsection这个层级用什么字体什么字号怎么对齐,paragraph又用什么字体什么字号怎么对齐。
当然模板里还可以包含一些自定义的口令,以及页眉页脚页边距一类的页面设置。
由于模板的使用,在我的使用经验里来看,绝对不可能算是基本入门级的内容,所以在正文里当然不会提及。

时间: 2024-12-16 18:30:32

Begin to use Tex Example的相关文章

TeX — Beauty and Fun

TeX — Beauty and Fun 这里是一个宣传 TeX — 世界上最漂亮,最有趣,最可靠的排版程序的网页.希望通过我的介绍,你能体会到使用 TeX 的快乐感觉,并且成为一个 TeX 的用户和支持者.由于中国 TeX 的普及率还很低,我们必须适当宣传.如果你也情不自禁爱上了 TeX,你希望更多的人从中受益,那么就把 TeX介绍给你的朋友们吧. 不管你怎么到了这里,或者是写论文时被 Word 繁琐的功能弄晕了,想看看这个新鲜东西能否消除你的烦恼?或者你是久闻 TeX 大名,但是不知道这到底

Latex 博客模板-基于电子科技大学学位论文latex模板

主要修改了原工程的thesis.clx文件,主要修改了 1 封面LOGO 2 封面个人信息 3 去掉英文摘要.英文译文等章节 ,使内容更适合paper. 修改的代码如下: 1 %% 2 %% This is file `uestcthesis.cls', 3 %% generated with the docstrip utility. 4 %% 5 %% The original source files were: 6 %% 7 %% uestcthesis.dtx (with option

LaTeX:图形的填充(生成阴影图形)

将内网和外网看到的综合整理. 韦恩图Venn \documentclass{standalone} \usepackage{tikz} %导出为图片需要安装imagemagick %https://tex.stackexchange.com/questions/91472/how-to-save-a-figure-produced-by-tikz-save-export-as-jpg-png-file %可用acrobat pro转存 \begin{document} %http://blog.

Windows下TeX Live + Sublime Text 3 + Sumatra PDF配置

本文写给我的师弟们,如何自己动手配置LaTeX环境(通过LeX Live + Sublime Text 3 + Sumatra PDF). 1.TeX Live 配置 首先从TeX Live 下载ISO镜像.这里不推荐在线安装的方式,即「installing TeX Live over the Internet」的方式,原因是中国的网络不好.网站给出了3种镜像下载的方式,分别为 1.download from a nearby CTAN mirror: 2.manually choose a m

使用MetaPost为tex绘图(以WinEdit7.0为编辑器)

MetaPost 是一种描述性的语言, 用它可以作出非常漂亮的图形. 特别适合于精确的图形. MetaPost 可以生成最高质量的 EPS 文件,可以方便的插入到 TeX 文件里.生成的 dvi 文件可以没有任何问题的被 dvips 转换成 PS, 或者被 dvipdfm 转换成 PDF. 七月份有幸的以为美国教授指点写了篇论文,其中他的一个美国学生帮忙写的tex文件深深震撼了我,所有图表全部是用tikzpicture包写的,初看起来整个tex文件的一半内容都是绘图的代码,这让我非常吃惊,一方面

TeX系列: tikz-3dplot绘图宏包

tikz-3dplot包提供了针对TikZ的命令和坐标变换样式, 能够相对直接地绘制三维坐标系统和简单三维图形. tikz-3dplot包当前处于初创期, 有很多功能有待完善. 安装过程如下: (1) 下载宏包tikz-3dplot.sty http://www.ctan.org/tex-archive/graphics/pgf/contrib/tikz-3dplot/ (2) 把上述文件拷贝至TeX的目录树上, 比如D:\texmf\tex\latex\tikz-3dplot, 在DOS命令窗

latex排除\par \begin {document}

when you use latex to complile your paper, sometimes you may get the error: File ended while scanning use of \@input. <inserted text> \par 1.28 \begin {document} At this time, you can delete the temporary files, such as .aux file. Then, you can star

matplotlib 生成 eps 插入到 tex

matplotlib 生成 eps,就可以插入到 tex 中,而且是矢量图,放大不失真. 而且因为图中的元素都是嵌入到 pdf 中,所以图中的文字也可以选中及复制. 注意 matplotlib 的 backend 要选择 Agg ,用 TkAgg 作为 backend 只能生成一张空白图片. testeps.py 1 import matplotlib 2 matplotlib.use('Agg') 3 import matplotlib.pyplot as plt 4 x=range(100)

科学论文写作工具TEX/LaTEX/CTEX

0.TEX陈年往事 Knuth教授在写作TAOCP(The Art of Computer Programming)时,发现书商把他书中的数学式排的太难看,于是决定自行开发一个非常适合排数学式的排版语言,于是有了TEX,并且迅速流行并吸引了很多的科学工作者使用TEX作为科学论文写作.(大牛就是大牛) ps:TAOCP介绍的网站,主要是关于算法的.http://www-cs-staff.stanford.edu/~knuth/taocp.html 1.LaTEX/CTEX TEX是低级的排版语言,