什么是LaTeX
LaTeX(/?lɑ?t?ks/燕锥,常被讀作/?lɑ?t?k/或/?le?t?k/顽频,寫(xiě)作“LATEX”)菱蔬,是一種基于TEX的排版系統(tǒng),由美國(guó)計(jì)算機(jī)科學(xué)家萊斯利·蘭伯特在20世紀(jì)80年代初期開(kāi)發(fā)砾层,利用這種格式系統(tǒng)的處理漩绵,即使用戶沒(méi)有排版和程序設(shè)計(jì)的知識(shí)也可以充分發(fā)揮由TEX所提供的強(qiáng)大功能,不必一一親自去設(shè)計(jì)或校對(duì)肛炮,能在幾天止吐,甚至幾小時(shí)內(nèi)生成很多具有書(shū)籍質(zhì)量的印刷品。對(duì)于生成復(fù)雜表格和數(shù)學(xué)公式侨糟,這一點(diǎn)表現(xiàn)得尤為突出碍扔。因此它非常適用于生成高印刷質(zhì)量的科技和數(shù)學(xué)、物理文檔秕重。這個(gè)系統(tǒng)同樣適用于生成從簡(jiǎn)單的信件到完整書(shū)籍的所有其他種類的文檔不同。
LaTeX遵循呈現(xiàn)與內(nèi)容分離的設(shè)計(jì)理念,以便作者可以專注于他們正在編寫(xiě)的內(nèi)容悲幅,而不必同時(shí)注視其外觀套鹅。在準(zhǔn)備LaTeX文檔時(shí)站蝠,作者使用章(chapter)汰具、節(jié)(section)、表(table)菱魔、圖(figure)等簡(jiǎn)單的概念指定文檔的邏輯結(jié)構(gòu)留荔,并讓LaTeX系統(tǒng)負(fù)責(zé)這些結(jié)構(gòu)的格式和布局。因此澜倦,它鼓勵(lì)從內(nèi)容中分離布局聚蝶,同時(shí)仍然允許在需要時(shí)進(jìn)行手動(dòng)排版調(diào)整。
LaTeX環(huán)境配置
- 本地:本地推薦使用 TeXstudio(前端編輯器) + MiKTeX (后端開(kāi)源工具包)藻治。
- 在線: 強(qiáng)烈推薦Overleaf碘勉,其中囊括了大量的期刊模板,可以快速開(kāi)始草稿的撰寫(xiě)桩卵,并且可以與包括IEEE,Springer, Taylor & Francis在內(nèi)的等多家出版社的投稿系統(tǒng)對(duì)接验靡,可以實(shí)現(xiàn)一鍵投稿(我沒(méi)這么干過(guò) 哈哈哈)。
論文LaTeX模板下載
- 一般去期刊投稿網(wǎng)站上都有雏节。例如我常用的是IEEE的模板:IEEE 會(huì)議模板胜嗓,IEEE 期刊模板。
- 下載好之后钩乍,一般包含4個(gè)文件, 舉例:
conference.pdf //tex文件編譯后的pdf
conference.tex //正文tex文件
IEEEtran.cls //LaTeX Class文件
IEEEtran_HOWTO.pdf //IEEEtran.cls的使用方法
cls文件
- cls文件是latex格式文件辞州,它決定了latex源文件的排版布局。最一般的cls文件就是我們常用的
article.cls
,這表現(xiàn)在\documentclass{article}
這一句里面寥粹。如果出版方提供了cls文件变过,我們可以下面兩個(gè)方法使用(假如cls文件名為xxx.cls):
cls文件和你自己的latex文件放到同一個(gè)文件夾里面埃元,在源文件里面用\documentclass{xxx}
。
宏包
\usepackage{cite}%引用
\usepackage{graphicx}%圖片
\usepackage{subfigure}%有小圖
\usepackage{amsmath,bm}%數(shù)學(xué)公式+加粗
\usepackage{flushend}%解決最后一頁(yè)兩邊不平衡問(wèn)題
%針對(duì)黃色高亮
\usepackage{color, soul}
\soulregister\cite7 % 針對(duì)\cite命令
\soulregister\citep7 % 針對(duì)\citep命令
\soulregister\citet7 % 針對(duì)\citet命令
\soulregister\ref7 % 針對(duì)\ref命令
\soulregister\pageref7 % 針對(duì)\pageref命令
%算法流程圖
\usepackage{algorithmicx,algorithm}
\usepackage[noend]{algpseudocode}
%跨行跨列表格
\usepackage{makecell}
\usepackage{multirow}
一個(gè)最簡(jiǎn)單的LaTeX示例
\documentclass{article}
\begin{document}
\begin{abstract} %摘要
I am abstract.
\end{abstract}
\begin{IEEEkeywords}%關(guān)鍵詞
Camera model......
\end{IEEEkeywords}
\section{introduction} %建立新的章節(jié)
\label{sec:intro} %章節(jié)的label牵啦,方便被引用
I am very happy. %正文文本
\subsection{subA} %建立子章節(jié)
OK.This is \ref{sec:intro} %引用章節(jié)
\end{document}
添加參考文獻(xiàn)
- 可以使用這個(gè)bib文件管理所有的參考文獻(xiàn)亚情,例如我使用的
ref.bib
。則可以在正文末尾添加:
\bibliographystyle{IEEEtran} %參考文件格式
\bibliography{ref}%bib文件名
ref.bib
文件保存所有的要引用參考文獻(xiàn)的信息哈雏,可以從谷歌學(xué)術(shù)楞件、百度學(xué)術(shù)、各期刊網(wǎng)站導(dǎo)出裳瘪。例如:
@article{corke2007simple,
title={A simple and systematic approach to assigning Denavit--Hartenberg parameters},
author={Corke, Peter I},
journal={IEEE transactions on robotics},
volume={23},
number={3},
pages={590--594},
year={2007},
publisher={IEEE}
}
@inproceedings{aghakhani2013task,
title={Task control with remote center of motion constraint for minimally invasive robotic surgery},
author={Aghakhani, Nastaran and Geravand, Milad and Shahriari, Navid and Vendittelli, Marilena and Oriolo, Giuseppe},
booktitle={2013 IEEE international conference on robotics and automation},
pages={5807--5812},
year={2013},
organization={IEEE}
}
@book{corke2017robotics,
title={Robotics, vision and control: fundamental algorithms in MATLAB{\textregistered} second, completely revised},
author={Corke, Peter},
volume={118},
year={2017},
publisher={Springer}
}
@misc{LabelImg,
author = {Tzutalin},
year = {2015},
url = {https://github.com/tzutalin/labelImg},
title = {LabelImg}
}
在文中引用的話土浸,只需\cite{corke2017robotics}
,如果一次進(jìn)行多個(gè)引用,可以用逗號(hào)隔開(kāi)彭羹。例如\cite{corke2017robotics,LabelImg,aghakhani2013task}
黄伊。
- 添加圖片
- 單個(gè)圖片
\begin{figure}
\centering
\includegraphics[width=1\linewidth]{image/cameramodel}
\caption{The principle of pinhole camera model.}
\label{fig:cameramodel}
\end{figure}
- 一排2張圖片
\begin{figure}
% \includegraphics[width=1\linewidth]{image/image3}
\begin{minipage}[t]{0.5\linewidth}
\centering
\subfigure[]{
\label{Tracking an instrument}
\includegraphics[width=0.9\textwidth]{image/1}}
\end{minipage}%
\begin{minipage}[t]{0.5\linewidth}
\centering
\subfigure[]{
\label{Tracking two instruments}
\includegraphics[width=0.9\textwidth]{image/2}}
\end{minipage}
\caption{Tracking schematic diagram. (a) Tracking an instrument. (b) Tracking two instruments.}
\label{fig:tracking1}
\end{figure}
- 2排每排2個(gè)
\begin{figure}
\begin{minipage}[t]{0.5\linewidth}
\centering
\subfigure[]{
%\label{sim2stj1}
\includegraphics[width=1\textwidth]{image/Vmax/distance}}
\end{minipage}%
\begin{minipage}[t]{0.5\linewidth}
\centering
\subfigure[]{
% \label{s2_distance}
\includegraphics[width=1\textwidth]{image/Vmax/trj}}
\end{minipage}
\begin{minipage}[t]{0.5\linewidth}
\centering
\subfigure[]{
%\label{sim2stj1}
\includegraphics[width=1\textwidth]{image/Vmax/speed}}
\end{minipage}%
\begin{minipage}[t]{0.5\linewidth}
\centering
\subfigure[]{
% \label{s2_distance}
\includegraphics[width=1\textwidth]{image/Vmax/camera}}
\end{minipage}
\caption{Performance comparison. (a) Distance between the projection point and the image center. (b) Pixel trajectory of the projection point. (c) Camera speed. (d) Camera trajectory.}
\label{Vmax}
\end{figure}
以此類推
插入表格
- 普通表格
\begin{table}[!t]
% increase table row spacing, adjust to taste
\renewcommand{\arraystretch}{1.3}
\caption{\hl{The parameters settings of each simulation}}
\label{table_II}
\centering
% Some packages, such as MDW tools, offer better commands for making tables
% than the plain LaTeX2e tabular which is used here.
\begin{tabular}{ccccc}%c表示居中,l表示左對(duì)齊派殷,r表示右對(duì)齊(c|c|:這種方式可以添加豎線)
\hline\hline%添加橫線
\rowcolor{yellow}\textbf{Section} & $\bm{V_{max}}$\textbf{(mm/s)} &$\bm{R}$\textbf{(pixel)}&$\bm{r}$\textbf{(pixel)}& $\bm{K}$\\
\hline
\rowcolor{yellow}Section IV.A&50,100,200&300&20&0.08\\
\hline
\rowcolor{yellow}Section IV.B&300&150,200,300&20&0.1\\
\hline
\rowcolor{yellow}Section IV.C&100&300&20,80,150&1\\
\hline
\rowcolor{yellow}Section IV.D&100&300&150&0.3,1,10\\
\hline \hline
\end{tabular}
\end{table}
- 跨行表格
使用宏包\usepackage{multirow}
\begin{table}
\centering
\begin{tabular}{|c|c|c|c|}
\hline
\multirow{2}*{合并兩行一列} & 二 & 三 & 四 \\
~ & 2 & 3 & 4 \\
\hline
\end{tabular}
\end{table}
- 跨列表格
合并1行多列可以使用\multicolumn{cols}{pos}{text}
來(lái)實(shí)現(xiàn)
\begin{table}
\centering
\begin{tabular}{|c|c|c|c|}
\hline
\multicolumn{2}{|c|}{合并一行兩列} & 三 & 四 \\
\hline
1 & 2 & 3 & 4 \\
\hline
\end{tabular}
\end{table}
對(duì)于部分期刊还最,如IEEE,有雙欄的情況,如果希望跨欄毡惜,則將{table}環(huán)境修改為{table*}即可拓轻;
公式
- 插入行內(nèi)公式
$A=B+C$
- 插入行間公式
\begin{equation}
\label{eq1}
a^2=b^2+c^2
\end{equation}
^
:上標(biāo)
_
:下標(biāo)
\bm
:加粗
\dot
:字母上面加點(diǎn)
\|
:絕對(duì)值
\frac{分子}{分母}
:分?jǐn)?shù)
\leq
:小于等于
\geq
:大于等于
\sum_{}^{}
:求和
\lim\limits_{xx\to +\infty}
:取極限xx到正無(wú)窮
\sqrt
開(kāi)根號(hào)
\exitst
:存在
\forall
:對(duì)于任意
- 插入矩陣:
\begin{equation}
\bm{T}_{EEF}^0=\left[\begin{array}{cccc}
0& -1 & 0 & 250 \\
-1& 0 & 0 & -250 \\
0& 0 & -1 & 50 \\
0& 0 & 0 & 1
\end{array} \right].
\end{equation}
- 常用希臘字母
更多內(nèi)容請(qǐng)參考常用數(shù)學(xué)符號(hào)的 LaTeX 表示方法
- Spring期刊參考文獻(xiàn)格式
spbasic.bst文件中1571行和1624行的兩個(gè)SORT,默認(rèn)是開(kāi)啟的经伙,代表文章后面參考文獻(xiàn)列表是按作者名字首字母和年份排序的扶叉。如果用%%將其屏蔽代表參考文獻(xiàn)是按引用的順序排序的。
\usepackage{natbib}
\bibliographystyle{spbasic.bst}
句首引用的時(shí)候用citet{} 句末引用的時(shí)候用(citealt{})
特殊字符
俄語(yǔ)的輸入
% !TeX program = pdfLaTeX
% !TeX encoding = UTF-8
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[T2A]{fontenc}
\begin{document}
\section{Русский язык}
Русский язык
\end{document}