Latex常用命令(欢迎查阅)

之前使用过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

  • 3
    点赞
  • 29
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
LaTeX 中,参考文献的常用格式是使用 BibTeX 或 BibLaTeX 进行管理和引用。下面是一个示例,展示如何在 LaTeX 中使用 BibTeX 进行参考文献的引用和格式化。 1. 首先,创建一个名为 "references.bib" 的 BibTeX 文件,并在其中添加参考文献条目。每个条目都有一个唯一的标识符(例如,"Smith2010")和一些字段(例如,作者、标题、出版日期等)。下面是一个示例条目: ``` @article{Smith2010, author = {John Smith}, title = {A comprehensive study on LaTeX}, journal = {Journal of LaTeX}, year = {2010}, volume = {1}, number = {1}, pages = {1-10} } ``` 2. 在 LaTeX 文档的合适位置,使用 `\bibliography{references}` 命令指定参考文献文件的名称(不需要扩展名)。 3. 在需要引用参考文献的地方,使用 `\cite{标识符}` 命令引用对应的参考文献。可以使用多个标识符,并用逗号分隔。 4. 最后,使用 `\bibliographystyle{样式}` 命令指定参考文献的格式样式。常见的样式包括 `plain`、`abbrv`、`unsrt` 等。 下面是一个完整的示例: ```latex \documentclass{article} \begin{document} This is a citation example \cite{Smith2010}. \bibliographystyle{plain} \bibliography{references} \end{document} ``` 编译该 LaTeX 文档时,需要按照以下顺序运行命令: ``` pdflatex document.tex bibtex document pdflatex document.tex pdflatex document.tex ``` 其中,"document.tex" 是你的 LaTeX 文件名。这样,引用将会被正确地插入到文档中,并生成符合样式要求的参考文献列表。 希望这个示例能帮助到你!如果需要更多细节或其他样式,可以查阅相关文献或在线资源。
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值