版权声明:本文为博主皮皮http://blog.csdn.net/pipisorry原创文章,未经博主允许不得转载。                        https://blog.csdn.net/pipisorry/article/details/54571521                    </div><link rel="stylesheet" href="https://csdnimg.cn/release/phoenix/template/css/ck_htmledit_views-cd6c485e8b.css"><link rel="stylesheet" href="https://csdnimg.cn/release/phoenix/template/css/ck_htmledit_views-cd6c485e8b.css"><div class="htmledit_views" id="content_views"><p>http://<a href="http://blog.csdn.net/pipisorry/article/details/54571521" rel="nofollow">blog.csdn.net/pipisorry/article/details/54571521</a><br></p><p>总的来说,LaTex是一套排版系统,与word那种所见即所得对排版方式不太,用LaTex排版更像是写程序一样,将想要的排版效果用指令写出来,再通过LaTex编译成文档。简单来说,你只要按照要求撰写tex文件,就能够通过LaTex生成排版好的pdf文件。<br>有些人可能听到写程序就头大了,其实使用命令来排版的好处正是我们可以将各种版式做成模板文件,使用者只要调用模板即可,完全不用去处理字体样大小、位置,目录生成,图片公式序号等诸多细节,使我们专注于内容。更多关于LaTex和word的比较<a href="http://zzg34b.w3.c361.com/homepage/compareWord.htm" rel="nofollow">这篇文章</a>有很详细的论述。</p><p>LaTex也是可以用来做简历,PPT等文档的。<a href="http://blog.csdn.net/pipisorry" rel="nofollow"><br></a></p><p><a href="http://blog.csdn.net/pipisorry" rel="nofollow">皮皮blog</a></p><p><br></p><p><br></p><h1><a name="t0"></a>入门教程</h1><p>LaTeX文件的通常语法如下:</p><p align="left">\documentstyle{article}</p><p>\begin{document}</p><p>This is a first example of a simple inputfile.</p><p>\end{document}</p><p>如果是中文,将\documentstyle{article}改为\documentstyle{carticle}</p><h2><a name="t1"></a>简单的规则</h2><p>(1)空格:Latex中空格不起作用。<br>(2)换行:用控制命令“\\”,或“ \newline”.<br>(3)分段:用控制命令“\par” 或空出一行。<br>(4)换页:用控制命令“\newpage”或“\clearpage”<br>(5)特殊控制字符:#,$, %, &amp;, - ,{, }, ^, ~<br></p><h3><a name="t2"></a>西文字符转换表</h3><p>\rm&nbsp;&nbsp; 罗马字体&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \it&nbsp;&nbsp;&nbsp;&nbsp; 意大利字体<br>\bf&nbsp;&nbsp; 黑体&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \sl&nbsp;&nbsp;&nbsp;&nbsp; 倾斜体<br>\sf&nbsp;&nbsp; 等线体&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \sc&nbsp;&nbsp;&nbsp;&nbsp; 小体大写字母<br>\tt&nbsp;&nbsp;&nbsp; 打字机字体&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \mit&nbsp;&nbsp;&nbsp;&nbsp; 数学斜体</p><h3><a name="t3"></a>纵向固定间距控制命令</h3><p>\smallskip&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \medskip&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \bigskip<br></p><h3><a name="t4"></a>页面控制命令</h3><p>\textwidth=14.5cm<br>\textheight=21.5cm<br>系统默认:字号10pt= 五号字;西文字体为罗马字体;textwidth=12.2cm,textheight=18.6cm。相当于美国标准信纸大小。<br></p><h2><a name="t5"></a>中英文LaTeX模板</h2><p>(1)下面给出的是中文LaTeX2e模板,此时文件的扩展名为.ctx。模板中%后面的中文是中文注解,读者可以阅读这些模板中的中文注解,以理解所涉及的LaTeX2e命令的含义。</p><p>\documentclass[11pt]{ccart}%文件类说明</p><p>%还可以选择的类是cctbook</p><p>\setlength{\parindent}{12pt}%自然段第一行的缩进量为12pt</p><p>\setlength{\parskip}{10pt plus1ptminus1pt}</p><p>%自然段之间的距离为10pt,并可在8pt到11pt之间变化</p><p>\setlength{\baselineskip}{8pt plus2ptminus1pt}</p><p>%行间距为8pt,并可在7pt到10pt之间变化</p><p>\setlength{\textheight}{21truecm}%版面高为21厘米</p><p>\setlength{\textwidth}{14.5truecm}%版面宽为14.5厘米</p><p>\begin{document}%正文开始</p><p>\title{Thesis}%文章标题,双反斜杠\\表示换行</p><p>\author{author\\Dept. of Math.}</p><p>%作者名,单位,通信地址等,双反斜杠\\表示换行</p><p>\date{2003/8/5}</p><p>%文章写作日期,如果省略此行,计算机日期作为写作日期</p><p>\maketitle%建立标题部分</p><p><strong>%文章的正文输入</strong></p><p>\begin{center}%参考文献的书写</p><p>{\heiti&nbsp;&nbsp;参考文献}</p><p>\end{center}</p><p>\vskip 0.1cm</p><p>\def\hang{\hangindent\parindent}</p><p>\def\textindent#1{\indent\llap{#1\enspace}\ignorespaces}</p><p>\def\re{\par\hang\textindent}</p><p>\re{[1]} Nordhaus E,Stewart B,WhiteA.On theMaximum Genus of a Graph.{\it J.combinatorial TheoryB},1971,11:258-267&nbsp;&nbsp;</p><p>\re{[2]} Skoviera M.The Maximum Genus of Graphsof Diameter Two.{\it Discrete Math}.1991, 87:175-180</p><p>\end{document}%源文件的结束</p><h2><a name="t6"></a>英文LaTeX2e模板</h2><p>\documentclass[11pt]{article}%文件类说明</p><p>%还可以选择的类是book,report</p><p>\setlength{\parindent}{12pt}%自然段第一行的缩进量为12pt</p><p>\setlength{\parskip}{10pt plus1ptminus1pt}</p><p>%自然段之间的距离为10pt,并可在8pt到11pt之间变化</p><p>\setlength{\baselineskip}{8pt plus2ptminus1pt}</p><p>%行间距为8pt,并可在7pt到10pt之间变化</p><p>\setlength{\textheight}{21truecm}%版面高为21厘米</p><p>\setlength{\textwidth}{14.5truecm}%版面宽为14.5厘米</p><p>\begin{document}%正文开始</p><p>\title{Thesis}%文章标题,双反斜杠\\表示换行</p><p>\author{author\\Dept. of Math.}</p><p>%作者名,单位,通信地址等,双反斜杠\\表示换行</p><p>\date{2003/8/5}</p><p>%文章写作日期,如果省略此行,计算机日期作为写作日期</p><p>\maketitle%建立标题部分</p><p><strong>%文章的正文输入</strong></p><p>\section{Introduction}%第一节引言(机器自动编号)</p><p>{\bf Theorem 1.} {\it For any fixed $\rho&gt;0$,we have</p><p>$$||R(u,\rho)||\leq ||R_1(u,\rho)||\leq2||R(u,\rho)||,~~~\forall u\in H.</p><p>\eqno(10)$$ Hence, (2) and (3) are equivalent forany fixed$\rho&gt;0$.}</p><p><strong>%一般定理的写法</strong></p><p>{\bf Proof.}</p><p>\begin{thebibliography}{99}</p><p>\bibitem{Kind} D. Kinderlehrer and G.Stampacchia, {\it An Introduction to</p><p>Variational Inequalities and Their Applications},Academic Press,New York, (1980).</p><p>\end{thebibliography}%参考文献</p><p>\end{document}%源文件的结束</p>[<a href="http://blog.sina.com.cn/s/blog_4b6a68ac010007c1.html" rel="nofollow">LaTex基本语法</a>]<br><h2><a name="t7"></a>入门示例<br></h2><h3><a name="t8"></a><span>helloworld.tex</span></h3>\documentclass{article}<br>%这里是导言区<br>\begin{document}<br>Hello, world!<br><p>\end{document}<br></p><p>1</p><p> <span style="color:#33CC00;">\documentclass{article} </span>中包含了一个控制序列(或称命令/标记)。所谓控制序列,是以反斜杠\开头,以第一个空格或非字母 的字符结束的一串文字,他们并不被输出,但是他们会影响输出文档的效果。这里的控制序列是 documentclass,它后面紧跟着的 {article} 代表这个控制序列有一个必要的参数,该参数的值为 article。这个控制序列的作用,是调用名为 “article” 的文档类。</p><p>Note: TeX 对控制序列的大小写是敏感的<br>&nbsp;&nbsp;&nbsp; 部分控制序列还有被方括号[]包括的可选参数。<br>&nbsp;&nbsp;&nbsp; 所谓文档类,即是 TeX 系统预设的(或是用户自定的)一些格式的集合。不同的文档类在输出效果上会有差别。</p><p>\documentclass[options]{<strong>class</strong>}</p><p>article 排版科技期刊、短报告、程序文档、邀请函等。</p><p>report 排版多章节的长报告、短篇的书籍、博士论文等。</p><p>book 排版书籍。</p><p>slides 排版幻灯片。其中使用了较大的sans serif 字体。也可以考虑使用FoilTEX 来得到相同的效果。</p>2<br> TeX 风格的文档中,从 <span style="color:#33CC00;">“%”</span> 开始,到该行末尾的所有字符,都会被 TeX 系统无视,只作为供人类阅读的注释。除非在 “%” 前加上反斜杠来取消这一特性。<br><p>3</p><p>控制序列 begin,这个控制序列总是与 end 成对出现。这两个控制序列以及他们中间的内容被称为「环境」;他们之后的第一个必要参数总是一致的,被称为环境名。</p><p>只有在 “document” 环境中的内容,才会被正常输出到文档中去或是作为控制序列对文档产生影响。也就是说,在 <span style="color:#33CC00;">\end{document} </span>之后插入任何内容都是无效的。</p><p><span style="color:#33CC00;">\begin{document}</span> 与 \documentclass{article} 之间的部分被称为导言区。导言区中的控制序列,通常会影响到整个输出文档。比如,我们通常在导言区设置页面大小、页眉页脚样式、章节标题样式等等。</p><h3><a name="t9"></a>latex目录下产生的文件说明</h3><p>.tex LATEX 或TEX 源文件。可以用latex 处理。</p><p>.sty LATEX 宏包文件。可使用命令\usepackage 将其加载到你的LATEX 文件中。</p><p>.dtx 文档化TEX 文件。这也是LATEX 宏包发布的主要格式。通过处理一个</p><p>.dtx 文件就可以得到该LATEX 宏包中所包括的宏代码文档。</p><p>.ins 为相应的.dtx 文件的安装文件。如果你在网络上下载了一LATEX 宏包,你通常会发现会有一个.dtx 和一个.ins 文件。使用LATEX 对.ins文件进行处理,可以从.dtx 文件中提取出宏包。</p><p>当你运行LATEX 处理你的源文件时,会得到下列文件:</p><p>.dvi 与设备无关文件。这是LATEX 编译运行的主要结果。你可以使用DVI预览器浏览其内容,或者使用像dvips 这样的应用程序输出到打印机。</p><p>.log 记录了上次编译运行时的详细信息。</p><p>.toc 存储了所有章节标题。该文件将在下次编译运行时被读入并生成目录。</p><p>.lof 类似.toc 文件,可生成图形目录。</p><p>.lot 类似.toc 文件,可生成表格目录。</p><p>.aux 另一个用来向下次编译运行传递信息的辅助文件。除了其它信息外,.aux 文件通常包含交叉引用信息。</p><p>.idx 如果你的文件中包含有索引,LATEX 使用此文件存储所有的索引词条。此文件需要使用makeindex 处理。</p><p>.ind 经过处理后的.idx 文件。可在下次编译运行时加入到你的文档中。</p><p>.ilg 运行makeindex 时生成的记录文件。</p><p>[<a title="" href="http://blog.sina.com.cn/s/articlelist_1689008817_10_1.html" rel="nofollow">LaTEX学习笔记</a>]<br></p><h3><a name="t10"></a>latex类文件.cls文件</h3><p>示例awesome-cv.cls<br>&nbsp;&nbsp;&nbsp; awesome-cv的class file,可以在其他latex file中引用,例如在 ./example/resume.tex中:<br>&nbsp;&nbsp;&nbsp; \documentclass[11pt, a4paper]{awesome-cv}<br>&nbsp;&nbsp;&nbsp; 每個class file中都會以以下兩行指令做開頭<br>&nbsp;&nbsp;&nbsp; \NeedsTeXFormat{LaTeX2e}&nbsp;&nbsp;&nbsp; %告訴Compiler此class是用哪一版<br>&nbsp;&nbsp;&nbsp; \ProvidesClass{my_cv}[2011/03/26 My custom CV class]</p><p>Note: Latex中.cls文件和.sty文件的区别和联系:.cls和.sty文件是用来提高LaTeX的排版效果的补充文件。它们分别用命令\documentclass{...}和命令\usepackage{...}来装载到LaTeX文件。.cls文件通常被称为“classes”(也就是“类”),而.sty文件被称为“style files”(样式文件),或者就简单地称其为“packages”(包)。通过命令\documentclass{...}来装载一个类是强制性的,而且在LaTeX文件里可能只出现一次;通常它是第一个命令。不同的是,包是可选的,而且它们可以在需要时随时被装载(不过一定是在正文开头之前)。总而言之,.cls和.sty文件被LaTeX文件装载以提供或改善产生文档的方法。一般而言,类文件实现文档的特定结构,而包包既可以用于提供从属于文档的功能,又可以改变特定的类文件提供的方法的风格。[<span class="link_title"><a href="http://blog.csdn.net/golden1314521/article/details/39252875" rel="nofollow">.cls和.sty文件的作用和区别</a></span>]</p><p>LaTeX 允许你在自己编写的宏包(e.g. .cls文件中)中调用其它宏包,命令为RequirePackage<br></p><h3><a name="t11"></a>宏包</h3><p>所谓宏包,就是一系列控制序列的合集。这些控制序列太常用,以至于人们会觉得每次将他们写在导言区太过繁琐,于是将他们打包放在同一个文件中,成为所谓的宏包(台湾方面称之为「巨集套件」)。<span style="color:#33CC00;">\usepackage{·}</span>可以用来调用宏包。</p><p>在引言中调用。<br></p><p>指定字体\usepackage{times}<br></p><p>package latexsym, which defines all symbols known from the old LaTeX version.</p><h2><a name="t12"></a>组织你的文章</h2><pre>\documentclass[UTF8]{ctexart}

\title{你好,world!}
\author{Liam}
\date{\today}
\begin{document}
\maketitle
你好,world!
\end{document}Note: 这里是用的ctex,改成article也可以,但是不能显示中文了,lz目前不写中文的,所以先不管了。

定义了标题、作者、日期

maketitle这个控制序列能将在导言区中定义的标题、作者、日期 按照预定的格式展现出来。

\documentclass[UTF8]{ctexart}
\title{你好,world!}
\author{Liam}
\date{\today}
\begin{document}
\maketitle
\section{你好中国}
中国在East Asia.
\subsection{Hello Beijing}
北京是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 天安门广场。
\subsection{Hello 山东}
\paragraph{山东大学} is one of the best university in 山东。
\end{document}

插入目录

在上一节的文档中,找到 \maketitle,在它的下面插入控制序列 \tableofcontents

版面设置

页边距

设置页边距,推荐使用 geometry 宏包。可以在这里查看它的说明文档。

比如我希望,将纸张的长度设置为 20cm、宽度设置为 15cm、左边距 1cm、右边距 2cm、上边距 3cm、下边距 4cm,可以在导言区加上这样几行:

\usepackage{geometry}
\geometry{papersize={20cm,15cm}}
\geometry{left=1cm,right=2cm,top=3cm,bottom=4cm}

页眉页脚

设置页眉页脚,推荐使用 fancyhdr 宏包。可以在这里查看它的说明文档。

比如我希望,在页眉左边写上我的名字,中间写上今天的日期,右边写上我的电话;页脚的正中写上页码;页眉和正文之间有一道宽为 0.4pt 的横线分割,可以在导言区加上如下几行:

\usepackage{fancyhdr}
\pagestyle{fancy}
\lhead{\author}
\chead{\date}
\rhead{152xxxxxxxx}
\lfoot{}
\cfoot{\thepage}
\rfoot{}
\renewcommand{\headrulewidth}{0.4pt}
\renewcommand{\headwidth}{\textwidth}
\renewcommand{\footrulewidth}{0pt}

首行缩进

CTeX 宏集已经处理好了首行缩进的问题(自然段前空两格汉字宽度)。

不使用 CTeX 宏集(使用 xeCJK 宏包)的话,请遵照以下提示操作。

中国人写文章,习惯每一段的段首都空出两个中文汉字的长度。美国人没有这个习惯,他们每一小节的段首都顶格。为了解决这个问题,我们可以在导言区调用 \usepackage{indentfirst}.

就算是这样,首行缩进的长度,仍然不符合中国人的习惯。我们可以在导言区添加这样的控制序列 \setlength{\parindent}{\ccwd} 来调整首行缩进的大小。这里的 \ccwd 是当前字号下一个中文汉字的宽度。

行间距

我们可以通过 setspace宏包提供的命令来调整行间距。比如在导言区添加如下内容,可以将行距设置为字号的 1.5 倍:

\usepackage{setspace}
\onehalfspacing

具体可以查看该宏包的文档。

请注意用词的差别:

  • 行距是字号的 1.5 倍;
  • 1.5 倍行距。

事实上,这不是设置 1.5 倍行距的正确方法,请参考:http://liam0205.me/2013/10/17/LaTeX-Linespace/

段间距

我们可以通过修改长度 \parskip 的值来调整段间距。例如在导言区添加以下内容

\addtolength{\parskip}{.4em}

则可以在原有的基础上,增加段间距 0.4em。如果需要减小段间距,只需将该数值改为负值即可。

Latex进阶分述

4 字体Fonts

somewords {\it somewords} somewords
\bf 黑体字;粗体铅字
\it Italics
\tt    Typewriter (monospace, fixed-width).打字型印刷铅字

\emph    Although it also changes fonts, the \emph{text} commandis semantic, for text to be emphasized, and should not be used as asubstitute for \textit. For example, \emph{starttext \emph{middle text} end text} will result in thestart text and end text in italics, but middle textwill be in roman.

The \em command is the unconditional version of \emph.

。。。

字体颜色

(如用于批改)

{\color{red}{[??]}}

数学字体

The following commands are for use in math mode. They are not cumulative, so \mathbf{\mathit{symbol}} does not create a boldface and italic symbol; instead, it will just be in italics. This is because typically math symbols need consistent typographic treatment, regardless of the surrounding environment.
\mathrm
    Roman, for use in math mode.
\mathbf
    Boldface, for use in math mode.
\mathsf
    Sans serif, for use in math mode.
\mathtt
    Typewriter, for use in math mode.
\mathit
(\mit)
    Italics, for use in math mode.
\mathnormal
    For use in math mode, e.g., inside another type style declaration.
\mathcal 书法字体
    Calligraphic letters, for use in math mode.  Note: 大写字母才有书法字体,小写的是无效的。

字母大小写转换(pipi add)

\MakeUppercase{abc} ABC

\MakeLowercase

首字母大写(只能对第一个有效)
\usepackage{stringstrings}

\capitalize{abc abc} Abc abc

整个字符串所有单词首字母大写

。。。有点复杂没写

google: latex uppercase the first letter of each word in a sentence

字体大小设置(正文和图表通用)

The standard classes, article, report and book support 3 different font sizes, 10pt, 11pt, 12pt (by default 10pt). The font size is set through the optional argument, e.g.:

\documentclass[12pt]{report}

use the extsizes package. It allows for the following font sizes: 8pt, 9pt, 10pt, 11pt, 12pt, 14pt, 17pt, 20pt.
%Article
\documentclass[9pt]{extarticle}
%Report
\documentclass[14pt]{extreport}

[Changing the font size in LaTeX]

局部改变字号

\fontsize{字体尺寸}{行距},只有使用\selectfont命令之后,\fontzize{}{}的设置才能生效。

\fontsize{10pt}{12pt}\selectfont 这样后面的字体都变成10pt大小了。

使用给定字号:字号转换命令表

点数(pt)            相应中文字号            控制命令
25                      一号                 \Huge
20                      二号                 \huge
17                      三号                 \LARGE
14                      四号                 \Large
12                      小四号               \large
10                      五号                 \normalsize(default)
9                       小五号               \small
8                       六号                 \footnotesize
7                       小六号               \scriptsize
5                       七号                 \tiny

中文字体

执行fc-list:lang=zh-cn命令查询简体中文的字体。同理查询繁体中文字体可以用fc-list:lang=zh-tw命令,查询日语字体可以用fc-list:lang=ja。

lz列出常用的几个示例:

SimSun,宋体:style=Regular,常规
KaiTi,楷体:style=Regular,Normal,obyčejné,Standard,Κανονικά,Normaali,Normál,Normale,Standa
STXingkai,华文行楷:style=Regular
Microsoft YaHei,微软雅黑,Microsoft YaHei Light,微软雅黑 Light:style=Light,Regular
Microsoft YaHei,微软雅黑:style=Regular,Normal,obyčejné,Standard,Κανονικά,Normaali,Normál,Normale,Standaard,Normalny,Обычный,Normálne,Navadno,Arrunta
YouYuan,幼圆:style=Regular
FangSong,仿宋:style=Regular,Normal,obyčejné,Standard,Κανονικά,Normaali,Normál,Normale,Standaard,Normalny,Обычный,Normálne,Navadno,Arrunta
SimHei,黑体:style=Regular,Normal,obyčejné,Standard,Κανονικά,Normaali,Normál,Normale,Standaard,Normalny,Обычный,Normálne,Navadno,Arrunta
NSimSun,新宋体:style=Regular,常规

/usr/share/fonts/方正兰亭黑.TTF: FZLanTingHeiS-R-GB,方正兰亭黑简体:style=Regular

方式1

linux latex 中文不显示

解决:使用xelatex编译(否则可能直接报错,而不是不显示中文了)

且加入

\usepackage{fontspec}
\setmainfont{SimSun} %宋体

就可以显示中文了

方式2

%使用支持汉字的CJK包
\usepackage{CJK}
%开始CJK环境,只有在这句话之后,你才能使用汉字。另外,如果在Linux下,请将文件的编码格式设置成GBK,否则会显示乱码。
\begin{CJK*}{GBK}{song}

[latex 中文字体]

加粗或加斜某几个中文

使用\bf或者\textbf加粗中文无效果。

西文的习惯是使用加粗、倾斜、花体等来强调内容,而汉语的习惯则是使用不同的字形来强调内容。所以,一般的建议都是将粗宋体改用黑体,斜体之类的也改用仿宋、圆体之类的表示。

比如lz使用微软雅黑代替中文加粗:\fontspec{Microsoft YaHei}\selectfont{求职意向:大数据算法工程师}

最好自定义一下:\newcommand{\yahei}[1]{\fontspec{Microsoft YaHei}\selectfont{#1}}    使用\yahei{求职意向:大数据算法工程师}

[fontspec 宏包]

Latex同时设置中英文字体

中文标题+中文正文+英文字体:

  1. 中易宋体加粗+中易宋体+Calibri  (中易宋体即 Windows 自带的宋体)
  2. 中易黑体+中易宋体+Calibri(无法使用PDF时首选)
  3. 华文细黑+华文细黑+Calibri(兼顾打印及分享,Office2013+MacOS自带)
  4. 方正兰亭黑+方正兰亭黑+Calibri (中文标题及正文使用华文细黑(Word文档)、方正兰亭黑(PDF文档))

[中文简历用什么字体会比较好?]

\RequirePackage{xeCJK} % 使用xeCJK宏包
\setCJKmainfont{方正兰亭黑简体}   % 设置缺省中文字体
\setmainfont{Calibri} % 如不指定,使用Tex的默认英文字体

中文标题lz使用的是方正兰亭粗黑简体

使用包xeCJK后,随时设置字体命令\fontspec会无效,要使用\CJKfontspec代替。

[Latex中英文环境设置]

6 分节Sectioning

\part
\chapter
    (report and book class only)
\section
\subsection

Note: \section*{Acknowledgments},标题不带number

\subsubsection
\paragraph
\subparagraph

附录appendix

The \appendix command changes the way following sectional unitsare numbered. The \appendix command itself generates no textand does not affect the numbering of parts. The normal use of thiscommand is something like

\chapter{A Chapter}
…
\appendix
\chapter{The First Appendix}

修改Latex默认section,subsection样式

设置section字体为微软雅黑及其它设置说明

\newcommand{\yahei}[1]{\fontspec{Microsoft YaHei}\selectfont{#1}}
\titleformat{\section}         % Customise the \section command
  {\Large\scshape\raggedright\yahei} % Make the \section headers large (\Large),
                               % small capitals (\scshape) and left aligned (\raggedright)
  {}{0em}                      % Can be used to give a prefix to all sections, like ‘Section …’
  {}                           % Can be used to insert code before the heading
  [\titlerule]                 % Inserts a horizontal line after the heading
\titlespacing*{\section}{0cm}{*1.8}{*1.8}

section可选参数

\section[short title]{long title}

7 交叉引用Cross references

• \label:          Assign a symbolic name to a piece of text.

一般定义的方式最好如下:

ch for chapters

sec for lower-level sectioning commands

fig for figures

tab for tables

eq for equations

• \pageref:          Refer to a page number.
• \ref:          Refer to a section, figure or similar.

对公式的引用建议使用\eqref,这样会在公式引用自动添加()。

\label{stylefiles} #定义

?????? #引用

8 环境Environment

8.1 Latex图片figure处理

<span class=“hljs-keyword”>begin{figure}[placement]
figure body
\caption[loftitle]{title}
<span class=“hljs-keyword”>label{label}
<span class=“hljs-keyword”>end{figure}
or

<span class=“hljs-keyword”>begin{figure*}…<span class=“hljs-keyword”>end{figure*}

示例

\usepackage{graphicx}
<span class=“hljs-keyword”>begin{figure}[!t]
\centering
%    \small
\includegraphics[width=1\linewidth]{./figures/compare1}
%    \vspace{-3mm}
\caption{figure caption}
%todo
%    \vspace{-5mm}
<span class=“hljs-keyword”>label{fig:compare1}

<span class=“hljs-keyword”>end{figure}
多图的插入

<span class=“hljs-keyword”>begin{figure}[!htbp]
\centering
<span class=“hljs-keyword”>begin{subfigure}[b]{0.45\textwidth}
\includegraphics[width=\textwidth]{oaspl_a}
\caption{}
<span class=“hljs-keyword”>label{fig:oaspl_a}
<span class=“hljs-keyword”>end{subfigure}%
~%add desired spacing
<span class=“hljs-keyword”>begin{subfigure}[b]{0.45\textwidth}
\includegraphics[width=\textwidth]{oaspl_b}
\caption{}
<span class=“hljs-keyword”>label{fig:oaspl_b}
<span class=“hljs-keyword”>end{subfigure}
\caption{。(a)AAA,(b)BBB}
<span class=“hljs-keyword”>label{fig:oaspl}
<span class=“hljs-keyword”>end{figure}

1 插入双栏图片时需在figure的上标中加入符号

\begin{figure}…\end{figure}\begin{figure*}…\end{figure*}

Note: 这个没有研究过,感觉可用于图片插入,以后再研究。

8.20 引用quotation and quote

\begin{quotation}
text
\end{quotation}

or

\begin{quote}
text
\end{quote}

8.24 参考文献bibliography

使用BibTeX管理参考文献

%% The file named.bst is a bibliography style file for BibTeX 0.99c
\bibliographystyle{named}
\bibliography{ijcai17}

ijcai17.bib内容:

@article{ gottlob:nonmon,
  author = “Georg Gottlob”,
  title = “Complexity results for nonmonotonic logics”,
  journal = “Journal of Logic and Computation”,
  volume = “2”,
  number = “3”,
  pages = “397–425”,
  month = “June”,
  year = “1992”
}

Note: @article{ gottlob:nonmon…中的gottlob首字母必须小写,否则引用可以失败。

简写

编写bib文件时,若要使用一个简写来代替很长的字符串,可以使用
@string(Abbrv=“Long string”)
比如: @string(TIT=“IEEE Trans. Inf. Theory”)
这样在条目中,journal=TIT等价于journal={IEEE Trans. Inf. Theory}
注意使用简写的时候不要加大括号,大括号的作用是防止latex对内容做处理,比如在title中有些简写是需要大写的,为防止在参考文献列表中把这些简写变成小写字母,可以在简写两边加上大括号。

正文中引用参考文献 \cite[subcite]{keys}
The keys argument is a list of one or more citation keys, separated by commas. This command generates an in-text citation to the references associated with keys by entries in the .aux file. The text of the optional subcite argument appears after the citation. For example, \cite[p.~314]{knuth} might produce ‘[Knuth, p. 314]’.

\nocite:  Include an item in the bibliography.The \nocite command produces no text, but writes keys,which is a list of one or more citation keys, to the .aux file.若要把没引用的文档列入参考文献,用\nocite{}。\nocite{}列入所有bib文件中的文献。\nocite{}命令是写在.tex文件中而不是.bib文件。

Note: key一般取一作的姓和标题的一个词。The key is a short reference you invent to uniquely identify each work; in this sample document, the key is the first author’s surname and a word from the title.

示例

Gottlob~\shortcite{gottlob:nonmon} has shown that, rather than, In our previous work~\cite{gottlob:nonmon}

Gottlob [1992] has shown that, rather than, In our  previous work [Gottlob, 1992]

单作:[Gottlob, 1992] 或者Nebel [2000](很容易看出来时)

二作:[Brachman and Schmolze, 1985]

多作:[Baumgartner et al., 2001]

多篇引用使用,隔开:[Gott-

lob et al., 2002; Levesque, 1984a]

latex代码:\cite{gls:hypertrees,levesque:functional-foundations}

引用作者\citeauthor

如同时引用作者和文献 Early,\citeauthor{eagle2009inferring}\cite{eagle2009inferring} examined the communications

结果Early, Eagle et al. [6] examined the communications

注意\citeauthor是由包\usepackage{natbib}提供,否则出错。

其它包中添加这种行为:

\documentclass{article}
\usepackage{natbib}
\begin{document}
\citeauthor{lamport94}

\citet{lamport94}

\begin{thebibliography}{9}
\bibitem[Lamport (1994)]{lamport94}Leslie Lamport, \emph{\LaTeX:
A Document Preparation System}. Addison Wesley, Massachusetts,
2nd Edition, 1994.
\end{thebibliography}
\end{document}[Problem displaying author in citation when using natbib’s \citeauthor command]

11 脚注Footnotes

\footnote

\footnote[number]{text}

LaTeX 提供了 \pagestyle 命令让我们可以文档所有页面的样式 (包括页边距, 页眉和页脚等内容); 同时, 还提供了 \pagenumbering 来设置页码的显示格式. LaTeX 提供了四种不同的页面样式:

  • \pagestyle{empty} 设置页面的样式为没有页眉和页脚.
  • \pagestyle{plain} 设置页面的样式为没有页眉, 页脚中间是页码.
  • \pagestyle{headings} 设置页面的样式为没有页脚, 页眉显章节标题和页码.
  • \pagestyle{myheadings} 设置页面的样式为没有页脚, 页眉中显示用户提供的内容.

页眉页脚注释包fancyhdr 宏包

设置没有页眉,页脚居中显示自定义字符串

\usepackage{fancyhdr}
\renewcommand{\headrulewidth}{0.0pt}  #去除页眉的横线bar
\pagestyle{fancy}
\fancyhf{} %\fancyhead{} #去除页眉内容
\cfoot{Passion in my heart, Dynamic in my body!}  #设置页脚居中字符串

[How to remove the top horizontal bar in fancyhdr?]

[fancyhdr 宏包]

12 定义Definitions

\newcommand & \renewcommand

\newcommand and \renewcommand define and redefine a command, respectively.

使用\newcommand可以自己定制命令
语法格式 \newcommand{\yourcommand}[参数个数]{内容}
比如:\newcommand{\wuhao}{\fontsize{10.5pt}{10.5pt}\selectfont}用来定义一个选定字号命令

Here’s a command definition that uses arguments:
\newcommand{\defreference}[1]{Definition~??????

[LaTeX/Algorithms 伪代码] [Latex 建立带有竖线和编号的算法环境]

皮皮blog

附录

常用的长度单位说明

(如用在p{列宽}中)

绝对定位则是固定尺寸,它们采用的是物理度量单位:cm、mm、in、px、pt以及pc。

但在实际应用中,我们使用最广泛的则是em、rem、px以及百分比(%)来度量页面元素的尺寸。

  1. px:为像素单位。它是显示屏上显示的每一个小点,为显示的最小单位。它是一个绝对尺寸单位;
  2. em:它是描述相对于应用在当前元素的字体尺寸,所以它也是相对长度单位。一般浏览器字体大小默认为16px,则2em == 32px;
  3. %: 百分比,它是一个更纯粹的相对长度单位。它描述的是相对于父元素的百分比值。如50%,则为父元素的一半。
  4. 长度的说明:

    • in - 英寸(inch)( (http://latex.yo2.cn) , 白色印记.)
    • mm - 毫米(millimeters)
    • cm - 厘米(centimeters)
    • pt - points (大约 1/72 inch)
    • em - 接近当前字体的字符 "M"的宽度(approximately the width of an “M” in the current font)
    • ex - 接近当前字体的字符 "x"的高度approximately the height of an “x” in the current font

[ CSS尺寸和字体单位-em、px还是%]

Latex宏定义

定义 \def\FRAMEWORK{online-offline unified framework}

引用 we introduce the {\it \FRAMEWORK}~ which can

[TeX 的宏]

写作注意事项

文件名   {\tt ijcai17.sty}

链接名  {\tt http://www.ijcai-17.org/}

not强调  {\em not}

问题:

bib文件中的{Lixto}代表什么意思?

from: http://blog.csdn.net/pipisorry/article/details/54571521

ref: [A simple guide to LaTeX]
[使用LaTex写毕业论][一份其实很短的 LaTeX 入门文档][始终:LaTeX 分类][lshort: http://ctan.mirror.rafal.ca/info/lshort/english/lshort.pdf]

[LATEX与论文写作]

[Ctex社区:LaTeX 文档 [LaTeX 2e 插图指南(中文)]

[LaTeX Tutorials: A Primer http://www.tug.org/twg/mactex/tutorials/ltxprimer-1.0.pdf]

[LaTeX Beginner’s Guide]

[texstudio help: LaTeX2e unofficial reference manual (October 2015)]

[lshort-zh-cn.pdf]

[LaTeX简介:入门文档 huangxg 的 LaTeX Notes]

[Beginning LaTeX]

[一个完整的论文写作LaTeX模板]

[在 LaTeX 学术论文写作中有哪些经验和技巧?]

[ChinaTeX 论坛: 论坛 - ChinaTeX论坛]

[wikipedia en.wikibooks.org/wiki/LaTeX/Absolute_Beginners]

[知乎:关于 LaTeX 有什么推荐的说明教程、指南一类的资料?]

[SCI英文论文写作- Latex 进阶]

[LaTeX_Fun的博客]

【转】Latex入门教程相关推荐

  1. LaTeX入门教程 Elseiver模板使用

    LaTeX入门教程 & Elseiver模板使用 背景     最近准备向Elseiver期刊投稿,而官网仅提供了LaTeX写作模板,虽然内心有一万个不愿意使用LaTex(是的-我不会用==) ...

  2. Latex入门教程用法笔记(结尾附完整示例)

    以下是我在Latex使用过程中用到的一些语法,可能不是很全面,但是足够我使用了.有说错的地方还请大家谅解,在评论区多多指正-下面分为几个部分说明(注意导入所需要的包!可参照文章末尾完整示例里的用法) ...

  3. LaTeX入门教程|自定义论文标题

    用LaTeX写论文的同学肯定有感悟:LaTeX自带的一级标题.二级标题不符合学校的格式要求怎么办?部分小结的编号里需要加一些固定词语.分隔符.居中或者字体变换,再或者是斜体等等.手动在每一个小节标题的 ...

  4. LaTex入门教程-中文版-免费下载.pdf

    点击下载 latex排版学习笔记.pdf https://pan.baidu.com/s/1hcqmxahM-khdN5q0H57KDQ 提取码: g1cz

  5. Latex入门基础教程(一)安装TeX Live

    Latex入门教程(一)安装TeX Live 前言 TeX & LaTeX 安装TeX Live 下载镜像 安装 启动 前言 LATEX(发音为LAY-tek或LAH-tek)是一种用于创建具 ...

  6. 【tools】Latex菜鸟快速入门教程(基于overleaf平台:Learn LaTeX in 30 minutes)

    [tools]Latex菜鸟快速入门教程(基于overleaf平台) 注册登录overleaf LaTeX入门教程 1.First start 2.序言Preamble 3.添加标题.作者和日期 4. ...

  7. Latex新人入门教程

    Latex新人入门教程转载自http://blog.sina.com.cn/s/blog_90444ed201016iq6.html.很好的一个latex入门教程,可以收藏起来. 另外加一些提示,如果 ...

  8. 学术写作利器——LaTeX入门笔记整理(不定期更新,附加使用心得)

    LaTeX入门教程(上) 比Word更适合学术写作的编纂语言 Credit:讲座是敝系的几个技术宅办的,作者只负责记录和整理.后面的更新是个人心得. 写这篇日志的初衷是小圈子分享和个人心得记录,适合完 ...

  9. 【LaTeX】E喵的LaTeX新手入门教程(4)图表

    这里说的不是用LaTeX画图,而是插入已经画好的图片..想看画图可以把滚动条拉到底.前情回顾[LaTeX]E喵的LaTeX新手入门教程(1)准备篇  [LaTeX]E喵的LaTeX新手入门教程(2)基 ...

  10. 【LaTeX】E喵的LaTeX新手入门教程(6)中文

    假期玩得有点凶 ._.前情回顾[LaTeX]E喵的LaTeX新手入门教程(1)准备篇  [LaTeX]E喵的LaTeX新手入门教程(2)基础排版  [LaTeX]E喵的LaTeX新手入门教程(3)数学 ...

最新文章

  1. 2019年最新十篇「深度学习领域综述」论文
  2. python3 数据库操作 orm sqlalchemy 简介
  3. [IIS] [PHP] 500.19 随机出现
  4. c++11 变长参数的使用(制作一个多参数多类型求和函数)
  5. mysql 字符集测试_MySQL多字符集备份恢复测试
  6. STM32:UART中的硬件流控RTS与CTS
  7. yarn在vscode里启动报错
  8. delphi remobjects
  9. OpenCV之图像二值化与去噪
  10. 高通9008刷机大法,避坑指南,救砖前提
  11. idea 调节背景护眼_IDEA 护眼色设置 背景行颜色取消等设置
  12. 约翰诺依曼在1940年发明了计算机英语,冯诺依曼元胞自动机
  13. c语言实现审查元素,如何删除qq空间说说?一键自动删除QQ空间说说审查元素代码分享(超简单)...
  14. 阿里云主机泄露Access Key到getshell
  15. pic16f1829 c语言,PIC16F1829 TIMER2初始化程序及应用
  16. Zabbix部署(参考官方文档)
  17. sql查询电话号敏感数据加* 的写法
  18. 「MoreThanJava」一文了解二进制和CPU工作原理
  19. python之getattr()函数
  20. pip全局设置镜像源

热门文章

  1. Flutter29,毕向东java基础全套视频教程百度网盘
  2. 虎牙服务器升级维护中 请留意公告,魔渊之刃像素危城系列活动上线-更新公告1月21日...
  3. 测井储层参数预测+人工智能方法
  4. Java计算机毕业设计单车商城源码+系统+数据库+lw文档
  5. krc 编辑 linux,krc文件怎么打开?krc是什么文件?
  6. 开源网络爬虫程序(spider)一览
  7. 计算机网络应用基础的题,计算机网络应用基础试题
  8. CSDN认证博客专家申请通过,感动,欣慰,分享一下我的经验!
  9. 【零经验】游戏制作全流程攻略(Unity、个人开发、找工作)
  10. c语言蜂鸣器放音乐程序,单片机蜂鸣器C语言程序