分享

LaTeX常见问题集(转载)

 gm360 2014-01-12

Latex常见问题集

如何设置标题和副标题

\title{Introduction to \LaTeX{ } Symbols and Commands \\ [2ex] \begin{large} Common Expressions in \emph{AURORA} \end{large} }

通过换行符号\\,分开主标题和副标题,然后设置缩进位置2个X的位置,最后用一个局部环境设置副标题的字体大小。

There are two basic ways to change font sizes in Latex:

- To change the basic font size used all the way through your paper, put either
  "11pt" or "12pt" in your \documentclass line.  For example, if you had:

 \documentclass{report}   but you wanted to use 12pt type (10pt is the default), you would change it
  to:

 \documentclass[12pt]{report} NOTE:  12pt is an option to the "report" class, not a separate
package, so doing
 \documentclass{report}
 \usepackage{12pt}
will *not* work.   

- To change just a part of your paper into a different font size, you can use
  some of the sizing environments.  In increasing size, they are:

 \tiny
 \scriptsize
 \footnotesize
 \small
 \normalsize
 \large
 \Large
 \LARGE
 \huge
 \Huge   The case is important in these commands.  Also, in some document styles,
  some of these commands may produce the same size font.  For example, if you
  wanted to just make a small part of your text in a different font, you would
  use something like:

 This is in normal text, while these words are in {\large large text}.   Or, if you wanted to put a larger region in a different size, you'd use
  something like:

 \begin{small}
 this will all be in small text
 this too.
 etc..
 \end{small}
 
 
 
Latex中数学常用符号的输入  1、数学符号的重叠显示,用于变量上面斜杠 $\rlap{$\backslash$} a  $ $\rlap{$\setminus$} a  $ $\diagdown \llap{a}   $   2、在箭头上方/下方写字 $ u(x) \overset{\text{UMP}}{\Longrightarrow} x(p,w) $ \$ u(x) \underset{\text{UMP}}{\Longrightarrow} x(p,w) $ \$Y  \xrightarrow[\text{ Cost Function }]{\text{Cost Minimization}}  c(w,q) $
在括号上下方写字,用overbrace or underbrace。     f_{X_1,\cdots, X_k}(x_1, \cdots, x_k)=        \overbrace{\int_{-\infty}^{\infty} \cdots \int_{-\infty}^{\infty}}^{n-k}        f(x_1, \cdots, x_k, \xi_{k+1}, \cdots, \xi_{n})        d \xi_{k+1} \cdots d\xi_{n}   3、公式排列 一个短公式写一行, 用equation,(有编号,加*无编号) 一个长公式分几行写,没有对齐功能,用multiline ,(有编号,加*无编号) 一个长公式分几行写,有对齐功能,用split。自身无编号。要编号,外套equation。 一组公式,无对齐功能,用gather。(有编号,加*无编号)  一组公式,有对齐功能,用align。(有编号,加*无编号)       \begin{align*}            a+b & = c+d \           x+y & = c+d       \end{align*} 上述两个公式按照&的位置对齐。如果不加*,则对每个公式进行编号,加了*就不编号。 将一组公式用类似矩阵形式进行排版对齐,用align或 flalign。(有编号,加*无编号)   4、矩阵的输入 利用bmatrix环境,带方括号 \begin{equation} X=\begin{bmatrix}   1 & \cdots & 2 \  2 & \cdots & 3 \end{bmatrix} \end{equation}   利用matrix环境,啥括号都不带 \begin{equation} X=\begin{matrix}   1 & \cdots & 2 \  2 & \cdots & 3 \end{matrix} \end{equation}   利用array环境,自己在括号的地方写,可以用任意括号形式 \begin{align}     E(X)=\left[            \begin{array}{ccc}              E(x_{11}) & \cdots & E(x_{1n}) \             \cdots & \cdots & \cdots \             E(x_{n1}) & \cdots & E(x_{nn}) \           \end{array}          \right]   %如果用“\right.”,那么后面的括号就隐藏了,可以用来表示分段函数。  \end{align}  
常见技巧

1.多个blankspace等于一个blankspace,多个空行(line)等于一个空行,一个空行效果等于另起一段,并不会真正出现一个空行。

2.九大保留字符的输入 # $ % ^ & _ { }      前面加\就可以,如\$ \                    要用命令$\backslash$

3.latex命令的书写要求

$a\pm b___FCKpd___1nbsp; $a\pm3b___FCKpd___1nbsp; 命令\pm后面的空格、数字或者任何非字母的字符都标志着该命令的结束。

如何在命令后产生一个空格:{}可以保护后面的空格。 Get \LaTeX{} Started.

一些命令(\footnote 或\phantom)内嵌于\caption 或\section时会失效,这时加上\protect可以保证不失效。

\section{Higer Order Difference Equations \footnote{See James(2000)}}  %\footnote失效 \section{Higer Order Difference Equations \protect\footnote{See James(2000)}}

注意\protect只保护紧跟其后的命令本身,命令的参数并不受到保护,如果要保护参数,需要在参数前加\protect.其他一些脆弱命令还有:

All commands that have an optional argument are fragile. Environments delimited by \begin ... \end are fragile. Display math environment delimited by \[ ... \] Math environment \( ... \) ,However, $ ... $ is robust Line breaks, \\ . \item commands . \footnote commands .

4.如何打印命令(将程序命令打印出来而不让命令执行) \begin{verbatim} Get \LaTeX{}       Started. \end{verbatim} \verb*|like this :-) |

5.添加程序注释的两种方法

%Get \LaTeX{}              Started. \begin{comment} Get \LaTeX{}       Started. \end{comment} 第二个方法要在导言区添加\usepackage{verbatim}

6.document class有哪些常见类型 article, proc, minimal, report, book, slides

7.页面式样 \pagestyle{plain} \pagestyle{headings} \pagestyle{empty} \thispagestyle{empty}  %将当前页面的式样改为empty.

8.大型文档中插入一些子文档的方法 \include{filename}   %想让插入的子文档在新的一页开始显示; \input{filename} %插入的子文档直接显示,不用新开一页。 \includeonly{file1,file2,file3}  %在导言区使用。只有在此列出的子文档才会在正文中被插入。

9.快速检查语法 \usepackage{syntonly} \syntaxonly

10.分行分页的方法 \\  or  \newline  :另起一行,但不另起一段。 \\* :另起一行,但禁止分页。 \newpage:另起一页。

11.确定单词断点位置 \hyphenation{FORTRAN Hy-phen-a-tion}   %只有在-出现的地方才能断,没有-的单词不能断,必须整体出现。 un\-derstood %在正文中输入understood的时候,插入\-告诉latex这里可以分开。

12.几个单词整体出现 \mbox{0116 291 2319}  %让这几位数字作为一个整体出现在一行,不在不同的行显示。 \fbox{0116 291 2319}  %功能和\mbox一样,同时还在这个整体周围加框。

13.特殊符号

引号 ``well understood `physical' formula''   双引号要用两个重音号``和两单引号''前后表示。

破折号 daughter-in-law, X-rated\pages 13--67\yes---or no? \$0$, $1$ and $-1$

波浪号~ \~understood \~{}physical $\sim$formula   效果各不同

温度度数 $-30\,^{\circ}\mathrm{C}$ $-30$\textcelsius  %这一种要加载\usepackage{textcomp}

欧元符号 \texteuro 100 \euro 100 $需加载\usepackage[official]{eurosym}或者\usepackage[gen]{eurosym} \EURtm  $需加载\usepackage{marvosym}

省略号 直接用...不行,要用 \ldots, 文本中位于下部的省略号 $\cdots___FCKpd___1nbsp;%math mode, 数学符号中的位于中部的省略号 $\cdot___FCKpd___1nbsp; %math mode,数学符号中位于中部的一个点号。

连字 不管你信不信,在latex中,ff和f{}f显示的结果是不同的。ff是两个连在一起的整体符号。

14.调整单词间隔 \frenchspacing

15.论文的标题、章节目等安排 \title{My Dissertation}  %在后面正文中用\maketitle生成标题 \author{George Bush, Allen Greenspan} \date{\today} \tableofcontents %在此位置插入章节目录 \listoffigures  %在此位置插入图形目录 \listoftables  %在此位置插入表格目录 \part{XXX} %产生单独的一页,例如Part I XXX \chapter{Introduction to SAS} %章 1 只有report和book才有章的划分。 \section{My God}  %节 1.1 \subsection{...}  %目 1.1.1 \subsubsection{...}  %以下不再编号 \paragraph{...} \subparagraph{...}

\section*{My God}  %加了*后,该节就不出现在目录中,也不编号。

\appendix  %该命令说明后面开始附录,下面的chapter命令采用字母编号 \chapter{Mathematical analysis}  %Appendix A Mathematical analysis \section{Set Theory}   %A.1 Set Theory

16.book风格的文档 \frontmatter %紧跟着\begin{document}命令出现,该命令启用罗马数字编页码。 \mainmatter %出现在第一章前面,该命令启用阿拉伯数字编页码。 \appendix  %标志书中附录材料的开始。该命令后的各章序号改用字母标记。 \backmatter  %应该插入书中最后一部分内容的前面,如参考文献和索引

17.交叉引用法 \label{sec:my1} %放在在节、子节、图、表或定理后面,作为后面需要引用的标记 \ref{sec:my1} %引用标志词sec:my1那里的节、子节、图、表或定理的序号 \pageref{sec:my1} %引用标志词sec:my1所在的页码

18.脚注、页边注和尾注 \footnote{type the text here.} \marginpar{type the text here.}

尾注的方法 \usepackage{endnotes}  %加载尾注宏包 \endnote{type the text here.} %在需要尾注的地方添加 \theendnotes   %指明尾注内容在文中该地方出现。

19.强调 \underline{text} %下划线强调 \emph{text}  %斜体强调

20. 三种枚举方法Itemize、Enumerate 和Description \flushleft \begin{enumerate}   \item The strategy:     \begin{itemize} \item First,look silly.\item[-] Second,be smart.\end{itemize}   \item The result:     \begin{description} \item[Stupid] You'll be smart.\item[Smart] You'll be stupid.\end{description} \end{enumerate}

21.文本的对齐和居中 \begin{flushleft}。。。。。。\end{flushleft} \begin{flushright}。。。。。。\end{flushright} \begin{center}。。。。。。\end{center}

22.引文、诗歌、摘要

\begin{quote}。。。。。。\end{quote} %一次少量引用 \begin{quotation}。。。。。。\end{quotation} %一次大量引用 \begin{verse}。。。。。。\end{verse} %引用诗歌,排成韵律风格,每一行后用\\断行。 \begin{abstract}。。。。。。\end{abstract} %学术论文的摘要。

23.表格

\begin{tabular}{|r||l @{ + } c@{ . }rrr@{ * }c|c|} \hline \hline Position & Club & Games & W & T & L & Goals & Points\\[1.5ex] \hline 1 & Amesville Rockets & 33 & 19 & 13 & 1 & 66:31 & 51:15 \2 & Borden Comets & 33 & 18 & 9 & 6 & 65:37 & 45:21 \... & ..... & .. & .. & .. & .. & ... & ... \17 & Quincy Giants & 33 & 7 & 5 & 21 & 40:89 & 19:47 \18 & Ralston Regulars & 33 & 3 & 11 & 19 & 37:74 & 17:49\\ \hline \hline \end{tabular}

另一种更加复杂的表,可以随意画横线,几列共用一个标签

\begin{tabular}{|r|l||rrr|r@{ : }l|r@{ : }l||c|} \hline \multicolumn{10}{|c|}{\bfseries {\itshape Table 1}. 1st Regional Soccer League --- Final Results 2002/03}\\ \hline \itshape Position & \itshape Club & \itshape W & \itshape T & \itshape L & \multicolumn{2}{|c|}{\itshape Goals} & \multicolumn{2}{|c||}{\itshape Points} & \itshape Remarks\\[1ex] \hline \hline 1 & Amesville Rockets & 19 & 13 & 1 & 66&31 & 51&15 & League Champs\\ \hline 2 & Borden Comets & 18 & 9 & 6 & 65&37 & 45&21 & Trophy Winners\\ \hline ... & ..... & .. & .. & .. & .. & ... & ... & ...& ...\\ \hline 17 & Quincy Giants & 7 & 5 & 21 & 40&89 & 19&47 & Candidates \\ \cline{1-9} 18 & Ralston Regulars & 3 & 11 & 19 & 37&74 & 17&49 & for Losers\\ \hline \end{tabular}

24. 浮动体 浮动体就是一个整体在正文中上下浮动,寻找合适的放置位置,通常为了避免一个“整体对象”遭遇分页等尴尬问题。例如不想让表格一半在上一页,一半在下一页。将上面表格作为浮动体处理,浮动体放置许可规则[!hbtp]表示忽略内部参数[!],首先优先放在这儿here[h],其次是bottom[b],再次放在top[t],然后考虑放在一个floating page[p]。下面是表和图的浮动体例子。其中caption命令添加标题,[..]内的是简单标题,在\listoffigures 和 \listoftables 中出现,{...}内的是长标题,在正文中显示。

\begin{table}[!hbtp] \caption[Finals]{1st Regional Soccer League --- Final Results.}

\begin{tabular}{|r|l||rrr|r@{ : }l|r@{ : }l||c|} \hline \multicolumn{10}{|c|}{\bfseries {\itshape Table 1}. 1st Regional Soccer League --- Final Results 2002/03}\\ \hline \itshape Position & \itshape Club & \itshape W & \itshape T & \itshape L & \multicolumn{2}{|c|}{\itshape Goals} & \multicolumn{2}{|c||}{\itshape Points} & \itshape Remarks\\[1ex] \hline \hline 1 & Amesville Rockets & 19 & 13 & 1 & 66&31 & 51&15 & League Champs\\ \hline 2 & Borden Comets & 18 & 9 & 6 & 65&37 & 45&21 & Trophy Winners\\ \hline ... & ..... & .. & .. & .. & .. & ... & ... & ...& ...\\ \hline 17 & Quincy Giants & 7 & 5 & 21 & 40&89 & 19&47 & Candidates \\ \cline{1-9} 18 & Ralston Regulars & 3 & 11 & 19 & 37&74 & 17&49 & for Losers\\ \hline \end{tabular}

\end{table}

Figure \ref{white} is an example of Pop-Art. \begin{figure}[!hbp] \makebox[\textwidth]{\framebox[5cm]{\rule{0pt}{5cm}}} \caption[FiveFig]{Five by Five in Centimetres.\label{white}} \end{figure}

浮动体的放置顺序遵循“先来先放”的原则。有时等待序列中浮动体太多,命令\clearpage可以让等待结束,立刻新开一页放置所有等待中的浮动体。

在LaTeX文档中插入图片http://hepg./Service/tips/latex/latexfig.html

25.如何使用中文字体 先在导言区加载\usepackage{CJK} 然后在正文使用中文的地方用

\begin{CJK*}{GBK}{song}   中文或者英文  \end{CJK*}

加*和不加*的区别在于对~的处理不同。加了*后,汉字之间的空格用~代替。不加*,汉字之间空格用英文正常空格。常用的其他字体还有:fs(仿宋)、kai(楷体)、hei(黑体)、li(隶书)、you(幼圆)。命令中的 GBK 是指中文内码,还可以用 GB 和 BIG5(繁体字),前提是相应的字库设置是正确的。

如果在中间想要将宋体改变仿宋,就可以使用: \CJKfamily{GBK}{fs}

26.段首缩进 latex默认每一段段首缩进,但是正文第一段不缩进。如果要缩进,采用下面两种方法: (1).加载\usepackage{indentfirst}的方法。 (2).在该段首用\parindent来专门控制缩进,例如: \setlength{\parindent}{4em} %放置在段首,它设置为当前字号的4个大写字母M的宽度,大约正好是4个汉字的宽度

27.行距和段距的控制 \setlength{\baselineskip}{1.8em} %行距控制为1.8个M,直到下次出现修改为止。1.8em是中文常见行距。 \setlength{\parskip}{1ex}  %段距控制为1个x,直到下次出现修改为止。

28.页眉页脚 \usepackage{fancyhdr} \pagestyle{fancy}

29.页面设置 \usepackage[top=1in, bottom=1in, left=1in,

right=1in]{geometry}
30.如何设置字体颜色
\documentclass[letterpaper,11pt]{report} \usepackage{color} \definecolor{Blue}{rgb}{0.3,0.3,0.9} \begin{document} Hello! {\color{Blue}{World}}!
\end{document}

    本站是提供个人知识管理的网络存储空间,所有内容均由用户发布,不代表本站观点。请注意甄别内容中的联系方式、诱导购买等信息,谨防诈骗。如发现有害或侵权内容,请点击一键举报。
    转藏 分享 献花(0

    0条评论

    发表

    请遵守用户 评论公约

    类似文章 更多