加载中…
个人资料
  • 博客等级:
  • 博客积分:
  • 博客访问:
  • 关注人气:
  • 获赠金笔:0支
  • 赠出金笔:0支
  • 荣誉徽章:
正文 字体大小:

LaTex常见问题总结

(2013-07-31 11:42:38)
分类: 论文排版

LaTeX常见问题 汇总2

常见技巧

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 \hlinePosition & Club & Games & W & T & L & Goals & Points\\[1.5ex] \hline1 & 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 \hline1 & Amesville Rockets & 19 & 13 & 1 & 66&31 & 51&15 & League Champs\\ \hline2 & Borden Comets & 18 & 9 & 6 & 65&37 & 45&21 & Trophy Winners\\ \hline... & ..... & .. & .. & .. & .. & ... & ... & ...& ...\\ \hline17 & 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 \hline1 & Amesville Rockets & 19 & 13 & 1 & 66&31 & 51&15 & League Champs\\ \hline2 & Borden Comets & 18 & 9 & 6 & 65&37 & 45&21 & Trophy Winners\\ \hline... & ..... & .. & .. & .. & .. & ... & ... & ...& ...\\ \hline17 & 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.sdu.edu.cn/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

阅读 收藏 喜欢 打印举报/Report
  

新浪BLOG意见反馈留言板 欢迎批评指正

新浪简介 | About Sina | 广告服务 | 联系我们 | 招聘信息 | 网站律师 | SINA English | 产品答疑

新浪公司 版权所有