Latex使用简单总结
安裝完Latex后會(huì)有這幾個(gè)工具:
AAAAA:第一部分-->基礎(chǔ)篇
(1)打開(kāi)圖中TeXworks editor,出現(xiàn)如下界面:
在菜單欄下方空白處可進(jìn)行編輯自己的內(nèi)容。
(2)從最簡(jiǎn)單的編輯一個(gè)hello word開(kāi)始。
\documentclass{article}
\begin{document}
hello, world
\end{document}
把上述內(nèi)容復(fù)制到Tex下。
首先點(diǎn)擊文件-->另存為-->保存到Tex(該文件夾是提前建好存放在某個(gè)目錄下的),該步執(zhí)行結(jié)果如下:
其次,點(diǎn)擊,會(huì)直接生成pdf版本,該pdf內(nèi)容就是你上述編輯的hello,word
最后,在你保存的文件夾tex下會(huì)有幾個(gè)文檔,其中包含生成的pdf文檔。
至此,一個(gè)簡(jiǎn)單的pdf版本就生成了。
AAAAA:第二部分-->進(jìn)階
1.標(biāo)題、作者和注釋
\documentclass{article}
\author{My Name}
\title{The Title}
\begin{document}
\maketitle
hello, world % This is comment
\end{document}
2.章節(jié)和段落
\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}
退格只是我個(gè)人偏好,看起來(lái)層次清晰美觀。實(shí)際操作上未必要如此,每一行之前的空格不影響編譯生成PDF的排版結(jié)果。
3.加入目錄
\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}
4.換行
\documentclass{article}
\begin{document}
Beijing is
the capital
of China.New York isthe capitalof America.Amsterdam is \\ the capital \\
of Netherlands.
\end{document}
5.數(shù)學(xué)公式
\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}$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}
6.插入圖片(先搜索到一個(gè)將圖片轉(zhuǎn)成eps文件的軟件,很容易找的,然后將圖片保存為一個(gè)名字如figure1.eps。 建立一個(gè)新文檔,將以下內(nèi)容復(fù)制進(jìn)入文檔中,保存,保存類型選擇為UTF-8,放在和圖片文件同一個(gè)文件夾里,編譯并觀察現(xiàn)象。)
準(zhǔn)備一張圖片giraffe.eps,放到你所建立的Tex文件夾下,
\documentclass{article}
\usepackage{graphicx}
\begin{document}
\includegraphics[width=4.00in,height=3.00in]{giraffe.eps}
\end{document}
一個(gè)在線的png2eps的轉(zhuǎn)換工具:http://www.tlhiv.org/rast2vec/
7.簡(jiǎn)單表格
\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}
AAAAA:擴(kuò)展
1.中文支持
曾經(jīng)的LaTeX的中文支持是比較麻煩的一件事,但是現(xiàn)在使用MikTeX+WinEdt的中文支持非常容易。
只需要把開(kāi)頭的\documentclass{atricle}換成\documentclass{ctexart}就可以了。
如果是第一次使用ctexart的話,會(huì)自動(dòng)下載和安裝宏包和模板,之后就不會(huì)再下載了。
例子參考如下:
打開(kāi)WinEdt,建立一個(gè)新文檔,將以下內(nèi)容復(fù)制進(jìn)入文檔中,保存,保存類型選擇為UTF-8。
\documentclass{ctexart}
\begin{document}
你好,世界
\end{document}
2.宏包
\package{}就是在調(diào)用宏包,對(duì)計(jì)算機(jī)實(shí)在外行的同學(xué)姑且可以理解為工具箱。
每一個(gè)宏包里都定義了一些專門的命令,通過(guò)這些命令可以實(shí)現(xiàn)對(duì)于一類對(duì)象(如數(shù)學(xué)公式等)的統(tǒng)一排版(如字號(hào)字形),或用來(lái)實(shí)現(xiàn)一些功能(如插入圖片或制作復(fù)雜表格)。
通常在\documentclass之后,在\begin{document}之前,將文章所需要涉及的宏包都羅列上。
對(duì)于新人而言比較常用的宏包有
編輯數(shù)學(xué)公式的宏包:\usepackage{amsmath}和 \usepackage{amssymb}
編輯數(shù)學(xué)定理和證明過(guò)程的宏包:\usepackage{amsthm}
插入圖片的宏包:\usepackage{graphicx}
復(fù)雜表格的宏包:\usepackage{multirow}
差不多了,對(duì)于新人來(lái)說(shuō),這五個(gè)宏包已經(jīng)基本夠用了。如果有其他的特殊需求,就通過(guò)google去尋找吧。
補(bǔ)充說(shuō)明一下,現(xiàn)在ctexart模板里集成了中文支持,所以CJK宏包并不是必需品。
3.模板
模板就是在\documentclass{}后面的大括號(hào)里的內(nèi)容。
在這一份教程中,我們使用的是LaTeX默認(rèn)自帶的模板article,以及中文模板ctexart。
模板就是實(shí)現(xiàn)我之前所介紹的LaTeX的經(jīng)驗(yàn)總結(jié)的第二點(diǎn)的實(shí)現(xiàn)方式。
一篇文章,我們定義了section,定義了paragraph,就是沒(méi)有定義字體字號(hào),因?yàn)樽煮w字號(hào)這一部分通常來(lái)說(shuō)是在模板中實(shí)現(xiàn)的。
一個(gè)模板可以規(guī)定,section這個(gè)層級(jí)都用什么字體什么字號(hào)怎么對(duì)齊,subsection這個(gè)層級(jí)用什么字體什么字號(hào)怎么對(duì)齊,paragraph又用什么字體什么字號(hào)怎么對(duì)齊。
當(dāng)然模板里還可以包含一些自定義的口令,以及頁(yè)眉頁(yè)腳頁(yè)邊距一類的頁(yè)面設(shè)置。
由于模板的使用,在我的使用經(jīng)驗(yàn)里來(lái)看,絕對(duì)不可能算是基本入門級(jí)的內(nèi)容,所以在正文里當(dāng)然不會(huì)提及。
如果有人實(shí)在想學(xué),如果LaTeX已經(jīng)接觸到這個(gè)程度上了,那么再去翻其他厚一些的教材,也不虧了。
4.參考文獻(xiàn)和制作幻燈片
做參考文獻(xiàn)的時(shí)候,文章也已經(jīng)快寫到尾聲了,而幻燈片更不是進(jìn)階一些的需求。對(duì)這兩個(gè)功能有需求的LaTeX user,使用LaTeX也已經(jīng)相當(dāng)熟練了,自己去google一下或查閱其他厚教程是很理所當(dāng)然的,一點(diǎn)也不冤枉。
在此我就只提供兩個(gè)搜索關(guān)鍵詞,參考文獻(xiàn)可以搜bibtex,制作幻燈片可以搜beamer。
總結(jié)
以上是生活随笔為你收集整理的Latex使用简单总结的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: PCL显示法线no override f
- 下一篇: PCL分割:Conditional Eu