Latex常用命令(欢迎查阅)

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/xjm850552586/article/details/79594210

之前使用过Atom+latex,觉得挺棒的,推荐给需要写论文的小伙伴们。
latex绝对是排版之王,在我眼里,真心比word排版好看。
但是latex写起来却是一个艰难的过程,耗时真的比较长,所以大家平时的一些文章还是用word来书写吧。
接下来分享一些常用指令,大家可以收藏,方便日后使用~ 【如果查阅官方文档的话真的比较累】

latex常用指令

1、支持中文

\documentclass[UTF8]{article}
\usepackage{CJK}

2、向文章中插入图片

\documentclass{article}
\usepackage{graphicx}
\begin{document}
\includegraphics[scale=0.6]{1.png}    //scale是图片比例,1.png要和文章在同一路径
\end{document}

3、参考文献引用(在写论文的时候常用) —-有两种方法

方法一<直接在tex文件里引用>

\documentclass{article}
\begin{document}
\section{Introduction} Partl~\cite{pa} has proposed that \ldots

\begin{thebibliography}{99}
\bibitem{pa} H.~Partl: \emph{German \TeX}, TUGboat Volume~9, Issue~1 (1988)
\end{thebibliography} \end{document}

方法二<现将参考文献放到bib文件中,再在tex文件中调用>!!!强烈推荐!!

首先新建一个x.bib文件,然后用记事本之类的编辑器工具打开(名字可以随便起)

@book{Lamport1994,
     title = {{\LaTeX:} A Document Preparation System},
     author = {Leslie Lamport},
     publisher = {Addison-Wesley},
     address = {Reading, Massachusetts},
     year = {1994},
     edition = {2nd} }                           #存储在x.bib文件中

接着在tex文件里引用就好了

\documentclass{article}
\bibliographystyle{plain}
\begin{document}
\section{Some words} Some excellent books, for example, \cite{Lamport1994} and \cite{Mittelbach2004} \ldots
\bibliography{x}
\end{document}

4、页眉页脚

(1)修改页眉页脚样式
\pagestyle{⟨page-style⟩} ——-全文
\thispagestyle{⟨page-style⟩} —–本页

(2)利用宏包fancyhdr

\documentclass{article}
\usepackage{fancyhdr}    %引用扩展包
\pagestyle{fancy}          %设置样式
\lhead{}                         %设置为空(可以不写)
\chead{}
\rhead{\bfseries The performance of new graduates}
\lfoot{From: K. Grant}
\cfoot{To: Dean A. Smith}
\rfoot{\thepage}
\renewcommand{\headrulewidth}{0.4pt}    %设置线宽
\renewcommand{\footrulewidth}{0.4pt}
......
\begin{document}
......
\end{document}

5、页面设置

\usepackage[hmargin=1.25in,vmargin=1in]{geometry}
#上下边距1英寸,左右边距1.25英寸

#需要设定周围的边距一致为 1.25 英寸,可以用更简单的语法:
\usepackage[margin=1.25in]{geometry}

6、段落格式

#以下长度分别为段落的左缩进、右缩进和首行缩进:
\setlength{\leftskip}{20pt}
\setlength{\rightskip}{20pt}
\setlength{\parindent}{2em}
#如果你在某一段 不想使用缩进,可使用某一段开头使用
\noindent

7、字体

(1)全局字体大小

\documentclass[10pt]{article}   %确定全局字体大小磅数,10/11/12三个选项

(2)局部字体大小

He likes {\LARGE large and {\small small} letters}

(3)字体粗细

\textmd{Medium Series}
\textbf{Boldface Series}  //加粗

(4)字体形状

\textup{Upright Shape}
\textit{Italic Shape}
\textsl{Slanted Shape}
\textsc{Small Caps Shape}

(5)字体(基本是拼音)

 {\songti 宋体} \quad {\heiti 黑体} \quad {\fangsong 仿宋} \quad {\kaishu 楷书}\quad
 {\youyuan 幼圆}{\youyuan 幼圆}

8、公式(比较重要的一个了)

(1)行内公式

$a^2 + b^2 = c^2$

(2)行间公式(带编号)

\begin{equation}
a^2 + b^2 = c^2
\end{equation}

(3)行间公式(不带编号)

#写法一
\begin{equation*}
 a^2 + b^2 = c^2
\end{equation*}

#写法二
\[ a^2 + b^2 = c^2 \]

以上都是比较常用的指令啦,至于一些符号书写、分数指数等书写,可以查阅这份资料
lshort

猜你喜欢

转载自blog.csdn.net/xjm850552586/article/details/79594210
今日推荐