2010年12月11日星期六

Latex中一些细节

0.Tex在不同的硬件和操作系统上有不同的实现版本。一种操作系统里也会有好几种的Tex系统。目前常见的Unix/Linux下的Tex系统是 teTex,windows下则有MiKTex和fpTex。CTex是CTex中文套装的简称,是把MiKTex和一些常用的相关工具,如 GSview,WinEdt等包装在一起制作的一个简易安装程序,并对其中的中文支持部分进行了配置,使得安装后马上就可以使用中文。


1.Latex忽略命令后面的空格。如果你希望在命令后面得到一个空格,可以在命令后面加上{}和一个空格,或者加上一个特殊的空白距离命令。{}将阻止Latex吞噬命令后面的空格。

2.得到今天的日期:\today。\TeX,\LaTeX,\LaTeXe是三个表示Latex常用的命令。

3.换行:\newline,\\

4.注释:除了%,可以使用\usepackage{verbatim}下的\begin{comment}...\end{comment}, 但是注意这个方法不能使用在像数学环境等一些复杂的环境中,后面这个方法用来注释大段内容很方便。另外还可以用命令\iffalse...\fi把需要注释的内容包含起来,这样Latex编译的时候就会忽略这些内容,不做编译。

5.导言区:\documentclass和\begin{document}之间的区域。

6.使用syntonly宏包可以让Latex快速检查文档:仅仅检查语法和所使用的命令是否正确,不会产生DVI输出。在这种模式下,Latex运行的非常快,可以节省客观的时间。使用方法:

\usepackage{syntonly},

\syntaxonly

7.\begin{CJK*}...\end{CJK*},CJK*模式自动忽略中文字符之间的所有空格.如果想在中文字符中间加入空格就必须加以保护,避免被忽略.加保护的方法是在空格前面加上\ 字符。实际上CJK*模式忽略中文字符后面的空格,因此中文后面如果接着英文,必须加上保护的空格\ 或者~符号,否则可能造成断行错误。

8.\CJKtilde实现~的重定义,\standardtilde恢复原始定义。~ 的原始定义是不可断行的空格, CJK 将其重定义成一个比较合适的弹性距离,大约相当于四分之一个汉字宽度,用于分隔中英文字符。空格前的反斜线符号产生一个不能伸长的空格,在CJK中没有重定义。

9.常见的矢量字库有Typel字库和TrueType字库。

10.首段段首缩进:\usepackage{indentfirst}.

11.设置行距:\renewcommand{\baselinestretch}{倍数}.

12.搜索并安装宏包的步骤:(1)通过http://www.ctan.org/search/?action=/index.html找 到宏包在CTAN目录中的相对位置,然后下载,注意CTex ftp的根目录是/CTAN/。(2)如果宏包是编译好的,即已经有了.sty或者.cls文件,则把这些文件放到D:\CTEX\CTeX\tex \latex(加入CTex安装在D:\CTEX)下的某个新建的子目录;如果宏包还没有编译,则根据ctex-faq.pdf中的问题16进行编译,然 后再安装。(3)刷新文件名数据库,点击WinEdt/Accessories/MiKTex/MikTex options/General/Refresh FNDB。(4)在需要宏包的源文件中添加\usepackage{...},就可以使用该宏包了。

13.\-在单词中插入一个自主的断字点,成为这个单词中允许出现的唯一断字点。

14.\mbox{text},\fbox{text}保证把text中单词排在同一行上,后者还画一个框。

15.引号:用两个`(1左边的键)产生左双引号,用两个'产生右双引号。一个`和'产生一对单引号。

16.连字号:-,段破折号:--,长破折号:---,减号$-$。

17.波浪号。左上角波浪号:\~{};左边中间波浪号:$\sim$;字母上面波浪号:\~。

18.-30摄氏度:$-30\,^{\circ}\mathrm{C}$。

19.省略号:\ldots。

20.Latex在句子的末尾插入的空间稍多一些。Latex假定句子以句号、问好或惊叹号结尾。如果句子紧跟一个大写字母,它就不视为句子的结尾。因为一般在有缩写的地方,才出现句号紧跟大写字母的情况。句号前的命令\@说明这个句号是句子的末尾,即使它紧跟一个大写字母。

21.对article,有下列分节命令:\section{},\subsection{},\subsubsection{},

\paragraph{},\subparagraph{};If you want to split your document in parts without influencing the section or chapter numbering you can use \part{}.对report和book,还有一个命令:\chapter{}。\part{}不影响章的序号;\appendix不带参量,只把章 (如果是article则为节)的序号改为字母标记。分节命令名称后加*表示生成的节标题既不出现于目录,也不带序号,例如\section* {Help}。

22.Latex在文档编译的最后一个循环中,提取节的标题和页码以生成目录。\tableofcontents在其出现的位置插入目录。Normally the section headings show up in the table of contents exactly as they are entered in the text. Sometimes this is not possible, because the heading is too long to fit into the table of contents. The entry for the table of contents can then be specified as an optional argument in front of the actual heading.

\chapter[Title for the table of content]{A long and especially boring title, shown in the text}。

23.The title of the whole document is generated by issuing a \maketitle command. The contents of the title have to be defined by the commands \title{},\author{}and optionally \date{} before calling \maketitle. In the argument to \author, you can supply several names separated by \and commands.

24.Apart from the sectioning commands explained above, LATEX2e introduced three additional commands (\frontmatter,\mainmatter and \backmatter) for use with the book class. They are useful for dividing your publication. The commands alter chapter headings and page numbering to work as you would expect it in a book:

  • \frontmatter should be the very first command after the start of the document body (\begin{document}). It will switch page numbering to Roman numerals and sections be non-enumerated. As if you were using the starred sectioning commands (eg \chapter*{Preface}) but the sections will still show up in the table of contents.
  • \mainmatter comes right before the first chapter of the book. It turns on Arabic page numbering and restarts the page counter.
  • \appendix marks the start of additional material in your book. After this command chapters will be numbered with letters.
  • \backmatter should be inserted before the very last items in your book, such as the bibliography and the index. In the standard document classes, this has no visual effect.

25.交叉引用:\label{marker},\ref{marker} and \pageref{marker}.

26.Emphasized Words: \underline{text},\emph{text}. Telling Latex to use a different font: \textit{text},\textsf{text} and texttt{text}.

27.Environments: \begin{environments} text \end{environment}

  • itemize,enumerate,description
  • flushleft,flushright,center
  • quote,quotation,verse. The quotation environment is useful for longer quotes going over several paragraphs, because if indents the first line of each paragraph. The verse environment is usefor for poems where the line breaks are important.
  • abstract. Normally it is used in documents typeset with the article document class.
  • verbatim. Text that is enclosed will be directly printed. Within a paragraph, similar behavior can be accessed with \verb|text|. The | is just an example of a delimiter character. You can use any character except letters, * or space. Note the verbatim environment and the \verb command may not be used within parameters of other commands.
  • tabular. Material typeset with the tabular environment always stays together on one page. If you want to typeset long tables, you might want to use the longtable or supertable environment.

没有评论:

发表评论