Add New Notes
7
Zim/LaTex/BibTeX.txt
Normal file
@@ -0,0 +1,7 @@
|
||||
Content-Type: text/x-zim-wiki
|
||||
Wiki-Format: zim 0.4
|
||||
Creation-Date: 2011-11-26T20:11:54+08:00
|
||||
|
||||
====== BibTeX ======
|
||||
Created Saturday 26 November 2011
|
||||
|
||||
129
Zim/LaTex/BibTeX/BibTeX-How_to_cite_a_website.txt
Normal file
@@ -0,0 +1,129 @@
|
||||
Content-Type: text/x-zim-wiki
|
||||
Wiki-Format: zim 0.4
|
||||
Creation-Date: 2011-11-26T19:58:19+08:00
|
||||
|
||||
====== BibTeX-How to cite a website ======
|
||||
Created Saturday 26 November 2011
|
||||
|
||||
http://win.ua.ac.be/~nschloe/content/bibtex-how-cite-website
|
||||
|
||||
Submitted by Nico on Sun, 21/06/2009
|
||||
|
||||
With the increasing importance of the internet for scientific research, need increases for properly citing online resources. Unfortunately, when the main LaTeX citation machinery BibTeX was created, this was not to be forseen; this is why there is to date no canonical way to cite, say, a website. Different workarounds have emerged, using for example some trickery with the **@MISC **type (see below), but the right way™ hasn't been found yet.
|
||||
|
||||
This could change with the advent of __biblatex__. Its new entry type __@ONLINE__ is supposed to contain references to web resources and doesn't give room for confusion anymore.
|
||||
|
||||
With the BibTeX entry
|
||||
|
||||
@ONLINE{Doe:2009:Online,
|
||||
author = {Doe, Ringo},
|
||||
title = {This is a test entry of type {@ONLINE}},
|
||||
month = jun,
|
||||
year = {2009},
|
||||
url = {http://www.test.org/doe/}
|
||||
}
|
||||
|
||||
and the LaTeX file
|
||||
|
||||
\documentclass{article}
|
||||
|
||||
\usepackage{biblatex} #不用设置样式
|
||||
\bibliography{test.bib}
|
||||
|
||||
\title{BibTeX Website citatations with the \textsf{biblatex}~package}
|
||||
\date{}
|
||||
|
||||
\begin{document}
|
||||
|
||||
\maketitle
|
||||
\**nocite**{Doe:2009:Online} #nocite 与cite的区别是前者不会显示引用计数
|
||||
\printbibliography
|
||||
|
||||
\end{document}
|
||||
|
||||
one gets a nicely typeset list of references.
|
||||
|
||||
Note that there are plenty of more options and entry types in the biblatex package, such as (the currently usused) @AUDIO and @VIDEO.
|
||||
|
||||
Because of its supposedly large impact on the (La)TeX community, the author of biblatex still declares the package as 'beta' which is why it is not included in TeXlive, for example. Should you for this or some other reason be unable to install biblatex, there are (inferior) alternatives to use for URL citations in a reference list.
|
||||
|
||||
===== Alternatives =====
|
||||
|
||||
=== Using the natbib package ===
|
||||
|
||||
The natbib package extends the functionality of regular bibtex to a certain degree, and allows for website citations as well. There is **no specific entry** type for online resources, but __@MISC, @OTHER, and @BOOKLET__ work quite well.
|
||||
|
||||
@BOOKLET{Doe:2009:Booklet,
|
||||
title = {This is a test entry of type {@BOOKLET}},
|
||||
author = {Doe, John},
|
||||
month = jun,
|
||||
year = {2009},
|
||||
url = {http://www.test.org/doe/}
|
||||
}
|
||||
|
||||
@MISC{Doe:2009:Misc,
|
||||
author = {Doe, Paul},
|
||||
title = {This is a test test entry of type {@MISC}},
|
||||
month = jun,
|
||||
year = {2009},
|
||||
url = {http://www.test.org/doe/}
|
||||
}
|
||||
|
||||
@OTHER{Doe:2009:Other,
|
||||
author = {Doe, Brian},
|
||||
title = {This is a test entry of type {@OTHER}},
|
||||
month = jun,
|
||||
year = {2009},
|
||||
url = {http://www.test.org/doe/}
|
||||
}
|
||||
|
||||
Note that standard bibstyles (such as plain) will **not typeset** the url key contents of the individual entries; it is required to use one of natbib's own entries, e.g. plainnat.
|
||||
|
||||
\documentclass{article}
|
||||
|
||||
**\usepackage{natbib}**
|
||||
**\bibliographystyle{plainnat}**
|
||||
|
||||
**\usepackage{url}**
|
||||
|
||||
\title{BibTeX Website citatations with the \textsf{natbib} package}
|
||||
\date{}
|
||||
|
||||
\begin{document}
|
||||
|
||||
\maketitle
|
||||
\nocite{Doe:2009:Other,
|
||||
Doe:2009:Misc,
|
||||
Doe:2009:Booklet}
|
||||
\bibliography{test}
|
||||
|
||||
\end{document}
|
||||
|
||||
|
||||
===== Using the url package =====
|
||||
|
||||
The most elemental way to include web references is via the howpublished key of the** @MISC **entry. Use
|
||||
|
||||
@MISC{Doe:2009:Misc,
|
||||
author = {Doe, George},
|
||||
title = {This is a test test entry of type {@MISC} and `howpublished'},
|
||||
month = jun,
|
||||
year = {2009},
|
||||
howpublished={\url{http://www.test.org/doe/}}
|
||||
}
|
||||
|
||||
and
|
||||
|
||||
\documentclass{article}
|
||||
**\bibliographystyle{plain}**
|
||||
|
||||
**\usepackage{url}**
|
||||
|
||||
\begin{document}
|
||||
|
||||
\nocite{Doe:2009:Misc}
|
||||
**\bibliography{mybib}**
|
||||
|
||||
\end{document}
|
||||
|
||||
|
||||
89
Zim/LaTex/BibTeX/BibTeX使用介绍.txt
Normal file
@@ -0,0 +1,89 @@
|
||||
Content-Type: text/x-zim-wiki
|
||||
Wiki-Format: zim 0.4
|
||||
Creation-Date: 2011-11-26T20:10:51+08:00
|
||||
|
||||
====== BibTeX使用介绍 ======
|
||||
Created Saturday 26 November 2011
|
||||
http://latex.yo2.cn/articles/latex-bibtex-introduction.html
|
||||
|
||||
BibTeX 是一种格式和一个程序, 用于协调LaTeX的参考文献处理.
|
||||
|
||||
BibTeX 使用数据库的的方式来管理参考文献. BibTeX 文件的后缀名为 .bib . 先来看一个例子
|
||||
|
||||
@article{name1,
|
||||
author = {作者, 多个作者用 and 连接},
|
||||
title = {标题},
|
||||
journal = {期刊名},
|
||||
volume = {卷20},
|
||||
number = {页码},
|
||||
year = {年份},
|
||||
abstract = {摘要, 这个主要是引用的时候自己参考的, 这一行不是必须的}
|
||||
}
|
||||
|
||||
@book{name2,
|
||||
author ="作者",
|
||||
year="年份2008",
|
||||
title="书名",
|
||||
publisher ="出版社名称"
|
||||
}
|
||||
|
||||
说明:
|
||||
|
||||
第一行@article 告诉 BibTeX 这是一个文章类型的参考文献. 还有其它格式, 例如 article, book, booklet, conference, inbook, incollection, inproceedings, manual, misc, mastersthesis, phdthesis, proceedings, techreport, unpublished 等等.
|
||||
接下来的"name1", 就是你在正文中应用这个条目的名称.
|
||||
其它就是参考文献里面的具体内容啦.
|
||||
|
||||
===== 在LaTeX中使用BibTeX =====
|
||||
为了在 LaTeX 中使用BibTeX 数据库, 你必须先做下面三件事情:
|
||||
|
||||
1) 设置参考文献的类型 (bibliography style). 标准的为 plain:
|
||||
|
||||
\bibliographystyle{plain}
|
||||
|
||||
将上面的命令放在 LaTeX 文档的 \begin{document}后边. 其它的类型包括
|
||||
|
||||
unsrt – 基本上跟 plain 类型一样, 除了参考文献的条目的编号是按照引用的顺序, 而不是按照作者的字母顺序.
|
||||
alpha – 类似于 plain 类型, 当参考文献的条目的编号基于作者名字和出版年份的顺序.
|
||||
abbrv – 缩写格式 .
|
||||
|
||||
2) 标记引用 (Make citations). 当你在文档中想使用引用时, 插入 LaTeX 命令
|
||||
|
||||
\cite{引用文章名称}
|
||||
|
||||
"引用文章名称" 就是前边定义@article后面的名称.
|
||||
|
||||
3) 告诉 LaTeX 生成参考文献列表 . 在 LaTeX 的结束前输入
|
||||
|
||||
\bibliography{bibfile}
|
||||
|
||||
这里bibfile 就是你的 BibTeX 数据库文件 bibfile.bib .
|
||||
|
||||
===== 运行 BibTeX =====
|
||||
分为下面四步
|
||||
|
||||
用LaTeX编译你的 .tex 文件 , 这是生成一个 .aux 的文件, 这告诉 BibTeX 将使用那些应用.
|
||||
用BibTeX 编译 .bib 文件.
|
||||
再次用LaTeX 编译你的 .tex 文件, 这个时候在文档中已经包含了参考文献, 但此时引用的编号可能不正确.
|
||||
最后用 LaTeX 编译你的 .tex 文件, 如果一切顺利的话, 这是所有东西都已正常了.
|
||||
|
||||
例子: 将上面的 BibTeX 的的例子保存为 bibtex-example.bib .
|
||||
|
||||
\documentclass{article}
|
||||
\usepackage{CJK}
|
||||
\begin{document}
|
||||
\begin{CJK}{UTF8}{gkai}
|
||||
%我是在linux下用使用latex的, window用户将上一行改为\begin{CJK}{GBK}{kai}
|
||||
text\cite{name1}\cite{name2}
|
||||
中文
|
||||
把Latex中的 Reference 写成中文的"参考文献"
|
||||
%如果文档类是article之类的, 用\renewcommand\refname{参考文献}
|
||||
%如果文档类是book之类的, 用\renewcommand\bibname{参考文献}
|
||||
\renewcommand\refname{参考文献}
|
||||
\bibliographystyle{plain}
|
||||
\bibliography{ bibtex-example.bib}
|
||||
\end{CJK}
|
||||
\end{document}
|
||||
|
||||
将上面的内容保存为bibtex-example.tex .
|
||||
|
||||
latex编译一次, bibtex 编译一次, 再用 latex编译两次就大功告成了!
|
||||
32
Zim/LaTex/Bibtex_文献排序.txt
Normal file
@@ -0,0 +1,32 @@
|
||||
Content-Type: text/x-zim-wiki
|
||||
Wiki-Format: zim 0.4
|
||||
Creation-Date: 2011-11-27T12:17:00+08:00
|
||||
|
||||
====== Bibtex 文献排序 ======
|
||||
Created Sunday 27 November 2011
|
||||
http://blog.csdn.net/forsiny/article/details/4805778
|
||||
通过设置 bibliographystyle 就可以达到上述目的,Bibtex 自身已具备排序的功能,而且可以选择自己想要的排序方式。Bibtex 已自带有 8 种样式,分别如下(下面内容摘自 LaTeX 编辑部):
|
||||
|
||||
plain,按字母的顺序排列,比较次序为作者、年度和标题
|
||||
|
||||
unsrt,样式同plain,只是按照引用的先后排序
|
||||
|
||||
alpha,用作者名首字母+年份后两位作标号,以字母顺序排序
|
||||
|
||||
abbrv,类似plain,将月份全拼改为缩写,更显紧凑:
|
||||
|
||||
ieeetr,国际电气电子工程师协会期刊样式:
|
||||
|
||||
acm,美国计算机学会期刊样式:
|
||||
|
||||
siam,美国工业和应用数学学会期刊样式:
|
||||
|
||||
apalike,美国心理学学会期刊样式:
|
||||
|
||||
BibTeX 提供了一个外部的 BibTeX 工具程序,源文件经过 LaTeX 编译后,还要使用BibTeX 对数据库文件编译一次,最后再用 LaTeX 连续编译两遍,才能得到正确结果。 可用下图解释这四个编译步骤的作用:
|
||||
|
||||
Kurs T: System skladu publikacji LATEX
|
||||
|
||||
文献数据库可根据要求自行编写,其格式有:文章、书籍、技术报告、会议论文集和博士论文等十几种,每种格式都有一些必填和选填的项目,如作者、标题、出版社、发表年度、...等等,最后存储为 .bib 文件。
|
||||
|
||||
如果对生成的参考文献样式仍有不满意之处,还可将编译信息文件*.bbl 中的参考文献列表源程序拷贝到论文尾部,然后进行手工调整。
|
||||
338
Zim/LaTex/LaTeX-从新手到TeXPert.txt
Normal file
@@ -0,0 +1,338 @@
|
||||
Content-Type: text/x-zim-wiki
|
||||
Wiki-Format: zim 0.4
|
||||
Creation-Date: 2011-09-07T22:09:28+08:00
|
||||
|
||||
====== LaTeX-从新手到TeXPert ======
|
||||
Created Wednesday 07 September 2011
|
||||
http://latex.yo2.cn/articles/latex_from_beginner_to_texpert_zh.html
|
||||
原文: LaTeX: From beginner to TeXPert, 也可参见这里.
|
||||
|
||||
本文是介绍TeX排版系统, 但你阅读下面的信息后, 你将能够:
|
||||
|
||||
下载和安装LaTeX(包括Windows, linux, 或者Mac系统)
|
||||
使用LaTeX创建简单的文档
|
||||
安装新的LaTeX宏包
|
||||
在LaTeX文档中插入表格和图像
|
||||
使用LaTeX的交互引用, 脚注和基本的参考文献用法
|
||||
在LaTeX文档中插入数学公式
|
||||
|
||||
这些主题已经覆盖写文档的基本任务. 然而, 注意到, 但使用LaTeX系统的时候, 你可以很容易创建看起来非常专业的文档, 并且LaTeX是全面和可扩展的. 还有许多在这篇基础引导性文章没有提及的功能. 幸运的是, LaTeX的文档非常丰富. 如果你对碰到什么问题, 可以向你的老朋友Google寻求帮助.
|
||||
|
||||
===== 什么是LaTeX? =====
|
||||
|
||||
LaTeX是一个排版系统, 它允许作者创建一个高质量的文档, 而不用过多关心格式, 分页, 对象的位置和其它一些将作者从写作上分心的格式设置. LaTeX的发音为 “lay-tech”, 它是原始排版系统TeX (”tech”)的一个扩展. 你可以在Wikipedia上找到 TeX 和 LaTeX 的历史.
|
||||
|
||||
LaTeX在一个专业领域被广泛的使用. 在数学, 物理, 经济, 统计和其它一些学术和专业领域, 它们的文档需要经常使用LaTeX来排版数学符号, 因为LaTeX能简单而高质量地支持数学符号.一些出版公司也使用基础TeX的系统来排版文档.
|
||||
|
||||
===== LaTeX 是怎样工作的? =====
|
||||
|
||||
LaTeX与传统的字处理软件有下列两个基本的不同:
|
||||
* 一般地, 使用容易学的LaTeX的标记语言来写LaTeX文档, 而不是使用图形界面来确定格式[1].
|
||||
* 在输入文本之后需用LaTeX编译生成文档, 而不像其它字处理软件, 它可以使用下面的文档的总长度, 表格的数目等信息来优化表格, 图形, 断页等.
|
||||
|
||||
下面是一个非常基本的LaTeX文档的例子:
|
||||
|
||||
\documentclass{article}
|
||||
\author{Your Name}
|
||||
\title{Test Document}
|
||||
\begin{document}
|
||||
\maketitle
|
||||
This is a test document
|
||||
\end{document}
|
||||
|
||||
使用任何一个LaTeX发行版, 保存上面的文本到一个后缀为 ".tex" 的文件, 然后用LaTeX来编译就可以生成一个文档了.
|
||||
|
||||
LaTeX被设置成在不同的系统可得到同样的输出. 因此, 如果你发布上面的文本, 其他人可以使用某个LaTeX发行版的 , 而不用关注他的操作系统, 都将得到完全一样的结果. LaTeX可以输出各种格式的文件, 但最流行的是PDF格式.
|
||||
|
||||
===== 如何得到LaTeX软件 =====
|
||||
|
||||
从技术上来说, 你只需要LaTeX引擎(一些二进制的文件和库)就可以将简单的文本tex文件转化为优美的PDF文件. LaTeX可以以命令行形式被使用, 因而*nix和Dos的支持者将觉得这非常好. 然而使用一个LaTeX前端编辑器将使得操作跟简单. 大多数的LaTeX前端编辑器本质上都是文本编辑器, 但还有下面的功能:
|
||||
|
||||
* 编译LaTeX文档, 而不是使用命令行.
|
||||
* 让LaTeX语言跟容易的书写(命令补全, 创建模板化表格等).
|
||||
|
||||
这这篇文档中, 我假设你已经有了一个LaTeX引擎和一个前端编辑器. 每个操作系统下你都有很多的LaTeX引擎和一个前端编辑器供选择. 我将描述最流行和最容易安装的开源的工具的安装. 不同发行版间的唯一区别是应用时的一些配置和用法不同, 你也可以自由地选择其它的发行版.
|
||||
|
||||
===== 关于文件格式的一点注记 =====
|
||||
|
||||
LaTeX 可以生成多种格式的输出文件, 包括 PDF 和 DVI (与设备独立的格式) 文件. 生存文件的格式依赖于是否使用PdfLaTeX或另一个程序来编译文件. 编辑器默认会创建 PDF 文件, 主要到改变相应的设置会影响输出文件的格式.
|
||||
|
||||
====== LaTeX 基础知识 ======
|
||||
|
||||
==== LaTeX 命令 ====
|
||||
|
||||
LaTeX 命令通常是以一个反斜杠(backslash)开头, 和具有形式\command[options]{argument. 例如,
|
||||
|
||||
\section{Introduction}
|
||||
|
||||
将定义一个叫 “Introduction” 的新的小节. 符号“%” 定义一个注记, 这一行它后面的字符都将被认为是注记, 而被 LaTeX 忽略. 如果你需要在文档中输入字符“%” , 使用命令: \%.
|
||||
|
||||
在 LaTeX** 使用引号的方式**有点不同. 为了插入一个引号, 使用标准的 "文本" , 就是两次字符 ` (位于键盘的左上方).
|
||||
|
||||
==== 导言区(preamble) ====
|
||||
|
||||
文档中, 行 “\begin{document}” 之前的部分称为导言区. 一个典型的导言区可以像这样:
|
||||
|
||||
\documentclass{article}
|
||||
\usepackage{graphicx}
|
||||
\title{Test}
|
||||
\author{Test}
|
||||
\date{}
|
||||
|
||||
在上面的例子中:
|
||||
|
||||
\documentclass{article} 告诉 LaTeX , 这个文件是的类型是文章 (article). 其它类型有: 书本(book), 信 ( letter) 和 演示文稿 ( slides) .
|
||||
\usepackage{graphicx} 告诉 LaTeX 使用 graphicx 宏包 , 它允许用户在文档中包含许多类型的图像. 将会在后面介绍宏包的用法.
|
||||
\title{} and \author{}显然就是定义文章的标题和作者.
|
||||
\date{} 告诉 LaTeX 留下一行生成日期. \date{April 2006}将会生成日期 “April 2006″ . 如果只使用 \date{} 将告诉 LaTeX 使用今天的日期.
|
||||
|
||||
命令\documentclass{} 有一些参数. 例如, \documentclass[11pt,twocolumn]{article} 将文档的主体为设为两栏格式. 注意参数之间用逗号隔开. 其它的一些参数包括:
|
||||
|
||||
* oneside 或 twoside - 改变边界, 设置成单页或双页文档
|
||||
* landscape - 将文档的格式从 portrait 改为 landscape.
|
||||
* titlepage 或 notitlepage - 定义是否使用分离的标题页面, 或者标题, 作者和日题出现在文章的顶部.
|
||||
|
||||
|
||||
==== 文档的主体(The document body) ====
|
||||
|
||||
导言区后边, 也就是 \begin{document} 和 \end{document} 之间的部分是文档的主体. 大多数的 LaTeX 文档只是一个简单的纯文本. 为了开始一个新的段落, 输入__两个回车__. LaTeX 会自动忽略一个空白的行. 为了强制断行, 使用\\ .
|
||||
|
||||
==== 文档的结构 (Document structure) ====
|
||||
|
||||
定义一个文档的结构可使用命令 \section{}. LaTeX 是__基于结构的文档__. 结构的标记有:
|
||||
|
||||
\section{Name}
|
||||
\subsection{Name}
|
||||
\subsubsection{Name}
|
||||
\paragraph{Name}
|
||||
|
||||
为了插入一个**没有标号的小节**, 使用命令 \section*{Name}. 章节的会自动的连续的编号.
|
||||
|
||||
命令 \paragraph{}不是必须的, 除非你想为一个段落插入一个标题. 例子:
|
||||
|
||||
1 Section command
|
||||
|
||||
Section star command
|
||||
this section is not numbered
|
||||
|
||||
2 Section command
|
||||
Test here the the numbering continuous normally
|
||||
|
||||
2.1 Subsection command
|
||||
Test here
|
||||
|
||||
Paragraph command this paragraph have a title.
|
||||
|
||||
===== 环境(Environments) =====
|
||||
|
||||
环境是一块特殊的文本. 例如, itemize 和 enumerate 环境相应地创建项目和编号列表. 下面的标记:
|
||||
|
||||
\begin{itemize}
|
||||
\item First thing
|
||||
\item Second thing
|
||||
\item Third thing
|
||||
\end{itemize}
|
||||
|
||||
\begin{enumerate}
|
||||
\item First numbered thing
|
||||
\item Second numbered thing
|
||||
\end{enumerate}
|
||||
|
||||
将生成一个项目列表和接下来的一个编号列表.
|
||||
|
||||
注意到环境都是以 \begin{environmentname} 开头和以 \end{environmentname} 结尾. 它们可以被嵌套, 所以一个项目列表可能包含另一个项目列表或者编号列表等.
|
||||
|
||||
另外一下经常被使用的环境有:
|
||||
|
||||
引用环境 (Quote): \begin{quote}…\end{quote} 创建一小节缩进的引用的文本
|
||||
Verbatim环境: \begin{verbatim} … \end{verbatim} 类似于HTML中的 **pre** . 在 verbatim 环境中, 文本将显示为__等宽格式的字体__和特殊字符将被忽略. 当书写源代码的时候, Verbatim 环境非常有用.
|
||||
Description 环境: \begin{description} \item[First item] text \end{description} 生成一个列表和或项目, 它有一个粗体的名字和之后悬挂缩进的文本
|
||||
|
||||
===== 改变字体的样式 (Modifying text styles) =====
|
||||
|
||||
LaTeX 背后一个基本的思想是解决作者的格式问题. 然后, 有时还是需要手动得设置指定字体样式.
|
||||
|
||||
* 插入粗体 (bold text), 使用 \textbf{text here}
|
||||
* 插入斜体 (italic text), 使用 \emph{text here}
|
||||
* 插入但等宽字体 (monospace text), 使用 \texttt{text here} (" tt " 代表打字机 (teletype)
|
||||
为了在句子中使用 verbatim 文本, 使用 \verb | your text here | . 注意可以使用任意的分界符, 例如\verb+your text here+ 将显示同样的效果.
|
||||
|
||||
===== 宏包(Packages) =====
|
||||
|
||||
使用宏包可以扩展 LaTeX 的 功能. 宏包的安装主要分为下面两步:
|
||||
|
||||
* 用 LaTeX 运行 .ins 文件来生成 .sty 和 .cls 文件
|
||||
* 将两个新创建的文件拷贝到适当的目录下, 然后更新 LaTeX 数据库
|
||||
|
||||
但是, 也有一些例外. 文件类型 .sty 和 .cls 分别代表 样式 (style) 和 类 (class). 如果一个宏包不是 .ins 格式而是 .sty 和 .cls 文件, 则不需要用LaTeX处理, 直接跳到第二步. 另外, 当用LaTeX处理 .ins 文件时候, 通常会生成一个 .dtx 文件. 这个文件可以通过LaTeX来创建这个__宏包的手册__.
|
||||
|
||||
注意: 用 LaTeX 处理宏包文件, 只需要用你的LaTeX前端编辑器打开, 然后按通常处理一个 tex 文件编译.
|
||||
|
||||
|
||||
接下来, 介绍两个流行的宏包: graphicx 和 gemetry . 这些宏包已经在 gwTeX 和 MikTeX 上默认安装了, 而不需要另外下载安装它们.
|
||||
|
||||
===== graphicx 宏包 =====
|
||||
|
||||
graphicx 宏包用于在 LaTeX 文档插入图像. 为了使用它, 首先在文档的导言区加上命令 \usepackage{graphicx}. 然后使用下面的命令插入图形.
|
||||
|
||||
\includegraphics[options]{filename.png}
|
||||
|
||||
graphicx 宏包支持许多文件类型, 包括 PDF, PNG 和 JPG. 注意此时需要__用 PdfLaTeX 编译你的文档__. 它的主要参数有:
|
||||
|
||||
width=Xin
|
||||
height=Xin
|
||||
scale=X (Where x is between **0 and 1**)
|
||||
|
||||
===== geometry宏包 =====
|
||||
|
||||
用 LaTeX 处理格式化的文档是非常简单的, 但你需要改变它的默认格式的时候就变得有点复杂了. 使用 geometry 宏包就改变你文档的某些设置, 包括边距等. 下边是一个将四周边距改为 1 in 的例子 :
|
||||
|
||||
\usepackage[margin=1in]{geometry}
|
||||
|
||||
===== 图形和表格 =====
|
||||
|
||||
图形和表格都是 LaTeX 中的__环境__, 然而它们有一些特殊的属性, 例如命令 \caption{}, 这将生成图形和表格的标题. 它们被称为__浮动__对象, 因为它们在最终编译生成文档中的位置依赖当前 LaTeX 样式的算法.
|
||||
|
||||
==== 图形 (Figures) ====
|
||||
|
||||
为了插入一个图形, 使用
|
||||
|
||||
\begin{figure}[hbtp]
|
||||
\caption{Figure name}
|
||||
\begin{center}
|
||||
\includegraphics{filename.pdf}
|
||||
\end{center}
|
||||
\label{your-reference-key}
|
||||
\end{figure}
|
||||
|
||||
在上面的代码中,
|
||||
|
||||
* \begin{figure} 只是告诉 LaTeX 现在开始一个图形 (figure) 环境
|
||||
* [hbtp] 决定 LaTeX 如何放置这个图形 (当前位置here (h), 底部bottom (b), 顶部top(t), 页面page(p)). LaTeX 首先会尝试在将图形插入到当前位置 (tex 文件中的**插入点**), 如果没有足够的空间或者其它审美考虑, 它将尝试把图形先放在**当前页面**的底部, 然后是顶部, 最后是一个特殊页面来放置这个浮动对象. 如果强制图形只出现在原来的位置, 使用命令 \begin{figure}[h], 而忽略其它参数 b, p 和 t
|
||||
* \caption{Figure name}生成图形的名称
|
||||
* \begin{center} 只是告诉 LaTeX 将图形放置在页面的中间. 不要忘记在结束 figure 环境前结束 centering 环境.
|
||||
* \includegraphics{…} 指定你要插入图形文件的位置
|
||||
* \label{your-reference-key} 是一个标签, 它将允许你在文本中引用这个图形. 例如, 你的图形标签为 "fig1" , 当你需要引用它时输入 \ref{fig1}
|
||||
|
||||
===== 表格 (Tables) =====
|
||||
|
||||
LaTeX 中一个浮动表格由__两个环境__组成: 表格, 在文本中浮动的实体, 和 tabular (制表的内容). 例如,
|
||||
|
||||
\begin{table}[hbtp]
|
||||
\caption{This table is an example}
|
||||
\begin{center}
|
||||
\begin{tabular}{c|cc}
|
||||
First row, first column & First row second column & First row, third column \\ \hline
|
||||
Second row, first column & Second row, second column & Second row, third column \\
|
||||
Third row, first column & Third row, second column & Third row, third column \\
|
||||
\multicolumn{3}{c}{…}
|
||||
\end{tabular}
|
||||
\end{center}
|
||||
\label{exampletable}
|
||||
\end{table}
|
||||
|
||||
除了代码 \begin{tabular} … \end{tabular} 之间的内容外它的意思跟前面图形环境的描述是一样的. 下面我们来看 tabular 环境是怎样工作的:
|
||||
|
||||
* \begin{tabular}{c|cc} 告诉 LaTeX 开始一个新的包含3个居中列的 tabular 环境. 第一个"c"之后的竖线 (”|”) 告诉 LaTeX 第一列有一个垂直的边线. 使用{lcrr}能创建 4 列, 第一列左对其, 第二列居中, 第三列和第四列右对齐
|
||||
* 表格单元用符号 “&”分离, 表格行用符号“\\”分离.
|
||||
* \hline 生成一条水平线
|
||||
* \multicolumn{3}{c}{Text here} 创建一个有 3 列的行, 居中格式, 并且包含文本 “Text here”
|
||||
|
||||
创建和插入表格还有一些跟复杂的参数, 但是上面的例子应该已经包含90%的应用了.[2]
|
||||
|
||||
===== 注释 (Annotations) =====
|
||||
|
||||
LaTeX 能够自动创建一些重要的注释, 例如脚注, 交叉引用, 表格的目录和参考文献. 注意到下面的命令需要 LaTeX 自动对正文元素进行计数, 从而需要 LaTeX 需要运行两次才能显示效果.
|
||||
|
||||
==== 脚注(Footnotes) ====
|
||||
|
||||
为了插入一个脚注, 只需要输入 \footnote{Footnote text here}. LaTeX 自动插入一个脚注数目和文本.[3]
|
||||
|
||||
==== 交叉引用 (Cross references) ====
|
||||
|
||||
为了引用一个表格或图形的标签, 使用 \ref{your-reference-key} 其中 “your-reference-key” 是表格或图形环境中命令 \label{your-reference-key} 的参数.
|
||||
|
||||
==== 表格的目录 (Table of contents) ====
|
||||
|
||||
为了插入一个表格目录, 在文档的开始的地方使用 \tableofcontents . (你必须运行 LaTeX 两次来获得表格目录和正确的引用.)
|
||||
|
||||
==== 参考文献(Bibliography) ====
|
||||
|
||||
为了创建一个参考文献列表, 在你文档的最后, 使用
|
||||
|
||||
\begin{thebibliography}{99}
|
||||
….
|
||||
\bibitem{key1} Disarray, General. 2006. “\LaTeX{}: From beginner to \TeX pert.” \emph{General Disarray Blog}. Available online at \textt{http://generaldisarray.wordpress.com}. ….
|
||||
\end{thebibliography}
|
||||
|
||||
你必须手动输入参考文献的项目. 在正文中引用一个项目, 使用 \cite{key}, 参数{99}告诉 LaTeX 这是一个最多 99 个项目的参考文献. LaTeX 必须知道这个参数才能正确地调整参考文献项目左边的编号.
|
||||
|
||||
一个跟有效的创建参考文献的方法是使用__ BibTeX__, 它允许你维护一个引用项目的数据库, 当需要引用它们时调用这个数据库. 也有一些图形化的工具来管理的你引用数据库, 所以你需要要努力去对引用加代码, 而只是将它们改成不同的格式. 然而 BibTeX 在编译的时候变得比较复杂, 作为一个介绍, 你可以看在这个页面.
|
||||
|
||||
===== 插入数学公式 (Inserting mathematics) =====
|
||||
|
||||
在 LaTeX 插入数学公式的方法有几种. 最通常用的方法是内联记号(inline notation) 和 displaymath 环境 (displaymath environment).
|
||||
|
||||
==== 内联 记号(Inline) ====
|
||||
|
||||
在一个段落中插入数学符号, 而有不影响其它文本的格式, 将数学公式用 $ 符号括起来. 例如, , $a^2+b^2=c^2$ 是我们熟悉的公式.
|
||||
|
||||
==== Display math ====
|
||||
|
||||
displaymath 环境让你数学符号__单独占一行__. 代码
|
||||
|
||||
\[
|
||||
a^2+b^2=c^2
|
||||
\]
|
||||
|
||||
将创建一个段落分割和一个居中的方程.
|
||||
|
||||
==== Equation ====
|
||||
|
||||
equation 环境可以用来数学公式的编号和引用标记, 例如,
|
||||
|
||||
\begin{equation}
|
||||
a^2+b^2=c^2
|
||||
**\label{pythag}**
|
||||
\end{equation}
|
||||
|
||||
就像 displaymath 生成同样的方程, 但是它还会在右边生成一个编号, 并且你可以使用 \ref{pythag}来引用这个方程.
|
||||
|
||||
==== Equation array ====
|
||||
|
||||
eqnarray 环境能够允许你输入多行的公式, 并设定对齐点. 例如,
|
||||
|
||||
\begin{eqnarray}
|
||||
a&=&b+c\\
|
||||
d&=&e+f
|
||||
\end{eqnarray}
|
||||
|
||||
==== 数学记号 (Mathematical notation) ====
|
||||
|
||||
有一些命令来插入一些特殊的**数学算子和符号**. 它们可以在网上很容易的找到, 如果你不能想出一个有效的命令, Google查找一下. 下面有一些经常用的命令:
|
||||
|
||||
* 希腊字母: 一般来说, 它就是拼写的单词. 例如 \beta, \gamma 和 \epsilon. 大写则使用 \Gamma.
|
||||
* 特殊符号 (Misc symbols): \leftarrow (使用 \Leftarrow 得到一个双向肩头), \rightarrow, etc., \leftrightarrow (<==>, if and only if), <, >, \leq (less than or equal to), \geq (greater than or equal to)
|
||||
* 指数和分量 (Indexing and exponents): 下标使用下划线 (x_i) 和 上标使用 “^” (a^2). 为了使用 “i sub j comma k” 你只需要输入 “i_{j,k}” 来告诉 LaTeX “j,k”都是下标. 在LaTeX 中括号通常表示一组内容, 而它本身并不会在文档中出现.
|
||||
* 另外的一些算子: \sum{1/x} or \sum_{i=1}^{\infty}{x_i}, \prod (the product), \coprod (the coproduct), \sin, \log, \max, etc.
|
||||
* 修饰符号 (Decorations): \hat{x}, \tilde{x} , \overline{x}, \underline{x}, \overrightarrow{x}, \overbrace{x}, \underbrace{x}, \vec{x}
|
||||
* 分数 (Fractions): \frac{a}{b} puts a over b.
|
||||
* 括号 (Brackets): For brackets use “(”, “[” or \lbrace and \rbrace for “{” and “}”. However, if the notation that your typing is not inline, use \left( <math here> \right) or \left\lbrace <math here> \right\rbrace.
|
||||
* 矩阵 (Matrices) : 为了输入一个矩阵, 在display 或者 equation 环境下, 使用
|
||||
|
||||
\left[ \begin{array}{ccc}
|
||||
a & b & c \\
|
||||
d & e & f
|
||||
\end{array}\right]
|
||||
|
||||
注意array 环境的使用跟前面提到的表格环境很相似.
|
||||
|
||||
===== 进一步的参考 (For further reference) =====
|
||||
|
||||
上面的介绍只是 LaTeX 的一部分功能, 还有很多没有介绍, 推荐一个非常好的文档 The Not-So-Short Introduction to LaTeX (pdf).
|
||||
|
||||
===== 注记(Notes) =====
|
||||
|
||||
[1] 尽管LaTeX是用命令工作, 但例如 Scientific Word 是在图形界面上操作, 和 LyX 是一个非常好的开源, 基于 LaTeX 的 what-you-see-is-what-you-mean 的字处理系统, 它采用图形化界面但也允许使用LaTeX命令. 关于Lyx的介绍可一参见这里: LyX 和 LaTeX CJK 的配合, LyX和xetex中文的配置方法.
|
||||
[2] OpenOffice 可是使用 Calc2LaTeX 来将 Calc spreadsheets转化为 LaTeX 表格tables. MS Office 用户可尝试工具 Excel2LaTeX. 这些工具都是跨平台的 .LaTeX使用excel2latex插入表格
|
||||
[3] 为了创建一个贡献(attribution)脚注, 第一个脚注将用星号作标记, 使用 \thanks{text here}命令.
|
||||
62
Zim/LaTex/LaTeX发行版自带字体.txt
Normal file
@@ -0,0 +1,62 @@
|
||||
Content-Type: text/x-zim-wiki
|
||||
Wiki-Format: zim 0.4
|
||||
Creation-Date: 2011-09-24T16:15:21+08:00
|
||||
|
||||
====== LaTeX发行版自带字体 ======
|
||||
Created Saturday 24 September 2011
|
||||
http://blog.sina.com.cn/s/blog_5e16f1770100ludh.html
|
||||
|
||||
可能有不少人像我一样在用LaTeX不久就开始跟字体较劲。我走的是这样一个过程:
|
||||
- 最初用惯了Word,从而无法理解为什么LaTeX调用字体那么难;
|
||||
- 为了在LaTeX中调用字体,想用现有的工具一蹴而就(像TTFshape,MTFI,xGBKfonts),往往不能轻易成功,沮丧;
|
||||
- 之后重新静下心来逐渐了解了什么是字体,LaTeX中字体成功调用的方式,才注意到Mapping,TFM,vf等文件的相互关系,理顺了这一切后,把前面几个软件装不成功的字体装好(我印象中装上过Verdana,GE Quartz等几个);
|
||||
- 后来发现也有些宏包有现成的字体可用,那个时候主要就是关心TrueType字体,所以见到了winfonts宏包(这个宏包不在MiKTeX的宏包列表中),开始用上一些系统中有的字体;
|
||||
- 又发现OpenType字体更棒,再去看的时候才知道解包OpenType不但麻烦,还会失去glyphs;
|
||||
- 在一个相当漫长的时间内没有动过LaTeX,再碰它时,又是从一篇Philipp Lehman的《The font installation guide》开始,这篇文章100多页从头到尾看完,已经比较清楚如何用fontinst来安装手头拥有的Type1字体。也正是从这篇文章开始喜欢上了 Minion字体并且成功安装。由于安装过程相当繁琐,我还写了一些安装Type1字体的批处理,有时间的话会整理出来(因为通用性太差);
|
||||
- 再次碰字体就是在CTAN上看到MinionPro宏包,这时我已经开始搜集字体,所以MinionPro宏包要求的所有Optical Size我都有。MinionPro包特别大,装上它后刷新文件名数据库都慢几十秒,这也说明了OpenType字体的复杂性。我想要不是Adobe把这个经典字体免费提供,应该不会有谁有心去为它生成那么多的TFM文件(1511个之多)。Minion Pro字体对我而言真的是压倒性的,我估计学校允许的话我的论文都会申请用这个字体排版。
|
||||
- 后来XeTeX被port到Windows,我这才终于把MiKTeX升级到2.7beta,并且花了大量时间研究XeTeX。XeTeX似乎就是为字体而生的,但同样需要有字体的相关知识,这些知识并不同于前面Type1字体,而更多是字体的OpenType features,这些features,Type1字体要么是根本没有(calt, salt),有也不容易打开(smcp, onum)。
|
||||
|
||||
|
||||
但XeTeX同样有这样那样的问题,而且如果直接访问OpenType字体,编译速度就更不如PDFLaTeX访问Type1字体那么快,在长文章中表现得非常明显。所以才有了今天这个帖子,因为在这几天求助区的讨论过程中,自己又回去看了看。加上之前也注意到,其实打开$texmf/fonts目录就能发现LaTeX发行版中早就自带了不少字体,这些字体虽然是免费,功能上确不输专业字体。更重要的是,这些字体很多都是精心设计过的字体包,用来同时载入正文和数学环境的字体,保持文档统一的风格(在严谨的学术文章中,也确实不该想在哪改字体就在哪改)。
|
||||
|
||||
原来自己有个文本文件,就是记录机器上可以为我所用的现成字体包(主要来自于$texmf\doc\latex\psnfss\psnfss2e.pdf文档的介绍),但最近去到tug看过,早就有人写了完整的LaTeX字体巡礼:
|
||||
http://www.tug.dk/FontCatalogue/
|
||||
这个网站罗列了156个LaTeX中可以免费使用的字体,并且给出了例子和调用的源代码,需要注意的是这些字体并非默认安装在机器上,但至少都能从 CTAN得到——不光是宏包,还有字体文件(因为像winfonts,MinionPro这些宏包需要用户自己拥有相应的字体,CTAN上并没有)。不过拾人牙慧的工作还是要作,那就是推荐一下几个字体/字体包:
|
||||
|
||||
1. Palatino
|
||||
Will Robertson的文档总是用Palatino,这字体的名气也不小。胖胖的很活泼,笔锋也优雅,有羽毛笔的进化痕迹。LaTeX中最省事的是用\usepackage{mathpazo}来统一修改正文和数学字体,这个宏包还有[sc, osf]参数,分别对应小大写字母和不齐线数字。此外还有一个palatinox宏包可以直接调用Windows系统中的Palatino Linotype(这是微软认证发布赫尔曼·察普夫的原作),相关网址是:http://www.ctan.org/tex-archive/fonts/truetypemetrics/palatinox/%EF%BC%8C%E9%9C%80%E8%A6%81%E6%89%8B%E5%8A%A8%E5%AE%89%E8%A3%85%E3%80%82%E5%9C%A8%E8%BF%99%E4%B8%AAURL%E7%9A%84%E4%B8%8A%E4%B8%80%E5%B1%82%E8%BF%98%E8%83%BD%E7%9C%8B%E5%88%B0%E5%8F%A6%E4%B8%80%E4%B8%AA%E7%BB%8F%E5%85%B8%E5%AD%97%E4%BD%93frutiger%EF%BC%8C%E5%8F%AA%E6%98%AF%E6%88%91%E6%89%8B%E5%A4%B4%E6%B2%A1%E6%9C%89Linotype Frutiger。
|
||||
|
||||
2. Garamond
|
||||
1530年诞生的经典字体,LaTeX中通过mathdesign可以使用:\usepackage[garamond]{mathdesign}来使用。Garamond字体十分大气,打印在纸张上也特别好看,法国很多口袋图书用的是Garamond。
|
||||
需要注意的是虽说免费,URW的garamond字体在默认安装的发行版中可能不存在,但是可以下载到,例如
|
||||
http://ctan.binkerton.com/nonfree/fonts/urw/garamond/
|
||||
下载所有pfb文件
|
||||
ugmr8a.pfb ugmri8a.pfb ugmm8a.pfb ugmmi8a.pfb
|
||||
放到font\type1\里面的某个目录后刷新数据库即可
|
||||
|
||||
3. Times
|
||||
除了\usepackage{times}外,\usepackage{mathptmx}可以把数学字体也改成类似Times的字体。这个字体真的不需要再多说什么了,总之我觉得看久了眼睛会累,但是打印的效果非常稳妥。
|
||||
|
||||
4. Utopia
|
||||
Utopia有点像Times,但更宽敞一些。\usepackage{fourier}统一修改正文和数学字体为Utopia,\usepackage[adobe-utopia]{mathdesign}则是mathdesign的调用方法,差别不太明显。
|
||||
|
||||
5. Avant Garde/Courier/Bookman/New Century Schoolbook
|
||||
不是我懒,这几个字体在PSNFSS中是可以搭配着用的:
|
||||
\usepackage{avant}只载入Avant Garde
|
||||
\usepackage{bookman}则同时载入Bookman(衬线),Avant Garde(无衬线)和Courier(等宽)字体
|
||||
\usepackage{newcent}同时载入New Century Schoolbook(衬线),Avant Garde(无衬线)和Courier(等宽)字体
|
||||
|
||||
6. Charter
|
||||
十分饱满的衬线字体,适合屏幕阅读。\usepackage{charter}
|
||||
|
||||
7. Helvetica/Optima
|
||||
这两个字体放一块是因为我觉得它们是无衬线字体,比较适合用来作幻灯片。Helvetica可以\usepackage{helvet},Optima没有写成宏包的形式,就可以用\renewcommand{\sfdefault}{uop}然后\renewcommand* \familydefault{\sfdefault}来调用。在幻灯片这样的尺寸上,Optima变化的线宽才显现出优美来。
|
||||
(不过beamer的作者认为Optima不适合做幻灯片)
|
||||
|
||||
8. 其他数学宏包
|
||||
建议看看ftp://tug.ctan.org/pub/tex-archi ... t_Survey/survey.pdf 这篇文章,介绍得相当详细,而且有效果图展示。
|
||||
|
||||
9. Minion Pro
|
||||
http://tug.ctan.org/tex-archive/fonts/minionpro/ 有详细的安装说明,只要不出错是肯定能安上的,装了Acrobat Reader 7.0以上的用户都能在Acrobat安装目录下找到MinionPro-Bold.otf, MinionPro-BoldIT.otf, MinionPro-It.otf, MinionPro-Regular.otf这四个文件,按照安装说明拆解它们四个已经能满足日常文档的需要。此外,MnSymbol宏包(MiKTeX 可以自动安装)是配合Minion Pro的数学宏包,最好装上,不过\usepackage{MinionPro}就够了,会自动载入MnSymbol宏包。
|
||||
|
||||
其实用来用去才发现,LaTeX自带的这些字体才是真正经过时间和实践检验的经典字体,是TUG智慧的结晶。而且,这150多种字体也涵盖了绝大部分(LaTeX能触及到的)字体使用领域。这是不应该被遗忘的宝藏。
|
||||
176
Zim/LaTex/LaTeX学习笔记.txt
Normal file
@@ -0,0 +1,176 @@
|
||||
Content-Type: text/x-zim-wiki
|
||||
Wiki-Format: zim 0.4
|
||||
Creation-Date: 2011-09-26T20:44:39+08:00
|
||||
|
||||
====== LaTeX学习笔记 ======
|
||||
Created Monday 26 September 2011
|
||||
|
||||
===== 安装 =====
|
||||
|
||||
参考:http://www.nsknet.or.jp/~tony/TeX/install/win/tex.htm
|
||||
|
||||
===== 最简单的例子 =====
|
||||
|
||||
\documentclass[11pt]{jarticle}
|
||||
\textwidth=50mm
|
||||
\begin{document}
|
||||
あああああああああああああ
|
||||
\end{document}
|
||||
|
||||
如何将tex文件转化为pdf文档(日语):
|
||||
|
||||
platex xyz.tex
|
||||
dvipdfmx xyz.dvi
|
||||
|
||||
如何将dvi文件转化为gif/png:
|
||||
|
||||
dvipng --gif -T tight -D 200 xyz.dvi
|
||||
dvipng -T tight -D 200 xyz.dvi
|
||||
|
||||
省略 --gif 参数则输出为png格式。-D为放大百分比。
|
||||
|
||||
\documentclass: 文档类型;[11pt]:文档类型参数;{jarticle}:文档类型的值。两列分栏显示,则指定文档类型参数为[twocolumn,11pt]。
|
||||
|
||||
===== 页面布局 =====
|
||||
{{~/sync/notes/zim/LaTex/LaTeX学习笔记/pageFormating.png}}
|
||||
**页面基准点**:从纸的左上角算起,向右向下各移动 1inch(2.54cm) 处的点。通过该点的水平线称为**上基准线**,垂直线称为**左基准线**。
|
||||
|
||||
各种布局参数(参见the not so short of Latex)
|
||||
\topmargin 页眉上端到上基准线的距离。
|
||||
\headheight 页眉高度。
|
||||
\headsep 页眉下端到正文上端的距离。
|
||||
\topskip 正文上端到正文第一行的距离。
|
||||
**\textheight 正文的高度。**
|
||||
**\textwidth 正文的宽度。**
|
||||
\evensidemargin 偶数页(左页)中,正文的左端到左基准线的距离。
|
||||
\oddsidemargin 奇数页(右页)中,正文的左端到左基准线的距离。
|
||||
\footskip 正文下端到页脚下端的距离。
|
||||
\marginparwidth 页面右侧脚注的宽度。
|
||||
\marginparpush 页面右侧脚注之间的距离。
|
||||
\marginparsep 页面右侧脚注到正文的距离。
|
||||
\columnsep 二分栏时左右栏之间的距离。
|
||||
\columnseprule 二分栏时左右栏之间分隔线的宽度。
|
||||
|
||||
===== 页码 =====
|
||||
|
||||
==== 页码格式 ====
|
||||
|
||||
通过 \pagestyle{格式} 来指定页码格式。格式有以下几种:
|
||||
empty 空白页眉、页脚
|
||||
plain 空白页眉,但是在页脚的中央输出页码
|
||||
headings 空白页脚,但是在页眉输出页码、章节编号以及标题
|
||||
myheadings 自定义
|
||||
|
||||
通过 \renewcommand{**\thepage**}{\roman{page}}命令可以改变页码的格式。其中蓝色部分为定义颜色的命令,包括如下几种:
|
||||
\arabic 阿拉伯数字 1, 2, 3, ...
|
||||
\roman 罗马数字(小写) i, ii, iii, ...
|
||||
\Roman 罗马数字(大写) I, II, III, ...
|
||||
\alph 英文字母(小写) a, b, c, ...
|
||||
\Alph 英文字母(大写) A, B, C, ...
|
||||
|
||||
通过 \setcounter{page}{10} 可以将页码设置为10。
|
||||
|
||||
===== 多个文档的结合 =====
|
||||
|
||||
通过 \input{文档名} 命令可以结合多个文档。文档名不用带扩展名.tex。
|
||||
|
||||
===== 命令 =====
|
||||
|
||||
==== 命令的分类 ====
|
||||
|
||||
命令包括单独命令(命令单独使用)、环境命令(成对使用, 如begin{..}和end{..}),以及宏命令。
|
||||
|
||||
==== 命令的参数 ====
|
||||
|
||||
documentclass[11pt]{jbook},{}表 示必须参数,[]表示可选参数。
|
||||
|
||||
==== 命令的作用范围 ====
|
||||
|
||||
某些命令一旦声明,则对其后的所有文字均有效,称为__声明型命令__,例如斜体itshape,字号增大 Large等。将这一类命令用{}括起来可以规定其__作用范围__,例如
|
||||
|
||||
aaaa{\itshape bbbb{\Large ijkl}bbbb}aaaa
|
||||
|
||||
将显示为 aaaabbbbijklbbbbaaaa。
|
||||
|
||||
===== 其他 =====
|
||||
|
||||
**由文字结束的命令之后的空白将被忽视。**
|
||||
一些命令
|
||||
\itshape 斜体
|
||||
\normalfont 正常字体
|
||||
\sffamily 黑体?
|
||||
\Large 字号增大
|
||||
\LaTeXe 显示LaTeX2e的logo
|
||||
\\ 换行
|
||||
|
||||
===== 宏命令 =====
|
||||
|
||||
定义方法:newcommand{cmd}[arg]{def} 其中cmd为命令名,以开头,区分大小写,可 以使用汉字;arg为参数个数,最大为9;def为命令内容,其中可以使用#1、#2...#9的方式使用参数。
|
||||
|
||||
newcommand{mytest}[4]{$#1#4^2+#2#4+#3=0$} mytest{a}{b}{c}{x}
|
||||
|
||||
使用 renewcommand{cmd}[arg]{def} 可以重新定义命令。
|
||||
|
||||
===== 包 =====
|
||||
|
||||
包相当于外挂插件。用下面的命令调用:usepackage{包名}
|
||||
|
||||
===== 章节 =====
|
||||
|
||||
定义章节的命令
|
||||
部 part Level -1(书籍、报告),Level 0(论文)
|
||||
章 chapter Level 0
|
||||
节 section Level 1
|
||||
小节 subsection Level 2
|
||||
小小节 subsubsection Level 3
|
||||
段落 paragraph Level 4,标题之后不换行
|
||||
小段落 subparagraph Level 5,标题之后不换行
|
||||
|
||||
另外,用 setcounter{secnumdepth}{数字} 来设置**自动编号的深度**(即编号到哪一级别)。
|
||||
|
||||
===== 附录 =====
|
||||
|
||||
用 appendix 命令开始定义附录。附录内至少要有一个 chapter。
|
||||
|
||||
===== 目录 =====
|
||||
|
||||
用 tableofcontents 插入目录。一般在 tableofcontents 之后使用一个 __clearpage __以便在新的一页开始正文。 用 setcounter{tocdepth}{数字} 设置目录的显示级别。
|
||||
|
||||
===== 首行缩进 =====
|
||||
|
||||
使用 parindent=数字 可以定义该命令之后所有段落的首行缩进值。使用 noindent 可以暂时取消该命令之后的一个段落的首行缩进。
|
||||
|
||||
===== 换行、分段、换页 =====
|
||||
段内换行 \\
|
||||
设定行间距 \baselineskip=数字
|
||||
临时改变行间距 \\[增加值],例如\\[8mm]将使得该 行的行间距增加8mm。增加值可以为负数
|
||||
|
||||
分段 \par
|
||||
设定段间距 \parskip=数字
|
||||
换页 \clearpage
|
||||
|
||||
===== 空格 =====
|
||||
|
||||
空格包括句间空格和词间空格两种。句间空格要比词间空格稍大一些。
|
||||
|
||||
==== 句间空格 ====
|
||||
|
||||
__小写__字母后面跟标点符号时,该标点符号之后的空格被认为是句间空格。大写字母后面接标点符号,标点符号后的空格会被误认作是词间空格,此时需要在标 点符号之前插入 \@ 命令来强制LaTeX将后面的空格作为句间空格处理。例如
|
||||
|
||||
as well as I\@. Hence, ...
|
||||
|
||||
==== 词间空格 ====
|
||||
|
||||
书写缩写、省略号等情况下,点 . 之后的空格会被误认为是句间空格。使用 (空格) 代替普通的半角空格可以强制该空格为词间空格。例如
|
||||
|
||||
Yamada et al. wrote the report.
|
||||
|
||||
==== 不可分断空格 ====
|
||||
|
||||
**用 ~ 代替空格**,可使得排版时不会在此处换行。例如 Mr.~Lamport。也可以使用 mbox命令,例如 mbox{Minoru Sakaguchi}。
|
||||
|
||||
===== 对齐 =====
|
||||
|
||||
一行对齐:leftline{左对齐} centerline{居中} rightline{右对齐}
|
||||
多行对齐:begin{flushleft}...end{flushleft},begin{center}... end{center},begin{flushright}...end{flushright}
|
||||
|
||||
BIN
Zim/LaTex/LaTeX学习笔记/pageFormating.png
Normal file
|
After Width: | Height: | Size: 26 KiB |
164
Zim/LaTex/LaTex初学者模板.txt
Normal file
@@ -0,0 +1,164 @@
|
||||
Content-Type: text/x-zim-wiki
|
||||
Wiki-Format: zim 0.4
|
||||
Creation-Date: 2011-09-26T21:31:51+08:00
|
||||
|
||||
====== LaTex初学者模板 ======
|
||||
Created Monday 26 September 2011
|
||||
http://latex.yo2.cn/articles/latex-learning-3.htmlj
|
||||
% a4paper - A4纸 11pt -字体 twoside -双面 openany -新章节可在偶数页开始
|
||||
\documentclass[a4paper,11pt,twoside,openany]{article}
|
||||
%------------------------------纸张大小----------------------------------
|
||||
% 定义转换成pdf文档的纸张大小,应与\paperwidth \paperheight一致
|
||||
%\special{pdf: pagesize width 20cm height 30cm}
|
||||
% true的含义是保持尺寸不会随一些参数的变化而变化,具体可见Knuth的TeXbook
|
||||
%\paperwidth 20 true cm % 纸张宽
|
||||
%\paperheight 30 true cm % 纸张高
|
||||
%------------------------------页面布局----------------------------------
|
||||
%\textwidth 10 true cm % 正文宽
|
||||
%\textheight 20 true cm % 正文高
|
||||
%\headheight 14pt % 页眉高
|
||||
%\headsep 16pt % 页眉距离
|
||||
%\footskip 27pt % 页脚距离
|
||||
%\marginparsep 10pt % 边注区距离
|
||||
%\marginparwidth 100pt % 边注区宽
|
||||
%----------------------------页边空白调整-------------------------------
|
||||
\def\marginset#1#2{ % 页边设置 \marginset{left}{top}
|
||||
\setlength{\oddsidemargin}{#1} % 左边(书内侧)装订预留空白距离
|
||||
\iffalse % 如果考虑左侧(书内侧)的边注区则改为\iftrue
|
||||
\reversemarginpar
|
||||
\addtolength{\oddsidemargin}{\marginparsep}
|
||||
\addtolength{\oddsidemargin}{\marginparwidth}
|
||||
\fi
|
||||
|
||||
\setlength{\evensidemargin}{0mm} % 置0
|
||||
\iffalse % 如果考虑右侧(书外侧)的边注区则改为\iftrue
|
||||
\addtolength{\evensidemargin}{\marginparsep}
|
||||
\addtolength{\evensidemargin}{\marginparwidth}
|
||||
\fi
|
||||
|
||||
% \paperwidth = h + \oddsidemargin+\textwidth+\evensidemargin + h
|
||||
\setlength{\hoffset}{\paperwidth}
|
||||
\addtolength{\hoffset}{-\oddsidemargin}
|
||||
\addtolength{\hoffset}{-\textwidth}
|
||||
\addtolength{\hoffset}{-\evensidemargin}
|
||||
\setlength{\hoffset}{0.5\hoffset}
|
||||
\addtolength{\hoffset}{-1in} % h = \hoffset + 1in
|
||||
|
||||
\setlength{\voffset}{-1in} % 0 = \voffset + 1in
|
||||
\setlength{\topmargin}{\paperheight}
|
||||
\addtolength{\topmargin}{-\headheight}
|
||||
\addtolength{\topmargin}{-\headsep}
|
||||
\addtolength{\topmargin}{-\textheight}
|
||||
\addtolength{\topmargin}{-\footskip}
|
||||
\addtolength{\topmargin}{#2} % 上边预留装订空白距离
|
||||
\setlength{\topmargin}{0.5\topmargin}
|
||||
}
|
||||
% 调整页边空白使内容居中,两参数分别为纸的左边和上边预留装订空白距离
|
||||
\marginset{10mm}{12mm}
|
||||
%-----------------------------字体支持-----------------------------------
|
||||
\usepackage{times} % 使用 Times New Roman 字体
|
||||
\usepackage{CJK,CJKnumb,CJKulem} % 中文支持宏包
|
||||
%\usepackage{ccmap} % 使pdfLatex生成的文件支持复制等
|
||||
%\usepackage[mtbold,mtpluscal,mtplusscr]{mathtime}%数学环境用Times New Roman
|
||||
%-----------------------------页眉页脚-----------------------------------
|
||||
\usepackage{fancyhdr} % 页眉页脚相关宏包
|
||||
\pagestyle{fancy} % 页眉页脚风格
|
||||
%-----------------------------段落字体格式-------------------------------
|
||||
\usepackage{color} % 支持彩色
|
||||
\usepackage{indentfirst} % 首行缩进宏包
|
||||
%\setlength{\parindent}{2em} % 段落缩进
|
||||
\setlength{\parskip}{0.7ex plus0.3ex minus0.3ex} % 段落间距
|
||||
%\linespread{1.2} % 行距倍数
|
||||
\renewcommand{\baselinestretch}{1.2} % 行距倍数(同上)
|
||||
%\renewcommand{\CJKglue}{\hskip 0pt plus 0.08\baselineskip} % 汉字字距
|
||||
%\newcommand{\aaa}{这是测试} % 自定义文字块例子
|
||||
\newcommand{\song}{\CJKfamily{song}} % 宋体
|
||||
\newcommand{\hei}{\CJKfamily{hei}} % 黑体
|
||||
\newcommand{\fs}{\CJKfamily{fs}} % 仿宋
|
||||
\newcommand{\kai}{\CJKfamily{kai}} % 楷体
|
||||
\newcommand{\li}{\CJKfamily{li}} % 隶书
|
||||
\newcommand{\you}{\CJKfamily{you}} % 幼圆
|
||||
\newcommand{\wuhao}{\fontsize{10.5pt}{12.6pt}\selectfont} % 五号字体
|
||||
\newcommand{\xiaosi}{\fontsize{12pt}{14pt}\selectfont} % 小四字体
|
||||
\newcommand{\sihao}{\fontsize{14pt}{\baselineskip}\selectfont} % 四号字体
|
||||
%\marginparpush %
|
||||
%-----------------------------超链接和标签-------------------------------
|
||||
\iffalse % 将这里改为\iftrue即可使用
|
||||
\ifx\pdfoutput\undefined % Not run pdftex
|
||||
% \ifx
|
||||
% \usepackage[dvips]{hyperref}
|
||||
% \else
|
||||
\usepackage[dvipdfm]{hyperref}
|
||||
% \fi
|
||||
\AtBeginDvi{\special{pdf:tounicode GBK-EUC-UCS2}} % GBK -> Unicode
|
||||
\else
|
||||
\usepackage[pdftex]{hyperref}
|
||||
\fi
|
||||
\hypersetup{CJKbookmarks,%
|
||||
bookmarksnumbered,%
|
||||
colorlinks,%
|
||||
linkcolor=blue,%
|
||||
citecolor=blue,%
|
||||
hyperindex,%
|
||||
plainpages=false,%
|
||||
pdfstartview=FitH}
|
||||
\fi
|
||||
%--------------------------------注释------------------------------------
|
||||
\iffalse % 将这里改为\iftrue即可使用
|
||||
%注释掉一段内容
|
||||
\usepackage{verbatim}
|
||||
\begin{comment}
|
||||
This is a comment example.
|
||||
\end{comment}
|
||||
\fi
|
||||
%\makeatletter % @ is now a normal "letter" for Tex
|
||||
%\makeatother % @ is restored as a "non-letter" for Tex
|
||||
%--------------------------------其他宏包--------------------------------
|
||||
%\usepackage{amsmath,amsthm,amsfonts,amssymb,bm} % 数学宏包
|
||||
%\usepackage{graphicx,psfrag} % 图形宏包
|
||||
%\usepackage{makeidx} % 建立索引宏包
|
||||
%\usepackage{listings} % 源代码宏包
|
||||
%---------------------------------正文-----------------------------------
|
||||
\begin{document} % 开始正文
|
||||
% song-宋体 hei-黑体 fs-仿宋 kai-楷体 li-隶书 you-幼圆 com为 song+hei
|
||||
\begin{CJK*}{GBK}{com} % 开始中文环境
|
||||
\CJKtilde % 重定义~代表的空白距离
|
||||
\CJKindent % 段首缩进
|
||||
\CJKcaption{GB} % 中文章节标题
|
||||
\author{ceo} % 作者
|
||||
\title{一个latex例子} % 题目
|
||||
\maketitle % 生成标题
|
||||
%\thispagestyle{empty} % 设置首页的页眉页脚风格
|
||||
%\setlength{\baselineskip}{3ex plus1ex minus1ex} % 调整行距
|
||||
|
||||
\TeX{}~是由图灵奖得主\index{Knuth, Donald E.}~Donald E. Knuth\cite{texbook}~
|
||||
编写的计算机程序,用于文章和数学公式的排版。
|
||||
|
||||
1977~年~Knuth~开始编写~\TeX{}~排版系统引擎的时候,\\ % 换行
|
||||
是为了探索当时正开始进入出版工业的数字印刷设备的潜力。 \newline % 换行
|
||||
他特别希望能因此扭转那种排版质量下降的趋势,使自己写的书和文章免受其害。
|
||||
|
||||
\noindent % 不缩进
|
||||
% 下面是特殊字符 # $ % ^ & _ { } ~ \ ... 的输入
|
||||
\# \$ \% \^{} \& \_ \{ \} \~{} $\backslash$ \ldots
|
||||
|
||||
\indent % 恢复缩进
|
||||
%不用CJKulem包时,\textit{我a} 或 \emph{我a} 或 {\em 我a}使英文斜体、中文变字体
|
||||
% 用CJKulem包后,\textit{我a} 依然是英文斜体、中文变字体,后两者变为加下划线
|
||||
\textit{中文textit} \emph{中文emph} {\em 中文em}
|
||||
\textbf{粗体textbf} % 粗体,对于中文推荐用黑体字代替粗体
|
||||
\uline{下划线uline} % 下划线(需要CJKulem包)
|
||||
\textcolor{yellow}{黄yellow} % 颜色(需要color包)
|
||||
{\color{blue}蓝blue} {\color{red}红red} {\color{green}绿green}
|
||||
{\hei 黑体}{\sihao 四号} {\song\xiaosi 宋体小四} % 字体大小
|
||||
{\tiny hi} {\small hi} {\normalsize hi} {\large hi} {\Large hi} {\huge hi}
|
||||
|
||||
\clearpage % 换页,\newpage也可以,推荐\clearpage
|
||||
我们现在使用的~\TeX{}~系统是在~1982~年发布的,1989~年又略作改进,增进了
|
||||
对~8~字节字符和多语言的支持。\TeX{}~以具有优异的稳定性,可以在各种不同
|
||||
类型的计算机上运行,以及几乎没有错误而著称。\TeX{}~的版本号不断趋近于~$\pi$,
|
||||
现在为$3.14159$。
|
||||
|
||||
\clearpage
|
||||
\end{CJK*} % 结束中文环境
|
||||
\end{document} % 结束正文
|
||||
180
Zim/LaTex/Latex_Companion读书笔记.txt
Normal file
@@ -0,0 +1,180 @@
|
||||
Content-Type: text/x-zim-wiki
|
||||
Wiki-Format: zim 0.4
|
||||
Creation-Date: 2011-09-26T20:18:40+08:00
|
||||
|
||||
====== Latex Companion读书笔记 ======
|
||||
Created Monday 26 September 2011
|
||||
http://simon-guo.blogspot.com/2009/01/latex.html
|
||||
|
||||
===== LaTeX基本操作 =====
|
||||
\hyphenation{word list} %断字命令;
|
||||
\showthe\topmargin %显示某个参数的数值或者内容;
|
||||
|
||||
在tex编译过程中出现行溢出(overflow hbox)是由于断字程序不知道在何处进行断字,可以使用如下命令来减少这样的问题,
|
||||
\sloppy这样会降低断字标准,使输出不如默认状态下的输出出色,可以使用\fussy命令来回复到原始状态;
|
||||
如果想查看哪一行发生了行溢出,可以在文档类中加入[draft]参数。
|
||||
\frontmatter \mainmatter \& \backmatter \appendix修改文章的页码标记方式
|
||||
\frontmatter %在文章正文之前使用罗马数字标记页码;
|
||||
\mainmatter %文章正文用阿拉伯数字标记;
|
||||
\backmatter %文章的结尾部分用
|
||||
\label \ref \pageref %用来生成文章的标记和引用;
|
||||
|
||||
===== 列表: =====
|
||||
\itemize \enumberate \description \list %可以通过参数改变列表的编号;
|
||||
\flushleft \flushright \center %段落的对齐方式;
|
||||
\quote \verse \quotation %引用命令;
|
||||
\verbatim 和 verbatim 这个package; %逐字打印命令和软件包;
|
||||
\verbatiminput{filename} %可以将Ascii文件嵌入到当前文件中来;
|
||||
\tabular \longtabular \supertabular %表格命令;
|
||||
表格和图片的浮动体环境可以将图片或者表格放置到合适的位置
|
||||
|
||||
页面的格式:\pagestyle %页面格式主要包括页码的显示位置和页眉的显示方式等;
|
||||
normal
|
||||
headings
|
||||
no
|
||||
myheadings %自定义显示方式;
|
||||
\markboth{leftPage}{rightpage} %分别标记左右页眉;
|
||||
fancy %需要用到fancyhdr 这个package;
|
||||
用法如下:
|
||||
\fancyhf{} % delete current setting for header and footer
|
||||
\fancyhead[LE,RO]{\bfseries\thepage}
|
||||
\fancyhead[LO]{\bfseries\rightmark}
|
||||
\fancyhead[RE]{\bfseries\leftmark}
|
||||
|
||||
使用\fancyhdr来定制文档的页眉和页脚;
|
||||
\rightmark %当前的节名;
|
||||
\leftmark %当前的章名;
|
||||
\chaptermark \sectionmark \subsectionmark命令用来定义\leftmark和\rightmark;
|
||||
|
||||
===== 和LaTeX相关的文件扩展名: =====
|
||||
.tex LaTeX源文件;
|
||||
.sty Package 文件;
|
||||
.dtx 文档化的TeX文件;
|
||||
.ins .dtx的安装文件;
|
||||
.dvi 设备无关文件;
|
||||
.log 编译时的信息;
|
||||
.toc 生成目录需要的文件,改文件存储了章节标题;
|
||||
.lof 生成图片列表的文件;
|
||||
.lot 生成表格列表的文件;
|
||||
.aux 一个向下次编译传递信息的辅助文件;改文件通常还包含交叉引用信息;
|
||||
.idx 生成索引用到的辅助文件;
|
||||
|
||||
===== LaTeX扩展: =====
|
||||
新建命令\newcommand{name}[num][defaultA, defaultB]{definitions}
|
||||
num用来指定命令能接受的参数的个数,如果不给定,新建的命令将不会接受任何参数;
|
||||
如果num不为0,则必须给定num个数的参数,如果参数为空,必须加一个{},并存在num个{};
|
||||
defaultA和defaultB用来定义一个optional的参数,如果参数的个数小于num,则会使用optional的参数;
|
||||
\newcommand %命令不能创建已经存在的命令,如果要修改现有的命令可以使用\renewcommand命令来实现;
|
||||
\providecommand %命令用来创建命令,如果该命令已经存在则其将被忽略;
|
||||
|
||||
===== 新建环境 =====
|
||||
\newenvironment{name}[num]{before}{after}
|
||||
before 和after分别是该命令开始和结尾的定义;
|
||||
\newenvironment的用法和\newcommand的用法比较类似;
|
||||
|
||||
可以将自己定义的命令和环境放到一个文件中,其他文件就可以以package的形式来引用在该文件中定义的命令
|
||||
Package的定义如下:
|
||||
\ProvidePackage{demo}
|
||||
\newcommand{cmd1}{}
|
||||
\newcommand{cmd2}{}
|
||||
\newenvironment{env1}{\beforecmd}{\endcmd}
|
||||
|
||||
===== 字体操作 =====
|
||||
字体: %如果遇到既要改变字体也要改变字号的情况,则应首先改变字号的大小;然后改变字体;
|
||||
\textrm{...} roman \textsf{...} sans serif
|
||||
\texttt{...} typewriter
|
||||
\textmd{...} medium \textbf{...} bold face
|
||||
\textup{...} upright \textit{...} italic
|
||||
\textsl{...} slanted \textsc{...} small caps
|
||||
\emph{...} emphasized \textnormal{...} document font
|
||||
|
||||
===== 字体尺寸: =====
|
||||
\tiny tiny font
|
||||
\scriptsize very small font
|
||||
\footnotesize quite small font
|
||||
\small small font
|
||||
\normalsize normal font
|
||||
\large large font
|
||||
\Large larger font
|
||||
\LARGE very large font
|
||||
\huge huge
|
||||
\Huge largest
|
||||
|
||||
===== 字体的绝对大小: =====
|
||||
\tiny 5pt 6pt 6pt
|
||||
\scriptsize 7pt 8pt 8pt
|
||||
\footnotesize 8pt 9pt 10pt
|
||||
\small 9pt 10pt 11pt
|
||||
\normalsize 10pt 11pt 12pt
|
||||
\large 12pt 12pt 14pt
|
||||
\Large 14pt 14pt 17pt
|
||||
\LARGE 17pt 17pt 20pt
|
||||
\huge 20pt 20pt 25pt
|
||||
\Huge 25pt 25pt 25pt
|
||||
|
||||
字体使用的建议:文档中字体使用的越多,文档越漂亮;
|
||||
|
||||
===== 文档对象的间隔 =====
|
||||
修改行距:
|
||||
\linespread{factor} 例如\linespread{1.6}产生2倍行距;
|
||||
\baselinestretch{num} %改变行间距;
|
||||
\ziju{num} %中文(CCT)改变字间距的方式,该命令不会影响英文的字距;
|
||||
|
||||
===== 设置首行缩进和段落间距: =====
|
||||
\setlength{parindent}{0pt} %设置首行缩进为0;
|
||||
\setlength{parskip}{1ex} %设置段落间距为1ex;
|
||||
\ccwd %一个汉字的宽度,在中文(CCT)环境中使用;
|
||||
|
||||
===== 单词和句子之间的距离 =====
|
||||
水平距离\hspace{length} %可以用该命令插入一个水平间距;
|
||||
垂直距离\vspace{length} %该命令可以用来改变两个段落之间的垂直间距;
|
||||
\stretch{length} %定义一个将一行宽度充满的橡皮长度;系统会根据当前的状态赋值;
|
||||
\bigskip 和\smallskip %获得一个预定义的垂直距离;
|
||||
|
||||
===== 修改页面布局 =====
|
||||
页面的布局是通过一系列的参数来控制的,我们可以通过修改这个参数的数值来修改页面布局;
|
||||
页面布局参数主要有:
|
||||
\hoffset %正文的水平偏移;
|
||||
\voffset %正文的垂直偏移;
|
||||
\oddsidemargin %奇数页正文和侧栏之间的距离;
|
||||
\evensidemargin %偶数页正文和侧栏之间的距离;
|
||||
\topmargin %
|
||||
\headheight
|
||||
\headsep
|
||||
\textheight
|
||||
\textwidth
|
||||
\marginparsep
|
||||
\marginparwidth
|
||||
\footskip
|
||||
|
||||
===== 修改页面参数的命令有: =====
|
||||
\setlength{parameter}{length}
|
||||
\addtolength{parameter}{length}
|
||||
|
||||
===== LaTeX中的盒子操作 =====
|
||||
\parbox[pos]{width}{text} %将段落放到一个盒子中;
|
||||
\makebox[width][pos]{text} %将文本放到一个width宽度位于pos的盒子中;
|
||||
\framebox[width][pos]{text} %和\makebox命令类似,不同之处在于盒子内部的文本有矩形框;
|
||||
\raisebox{lift}[depth][height]{text} %用来控制盒子在垂直方向的距离;
|
||||
\rule[lift]{width}{height} %用来生成水平方向和垂直方向的线条;
|
||||
|
||||
===== 文章结构命令 =====
|
||||
\part{} %部分;
|
||||
\chapter{} %章;
|
||||
\section{} %
|
||||
\subsection{}
|
||||
\subsubsection{}
|
||||
\paragraph{} %段落
|
||||
\subparagraph{} %子段落;
|
||||
|
||||
解读sty|cls文件 %风格,样式文件定义;
|
||||
article.sty %文章风格;
|
||||
- art10.sty %10pt;
|
||||
- art11.sty %11pt;
|
||||
- art12.sty %12pt;
|
||||
article.cls %2e版本的article样式文件;
|
||||
- size10.clo %10pt,对应art10.sty;
|
||||
- size11.clo %11pt, 对应art11.sty;
|
||||
|
||||
===== 常用\LaTeXe工具包 =====
|
||||
\usepackage{indenrst} %首行缩进工具包;indenrst.sty;
|
||||
92
Zim/LaTex/TeX_相关名词的不完全考察.txt
Normal file
@@ -0,0 +1,92 @@
|
||||
Content-Type: text/x-zim-wiki
|
||||
Wiki-Format: zim 0.4
|
||||
Creation-Date: 2011-09-07T20:33:52+08:00
|
||||
|
||||
====== TeX 相关名词的不完全考察 ======
|
||||
Created Wednesday 07 September 2011
|
||||
http://lyanry.is-programmer.com/posts/513.html
|
||||
TeX
|
||||
|
||||
TeX 是二十世纪七十年代末,Donald E. Knuth(高德纳) 开发的一个排版程序。
|
||||
|
||||
TeX 首先是一个程序,它可以将一种标记语言文本处理成一种可用于打印或屏幕阅读的文档,比如 DVI 文件、PS 文件或者 PDF 文件。在概念不发生混淆的时候,我们将 TeX 所能够处理的那套标记语言也叫做 TeX。
|
||||
|
||||
我们学习 TeX,通常是指使用 TeX 标记语言来写源文档,这个过程可以称作”排版“。排版结束后,将所写的源文档交给 TeX 程序处理(编译),最终输出 DVI 文件、PS 文件或 PDF 文件等格式。
|
||||
|
||||
比如说下面有一份文件名为 hello.tex 的 TeX 源文档,其内容如下:
|
||||
Hello World!
|
||||
\bye
|
||||
|
||||
上面 TeX 源文档的第一行是文档的正文文本。第二行是一个 TeX 标记,它的作用是告诉 TeX 程序:“这里已经是文档末尾,处理完后您就可以退出了。” 要使用 TeX 程序对该文档进行处理,可在终端(控制台)运行以下命令:
|
||||
$ tex hello.tex
|
||||
|
||||
完后就可以得到一份 hello.dvi 文件。这份文件的内容很简单,只有一串 “Hello World!” 文本。
|
||||
|
||||
由于 TeX 程序会根据 TeX 源文档中的各种标记来生成相应的排版格式,这个过程可以看作是 TeX 标记指示 TeX 程序来完成各项排版任务,所以下文中就将 TeX 标记统一称为 “TeX 排版指令” 或简称为 “TeX 指令”。另外,习惯上将 TeX 程序称为 “TeX 引擎”
|
||||
|
||||
TeX 指令大概有 300 多条,使用这些指令可以实现科技文档、乐谱、棋谱、文学作品等各式各样的文档排版,简直是无所不能了。
|
||||
Plain TeX
|
||||
|
||||
使用 TeX 指令排版文档,就好像是我们使用筷子来吃饭,年幼时可能很不方便,假以时日,娴熟之后,管你是炒、炸、蒸、煮,一双筷子统统拿下。但是对于西餐而言,使用筷子来吃也是可行的,但这终归是不方便的,还是老老实实地刀子、叉子并用才使得。同理,TeX 指令用于排版一些专业领域的文档,也是不方便的,人们希望在撰写自己专业领域的知识文档时,能够有一套量身定做的排版指令。
|
||||
|
||||
TeX 系统的开发者 Knuth 意识到了这个问题,就在 TeX 指令的基础上,又添加了 600 多条复合指令,称之为 Plain TeX 指令。一条 Plain TeX 指令实际上是由多条 TeX 指令复合而成的,这是利用 TeX 指令的宏机制来实现的。
|
||||
|
||||
对于不大懂计算机编程的同学,对于宏也许不是很了解,这里也有一个比喻可以帮助你来理解。给你一套积木,让你组装成一个房子的模型,我们可以将你组装好的房子模型称为积木的“宏”。TeX 指令就好比积木,Plain TeX 指令就好比积木组装成的房子模型,所以 Plain TeX 指令就是 TeX 指令的宏。这里头有点弯弯绕,仔细体会应该能明了的。对于一套基于 TeX 指令实现的宏指令,通常称之为 TeX 宏包。
|
||||
|
||||
总之要清楚这样一个概念,Plain TeX 仅仅是一个 TeX 宏包,其诞生的目的是为了便于使用 TeX 排版。由于 Plain TeX 是 Knuth 写的,很权威,所以后来就将这 600 多条的 Plain TeX 指令与 300 多条的 TeX 指令合在一起构成了 TeX 标准指令集。
|
||||
Knuth TeX
|
||||
|
||||
当 Knuth 感觉 TeX 系统已经足够稳定与完善之时,宣布 TeX 项目冻结,以后只进行 bug 的修正。由于 TeX 系统的源代码一直都是公开的, Knuth 欢迎他人将 TeX 继续改进成为更好的排版程序。只是出于能够兼容 Knuth TeX 指令的目的,也或许为了满足他个人对于完美的追求,Knuth 设计了一个测试,对于 TeX 的改进版本,只有通过这项测试,才能以 "TeX" 命名,否则就必须换个名字。
|
||||
|
||||
我们可以将Knuth 开发的 TeX 程序+TeX 指令集+Plain TeX 宏指令集统称为 Knuth TeX。
|
||||
NTS 、 e-TeX 与 ExTeX
|
||||
|
||||
NTS (New Typesetting System) 项目的任务就是要继续扩展 TeX。这个项目由德国 TeX 用户组织于 1992 年发起,后来不知怎么回事一直拖到 1998 年才算是真正地开始,并计划使用 Java 将 Knuth TeX 重新实现与改进(Knuth TeX 是使用 WEB 语言实现的,WEB=Pascal+TeX)。在 1999 年至 2000 年间,NTS 项目的运作比较积极。但是后来又不知怎么回事,到了现在的 2007 年,这个项目又一直没有什么动静了。
|
||||
|
||||
e-TeX 最初是 NTS 项目的一个并行项目,由 NTS 项目组成员负责,后来转由 Peter Breitenlohner 负责。e-TeX 项目的主要任务是对 TeX 进行扩展,在 Knuth TeX 的基础上又增加了许多有用的排版指令。
|
||||
|
||||
e-TeX 与 NTS 的区别在于:前者只是对 Knuth TeX 进行修修补补,而后者是计划使用 Java 语言对 TeX 重新实现并加以改进。从我所阅读的材料来看,NTS 项目基本上已经败落,而 e-TeX 则是下文要讲到的 LaTeX、pdfTeX 等项目的重要基础。
|
||||
|
||||
2002 年,德国,一些专家和开发人员组织成一个小团体,发起了 ExTeX 项目。ExTeX 项目是基于 NTS 的,并借鉴了 e-TeX、pdfTeX、Ω (Omega) 等项目的经验,它的理想是实现一个新的基于 Java 实现的 TeX。这个项目,现在依然在运作中,但愿它能很好的生存下去。
|
||||
LaTeX
|
||||
|
||||
由于 Knuth 写的 Plain TeX 宏包虽然比最初的 TeX 指令集高级了一些,但它还是过于停留在排版的层次上,而不是从文档撰写者的角度出发,强调文档内容的逻辑性而不是格式。就像对于吃西餐,对于大多数人而言,只希望有一套真正的刀子和叉子就可以了,因为他们真正的目的是吃西餐,而不是研究如何基于筷子的原理寻找制造出刀子和叉子的方法。所以,在 Knuth TeX 出现后没有几年,Leslie Lamport 便基于 Knuth TeX 指令集 (TeX 指令集+Plain TeX 宏包) 开发了 LaTeX 宏包。
|
||||
|
||||
LaTeX 的出现,主要目的是简化 TeX 的使用,让文档撰写者有更多的精力集中在文档内容的写作上。譬如 LaTeX 可以自动给出文档的标题,章节, 表格目录,交叉索引,公式编号, 文献引用,浮动图表等。另外 LaTeX 也强调了文档的格式与内容的分离,它鼓励文档撰写者将文档的格式单独集中在一些文档中,在写文档时,只需要少许指令加载这些格式文档即可对所撰写的文档进行格式化排版。如果你大概知道一些 HTML 与 CSS 的知识,那么就可以很好地明白 LaTeX 所提倡的格式与内容分离的观念。
|
||||
|
||||
LaTeX 自问世以来,也在不断地发展着。LaTeX 最初的正式版本为 2.09,在经过几年的发展之后,许多新的功能,机制被引入于其中。但是用户在享受 LaTeX 这些新功能所带来的便利之时,它所伴随的副作用也开始显现,这就是许多宏包的不兼容性,譬如标准的 LaTeX 2.09、引入了“新字体选择机制”(NFSS) 的 LaTeX 、SLiTeX、AMSLaTeX 等宏包相互之间无法兼容,这给 LaTeX 使用者和维护者都带来很大的麻烦。
|
||||
|
||||
为结束 LaTeX 宏包之间兼容性糟糕的状况,Frank Mittelbach 等人发起了 LaTeX3 项目,目标是建立一个最优的、有效的、统一的、标准的指令集。这是一个长期目标,向这个目标迈出第一步就是在 1994 年发布的 LaTeX2e。LaTeX2e 采用了 NFSS 作为标准,加入了很多新的功能,同时还兼容旧的 LaTeX 2.09。LaTeX2e 每 6 个月更新一次,修正发现的错误并加入一些新的功能。
|
||||
|
||||
在 LaTeX 3 最终完成之前,LaTeX2e 将是标准的 LaTeX 版本。我们现在所指的 LaTeX,通常是指 LaTeX2e。
|
||||
|
||||
还要注意一点,LaTeX2e 宏包的底层也不再是基于 Knuth TeX 指令集来实现了,而是基于 e-TeX,所使用的 TeX 引擎也不再是 Knuth 所开发的那个 TeX 程序了,至少我所知的 TeX Live 套件中 LaTeX 所使用的 TeX 引擎是 pdftex。至于什么是 TeX Live 与 pdftex,在下文中会讲到的。
|
||||
PDFTeX
|
||||
|
||||
1997 年,Han The Thanh 基于 Knuth TeX 实现了 PDFTeX。
|
||||
|
||||
PDFTeX 在实现上可以分为两个模块。一个模块保留了原先Knuth的所有代码,可以按照 Knuth TeX 那样直接输出 dvi 文档。另一个模块主要是实现基于 TeX 源文档直接输出 pdf 文档,在该模块的实现中,加入了大量的 C 代码;通过与 C 库的连接,可以处理一些简单的问题,比如插入各种格式的图片等。
|
||||
|
||||
PDFTeX 在算法上面比较的杰出方面,是 HZ 特性(具体是什么,我也不清楚),可以取得较好的排版效果。
|
||||
|
||||
在 TeXLive 套件中,etex、latex、pdfetex、pdflatex、pdfelatex 等命令都是指向 pdftex 命令的连接。
|
||||
|
||||
对于目前较为流行的绘图宏包 PGF/TikZ,还有用于制作演示文档的 Beamer 宏包,也都对 PDFTeX 提供了最好的支持。另外 ConTeXt 也力推使用 PDFTeX 作为 TeX 引擎。
|
||||
|
||||
这也许能够说明,PDFTeX 已经成为目前 TeX 引擎的事实标准。目前该项目已被 PDF 项目组承接过去继续开发。
|
||||
ConTeXt
|
||||
|
||||
ConTeXt 是基于 TeX 实现的一个宏包,其设计目的与 LaTeX 类似,但是它远比 LaTeX 年轻,因此也更能跟随 TeX 的一些新生功能;在设计上也相对统一,不像 LaTeX 那样容易出现某些宏包相互冲突的现象。ConTeXt 给予了用户更强大的文档布局控制能力,即便用户并不怎么了解 TeX。
|
||||
|
||||
ConTeXt 集成了 MetaFun,作为矢量图形绘制语言。MetaFun 是 MetaPost 的超集,可以独立使用,也可以用于 ConTeXt 文档布局,可以实现精妙的排版效果。
|
||||
|
||||
ConTeXt 允许用户使用不同种语言的用户界面,即 ConTeXt 排版指令可以用多种语言表述,目前支持英语、荷兰语、德语、法语以及意大利语。在不改变用户界面的情况下,ConTeXt 也可以调用不同的 TeX 引擎对源文档进行处理。
|
||||
|
||||
ConTeXt 项目运作的非常积极,开发者非常注重自由软件开发哲学——经常发布,有时一天会发布两次。
|
||||
Small_feed 评论 (2)
|
||||
1
|
||||
[回复]
|
||||
Avatar_small
|
||||
yulewang 说:
|
||||
2007年11月01日 23:25 呵呵,参考我的文章以后要注明哦....比如pdftex当中的很多介绍,是参考我在水木上的文章吧。 HZ特性,或者叫HZ算法,是字体设计大师Zapf设计的两个使得排版更加漂亮的算法。可以说都是基于Knuth的badness定义的断行算法的改进。第一个算法是margin kerning,可以允许标点符号比如逗号或者hyphen放到margin线上,这样的话,不但使得margin线的区域在肉眼看来更加整齐(事实上是不整齐),而且也使得断行效果更好(这个容易理解,行距事实上被增大了,所以badness会减小)。第二个算法是font expansion,就是当某行badness比较大时,适当地增大或者减小字体轮廓曲线(当然这个得保证改变量如此小以至于肉眼看不出来),而使得字体box长度发生变化,而达到减小badness的目的。 >目前该项目已被 PDF 项目组承接过去继续开发。没有PDF项目组,是LuaTeX team。pdftex和luatex的开发组是相同的,LuaTeX是pdfTeX的一个后继者。
|
||||
|
||||
47
Zim/LaTex/TeX_系统的演变.txt
Normal file
@@ -0,0 +1,47 @@
|
||||
Content-Type: text/x-zim-wiki
|
||||
Wiki-Format: zim 0.4
|
||||
Creation-Date: 2011-09-07T20:14:43+08:00
|
||||
|
||||
====== TeX 系统的演变 ======
|
||||
Created Wednesday 07 September 2011
|
||||
http://lyanry.is-programmer.com/posts/332.html
|
||||
原文见王越的 google pages,本文仅将其原有繁体中文转换为简体,把原文中的英文标点转换为中文标点,原文中一些词句,我认为有错误,就对其进行修订。
|
||||
|
||||
当年,高爷爷发现出版社将他的巨著 TAOCP 排版得乱七八糟,因此,立志编写出一套计算机排版系统,来发挥计算机排印的潜能。这套系统,就被他称作为 TeX。如今,TeX 已经在全世界得到广泛的应用,和高爷爷高超的技术是分不开的。
|
||||
|
||||
TeX 系统的思想,起源于高爷爷在斯坦福大学的一个叫做文学编程的试验。所谓文学编程,和今天的 python 编程类似,也就是说,编写程序和编写文档是一个统一的过程,编写完的程序,通过编译器,就能够被编译执行;同时,如果通过一个文本生成程序,就能够得到该程序的技术资料。
|
||||
|
||||
TeX就是在这种环境下,被高爷爷弄出来的。而这种编程思想,就是体现在一种叫做 WEB 的语言上。WEB 语言的特别之处,就是当 WEB 文件通过不同的命令,就能够生成不同的东西。经过几年的发展,WEB 语言成型,同时 TEX 系统成型。
|
||||
|
||||
WEB 语言究竟是什么东西?事实上,就是一个 WEB 文件同时包含了 TEX 文档和 Pascal 语言,当 WEB 文件被 tangle 命令处理的时候,我们就得到了一个 pascal 语言文件,这个文件,可以直接被 pascal 编译器编译后执行。而对 WEB 文件使用 weave 命令进行处理,可得到 TeX 文档,这个文档由 tex 命令处理后,生成 dvi 文件,可用于打印。
|
||||
|
||||
TeX 系统,就是用这么一个 WEB 语言写就的,如果您对于这个怎么互相循环感到奇怪,那您不妨想象 C 语言编译器也是用 C 语言写就的。这是一个循序渐进、不断添加新指令的过程。
|
||||
|
||||
当今的 TeX 系统,事实上就是一个 web 文件,这个文件可是高爷爷亲手编写的,当你得到这个文件以后,对其执行 tangle 命令,你就可以得到一个叫做 tex.p 的文档,对这个文档,使用 pascal 编译器进行编译,就得到了一个 TeX 系统。而 web 文件由 weave 命令处理后,可得到一个 tex 文件,当你运行 tex 来编译这个文件的时候,你得到的是讲述 TeX 系统所有实现的文档。
|
||||
|
||||
整个 TeX 系统共有 300 个基本指令。使用这些指令,我们可以排版任何文档。当然,由于这些指令比较底层,用起来比较复杂,于是我们的高爷爷又基于这些指令,添加了 600 个指令,这就是我们今天的 TeX 系统。详细的指令用法,高爷爷都写到了他的 The TeXbook 中,这个可是他的一笔重要收入。
|
||||
|
||||
Pascal 语言是学院派的典范 (我承认最典范的学院派语言是 scheme),但是在实际生产中,pascal 语言自然就不能胜任了。20 世纪 80 年代随着苹果机的流行,使得 pascal 语言被很广泛地使用,以至于苹果公司需要把其他语言写的程序改成 pascal 代码,再在苹果机中运行。但是在 20 世纪 90 年代,网络迅速发展,导致 Unix 系统的需求迅速扩大,C 语言开始登上编程舞台,pascal 就不再吃香了。一大群学校纷纷改授 C 语言,同时 C 语言编译器的进步也异常迅猛,此时的大型应用也大都使用 C 语言编写。TeX 作为最牛 B 的排版软件,自然也应当使用 C 语言咯。因此,需要把 WEB 代码中的 pascal 换成 C 代码的想法付出水面,实现这个想法的的 WEB 系统就叫做 WEB2C。
|
||||
|
||||
事实上,这个是一个不得已的决定,由于大家对于高爷爷期望很高,一直认为他会不断地修改 TeX 系统,使之变得更加强大,因此本来一些手动地把 WEB 语言改变到 C 语言的计划,比如 Common TeX ,都无法成功,因为这使得 C 代码无法和高爷爷的 WEB 代码同时修正发布。因此只能够选择由机器自动地转码。而不幸的是,后来高爷爷认为 TeX 不需要再做任何修改了,当然这个是后话。 WEB2C 就在这种被动的想法下面被提出来了。
|
||||
|
||||
WEB2C 事实上就是 Lex 和 Yacc 写的一个语法转换器,尝试把 pascal 语言转换到 C 语言。中途会经历各种恶心的过程,当 pascal 语言变到了 C 语言以后,一群计算机专家们就很高兴地能够 make 它们,在浪费办公室电费和打法自己的时间中享受独特的乐趣。事实上这个也是一个无奈的决定。因为转好的代码,基本上不能用肉眼进行分析。
|
||||
|
||||
不管怎么样,我们的 WEB 语言终于到 C 语言了。接下来,由于 TeX 太伟大,所以,有了很多的基于 TeX 的包,包括字体,有用的宏。因此,我们的目录结构变得越来越复杂,如果当年的高爷爷乘坐时光机器看看今天的 TDS,一定会使他大开眼界。同时,网络的发展,导致可能本机器上的 TeX 需要搜索其他机器上的文件。这个就导致了一个严重的问题,就是 TeX 需要在许多的目录中找文件,需要耗费非常长的时间,而且如果一到网络上查找文件,速度还要降得更加慢。
|
||||
|
||||
因此,我们需要改动原先仅仅在当前目录或者由用户声名路径的目录下面找文件的架构。而此时的问题是,不能在 TeX 上面改,因为 metapost 等诸多的 TeX 相关软件也需要找文件,在 TeX 中实现一次再在 metapost 中实现一次,是一个错误的决定。因此,TUG 的 Karl 老大有了一个办法。首先开发了一个库,叫做 kpathsea,然后让 TeX 和它的相关软体,通过 kpathsea 查找文件。而查找文件的数量庞大导致的速度慢,就采用数据库的方法解决。先查找一次,记录下来,以后慢慢享用。这个数据库,就是 ls-R。
|
||||
|
||||
最早的 WEB2C 的查找方案,就是定义了一个叫做 TEXINPUTS 的环境变量,告诉 kpathsea 在TEXINPUTS 所定义的环境下,找到文件。但是这个导致了一个新的问题,也就是不同的 TeX 需要寻找不同的东西,而一个 TEXINPUTS 无法把它们区分开来。因此,我们这才想到,应该使用不同的路径,比如,TEXINPUTS.latex 变量,来给 LaTeX 查找路径,TEXINPUTS.context 变量给 ConTeXt 查找。而这些变量,就定义在 texmf.cnf 当中。
|
||||
|
||||
这个文件,还定义了许多的 TeX 的目录树,比如 texmf 目录,可以给整套的 TeX 系统查;texmf.os,可以给特性的系统查。当我们的系统添加了什么新的东西,就放在 texmf-local 吧。而用户自己的东西,嗯,规定他们在$HOME/texmf。
|
||||
|
||||
还有最后一个问题,那就是 kpathsea 如何查找 texmf.cnf 呢?事实上是通过定义环境变量达到目的的。这个变量叫做 TEXMFCNF,所有在这个环境变量中的 texmf.cnf 都被搜索到。这也使得,用户可以自己写一个 texmf.cnf,把所在路径加入到自己的 TEXMFCNF,而不需要重写整个 texmf.cnf。如果这个变量没有定义,那么默认我们找 texmf/web2c 这个路径下的 texmf.cnf。
|
||||
|
||||
整个 TeX 系统的实现过程到目前的科技发展水平为止,就是这个样子,说不定过了几年 C 语言不再吃香,因此搞出一个 web2python。又过了几年 pascal 复苏,大家又重新使用 WEB 语言写东西,或者过了几年网络和硬盘速度足够快,我们扔掉了 kpathsea。这些事情或许都会发生,谁也不知道。
|
||||
|
||||
但是这一切的被动,都是由于高爷爷大师光环的光芒,使得 tex.web 这个文件成为永恒。 1990 年 TeX 系统发布了 3.1 版本,高爷爷兴奋地表示, tex.web 是一个好东西,没有 bug,我们不要再改动 tex.web 了,大家一定要改,那我也没办法,但是不要和我争哦,一定要改名。 TeX 在 20 世纪 80 年代末虽然做了一次大的改动,可以处理 8 位的字符,而Unix Plan 9 系统的发布,奠定了 Unicode 编码方案的基础。 TeX 在目前的情况下,是落后于整个时代的。
|
||||
|
||||
如今,TeX 在多国语言的支持上,始终处于半吊子的状态,需要一大批黑客们日夜 hack 才可以被更多的场合支持。 TeX 使用的字体、输出,也受到时代的局限。 TeX 所用到的各种字体文件的庞杂程度,可能一个熟悉这个系统的人也不能完全讲明白。而同时发展起来的 X Window 系统,却对当今流行的字体和当今的字体渲染技术,拿捏非常到位。
|
||||
|
||||
显然,我们本来可以修改而使得 TeX 变得更好,但是高爷爷大师形象的光芒,使得各种尝试 (pdftex, etex, xetex, luatex,omega,aleph, ant, etc.),都不能算是正统。一方面,由于没有现成的由手工转换得到的 C 代码,修改 TeX 并不简单。许多的新 TeX 实现,都是给高爷爷的 tex.web 加上一串的 ch 和 fix 文件,这就使得他们严重地依赖原本的 TeX,使之变得异常复杂,好比于 C++ 对于 C 的扩充。另一方面,这些诸多的新时期的 TeX 实现,种类繁多,虽然大多数对于老的 TeX 的功能都尽量做到不变,但是新添加的功能,却导致彼此的不兼容。我们都不知道,更加漂亮的 TeX 架构,路在何方。
|
||||
|
||||
43
Zim/LaTex/The_levels_of_TeX.txt
Normal file
@@ -0,0 +1,43 @@
|
||||
Content-Type: text/x-zim-wiki
|
||||
Wiki-Format: zim 0.4
|
||||
Creation-Date: 2011-09-07T20:37:10+08:00
|
||||
|
||||
====== The levels of TeX ======
|
||||
Created Wednesday 07 September 2011
|
||||
http://www.tug.org/levels.html
|
||||
LaTeX vs. MiKTeX: The levels of TeX
|
||||
|
||||
A friend asked us once, “Should I use LaTeX or MiKTeX?” In various guises, this is a common question, seemingly innocent, but actually betraying a fundamental confusion about the levels of operation in the TeX world. As a further confusion, the word “TeX” can be used to refer to any of a myriad of items at any level. Starting at the top:
|
||||
|
||||
|
||||
|
||||
===== Distributions =====
|
||||
: MiKTeX, TeX Live, … These are the large collections of TeX-related software to be downloaded and installed. When someone says “I need TeX on my system”, they're usually looking for a distribution.
|
||||
|
||||
|
||||
===== Front ends =====
|
||||
: Emacs, TeXworks, TeXShop, TeXnicCenter, WinEdt, … These editors are what you use to create a document file. Some (e.g., TeXShop) are devoted to TeX specifically, others (e.g., Emacs) can be used to edit any sort of file. TeX documents are independent of any particular editor; the actual TeX typesetting program itself does not include any sort of editor whatsoever.
|
||||
|
||||
|
||||
===== Engines =====
|
||||
: TeX, pdfTeX, XeTeX, LuaTeX, … These are the actual executable binaries which implement the different __TeX dialects.__ The LaTeX format is implemented with both the pdfTeX (pdflatex) and XeTeX (xelatex) engines, for example. When someone says “TeX can't find my fonts”, they usually mean an engine.
|
||||
|
||||
|
||||
===== Formats =====
|
||||
: LaTeX, plain TeX, pdfLaTeX, … These are the__ TeX-based languages__ in which you actually write documents. When someone says “TeX is giving me this mysterious error”, they usually mean a format.
|
||||
|
||||
|
||||
===== Packages =====
|
||||
: geometry, lm, … These are add-ons to the basic TeX system, developed independently, providing additional typesetting features, fonts, documentation, etc. The CTAN web sites provide access to the vast majority of packages in the TeX world.
|
||||
|
||||
===== Output formats =====
|
||||
|
||||
TeX source files can be typeset into several different output formats, depending on the engine. Notably, the pdfTeX engine (despite its name) can output both DVI and PDF files.
|
||||
|
||||
At a high level, the output format that gets used depends on the program you invoke. If you run latex (which implements the LaTeX format), you will get DVI; if you run pdflatex (which also implements the LaTeX format), you will get PDF.
|
||||
|
||||
To get HTML, XML, etc., output, the tex4ht program is commonly used. This utility uses TeX to do its job, but the TeX engines themselves do not implement HTML output.
|
||||
|
||||
===== ConTeXt =====
|
||||
|
||||
ConTeXt is a special case, straddling levels. It contains a format at the level of__ plain TeX and LaTeX__, but unlike the other formats, it is invoked via a separate utility (e.g., texmfstart) which then indirectly runs a TeX engine. This makes it possible to support a wide array of advanced features, such as integrated graphics and XML input, since the startup utility can control the flow of processing.
|
||||
72
Zim/LaTex/Things_with_“TeX”_in_the_name.txt
Normal file
@@ -0,0 +1,72 @@
|
||||
Content-Type: text/x-zim-wiki
|
||||
Wiki-Format: zim 0.4
|
||||
Creation-Date: 2011-09-07T20:41:17+08:00
|
||||
|
||||
====== Things with “TeX” in the name ======
|
||||
Created Wednesday 07 September 2011
|
||||
|
||||
New TeX users are often baffled by the myriad terms with “TeX” in the name. The goal of this answer is to clarify some of the more common such terms.
|
||||
|
||||
===== TeX =====
|
||||
itself TeX proper is a **typesetting system** based on a set of low-level **control sequences** that instruct TeX how to lay out text on the page. For example, \hskip inserts a given amount of horizontal space into the document, and \font makes a given font available in a document. TeX is fully programmable using an integrated macro scripting language that supports variables, scoping, conditional execution, control flow, and function (really, macro) definitions. See what is TeX? for some background information on TeX and some reference documents for pointers to descriptions of TeX control sequences, data types, and other key parts of TeX.
|
||||
|
||||
====== TeX macro packages (a.k.a. TeX formats) ======
|
||||
Some of TeX’s control sequences are **tedious** to use directly; they are intended primarily as building blocks for higher-level — and therefore more user-friendly — **abstractions**. For example, there is no way in base TeX to specify that a piece of text should be typeset in a larger font. Instead, one must keep track of the current size and typeface, load a new font with the same typeface but a (specified) larger size, and tell TeX to use that new font until instructed otherwise. Fortunately, because TeX is **programmable**, it is possible to write a macro that hides this complexity behind a simple, new control sequence. (For example, it is possible to define \larger{my text} to typeset “my text” in at a font size next larger than the current one.)
|
||||
|
||||
While some users write their own, perfectly customized set of macros — which they then typically **reuse** across many documents — it is far more common to rely upon a **macro package**, a collection of TeX macros written by experts. For the user’s convenience, these macro packages are often combined with the base** TeX engine** into a standalone executable. The following are some of that macro packages that you are likely to encounter:
|
||||
|
||||
==== 1.Plain TeX (executable: tex) ====
|
||||
~~See Books on TeX and Plain TeX, Online introductions: TeX, Should I use Plain TeX or LaTeX? and Freely available (La)TeX books.~~ Note that the Plain TeX executable is called** tex**; the base TeX engine is generally provided by a separate executable such as initex or as a -ini flag to tex.
|
||||
|
||||
==== 2.LaTeX (executable: latex) ====
|
||||
~~ See Books on TeX and its relations, (La)TeX Tutorials, etc., Online introductions: LaTeX, Specialized (La)TeX tutorials and Directories of (La)TeX information.~~ Note that there have been two major versions of LaTeX: **LaTeX2e** refers to the current version of LaTeX while LaTeX 2.09 is the long-since-obsolete (since 1994) version (cf. What is LaTeX2e? for more information).
|
||||
|
||||
===== 3.ConTeXt (executable: texmfstart) =====
|
||||
See What is ConTeXt?.
|
||||
|
||||
===== 4.Texinfo (executables: tex, makeinfo) =====
|
||||
~~See What is Texinfo?.~~ makeinfo** converts** Texinfo documents to HTML, DocBook, Emacs info, XML, and plain text. Tex (or wrappers such as texi2dvi and texi2pdf) produce one of TeX’s usual output formats such as DVI or PDF. Because tex loads the Plain TeX macros, not the Texinfo ones, a Texinfo document must begin with \input{texinfo} to explicitly load the Texinfo macro package.
|
||||
|
||||
==== 5.Eplain — Extended Plain TeX (executable: eplain) ====
|
||||
See What is Eplain?.
|
||||
|
||||
|
||||
|
||||
====== Modified tex executables ======
|
||||
The original tex executable was produced in the late 1970s (cf. What is TeX?) and consequently lacked some** features** that users have come to expect from today’s software. The following programs address these issues by augmenting the **TeX engine** with some additional useful features:
|
||||
|
||||
===== 1.PDFTeX (executable: pdftex) =====
|
||||
TeX, which predates the PDF file format by a decade, outputs files in a TeX-specific format called DVI (cf. What is a DVI file?). In contrast, PDFTeX can output both DVI and PDF files. In PDF mode, it lets documents exploit various PDF features such as** hyperlinks**, bookmarks, and annotations, PDFTeX additionally supports two sophisticated micro-typographic features: character protrusion and font expansion. See What is PDFTeX?.
|
||||
|
||||
===== 2.XeTeX (executable: xetex) =====
|
||||
XeTeX reads **UTF-8** encoded Unicode input, and extends TeX’s font support to include ‘modern’ formats such as TrueType and OpenType; these extensions to its capabilities make it well-suited to multi-lingual texts covering different writing systems. See What is XeTeX?.
|
||||
|
||||
===== 3.LuaTeX (executable: luatex) =====
|
||||
TeX is programmed in its own arcane, integrated, macro-based programming language. LuaTeX adds a **second programming engine** using a modern scripting language, Lua, which is ‘embedded’ in a TeX-alike engine; it too reads UTF-8 and uses TrueType OpenType fonts. See What is LuaTeX?.
|
||||
|
||||
===== 4.e-TeX (executable: etex) =====
|
||||
e-TeX is an extension of TeX’s programming interface; as such it’s only indirectly useful to end users, but it can be valuable to package developers; there is an increasing number of macro packages that** require** the use of e-TeX. As well as existing in etex, e-TeX features are usually available in the pdftex executables provided in the standard distributions; XeTeX and LuaTeX also provide e-TeX’s programming facilities. See What is e-TeX?.
|
||||
|
||||
(Note: e-TeX, which enhances the TeX engine, is not to be confused with Eplain, which enhances the Plain TeX macro package.)
|
||||
|
||||
__宏包和引擎是相对独立的,一个宏包可以被多个引擎使用。__
|
||||
|
||||
Because each of the above **derive from a base TeX engine,** it is in principle possible to **combine any of them with one of the TeX macro packages **listed earlier to produce __‘extended’ executables__. For example, the pdflatex, xelatex and lualatex executables each combine LaTeX with an enhanced TeX engine. Indeed, most (if not all) of the development of ConTeXt is now using LuaTeX.
|
||||
|
||||
Some executables combine the features of __multiple enhanced TeX engines__: for example, pdftex now (in current distributions) offers both PDFTeX and e-TeX extensions into a single executable This executable may be offered with a LaTeX format (as latex or pdflatex) or with a Plain TeX format (as pdftex). (Tex remains with an unadorned TeX executable using Plain TeX, for people such as Knuth himself, who want the certainty of the “original”.)
|
||||
|
||||
===== TeX distributions =====
|
||||
A TeX distribution provides a structured collection of TeX-related software. Generally, a TeX distribution includes a set of “core” TeX executables such as tex and latex; various fonts optimized for use with TeX; helper programs such as the BibTeX bibliographic-database formatter, editors, integrated development environments, file-format-conversion programs; numerous LaTeX packages; configuration tools; and any other goodies the distributor chooses to include.
|
||||
|
||||
Commonly encountered TeX distributions include **TeX Live, MiKTeX and MacTeX**; older ones include ozTeX, CMacTeX and teTeX.
|
||||
|
||||
Some TeX distributions target a specific operating system and/or processor architecture; others run on multiple platforms. Many TeX distributions are free; a few require payment. See (La)TeX for different machines for a list of free and shareware TeX distributions and Commercial TeX implementations for a list of commercial TeX distributions.
|
||||
|
||||
===== Summary =====
|
||||
What does it all mean? — the simple lists of objects, alone, offer no help for the beginner. The FAQ team expects this answer only to be of use for people who are seeking guidance elsewhere (possibly within these FAQs) and coming across an unexpected name like “blahTeX”.
|
||||
|
||||
The subject matter covered by this answer is also addressed in a page on the TUG site, “the Levels of TeX”.
|
||||
|
||||
This answer last edited: 2011-06-01
|
||||
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
Content-Type: text/x-zim-wiki
|
||||
Wiki-Format: zim 0.4
|
||||
Creation-Date: 2011-09-07T21:19:55+08:00
|
||||
|
||||
====== What is PDFTeX(engine,Tex系统底层功能提供者) ======
|
||||
Created Wednesday 07 September 2011
|
||||
|
||||
One can reasonably say that PDFTeX is (today) the__ main stream__ of TeX distributions: most LaTeX and many ConTeXt(Latex和context只是__宏包__,它提供了方便的高级抽象) users nowadays use PDFTeX whether they know it or not (more precisely, they use PDFTeX extended by e-TeX). So what is PDFTeX?
|
||||
__e-Tex__ 是对PDFTeX引擎的扩展引擎。
|
||||
|
||||
PDFTeX is a development of TeX that is capable of generating typeset PDF output in place of DVI. PDFTeX has other capabilities, most notably in the area of** fine typographic detail** (for example, its support for optimising __line breaks__), but its greatest impact to date has been in the area of PDF output.
|
||||
|
||||
PDFTeX started as a topic for Hàn The Thành’s Master’s thesis, and seems first to have been published in TUGboat 18(4), in 1997 (though it was certainly discussed at the TUG’96 conference in Russia).
|
||||
|
||||
While the world was making good use of “pre-releases” of PDFTeX, Thành used it as a test-bed for the micro-typography which was the prime subject of his Ph.D. research. Since Thành was finally awarded his Ph.D., day-to-day maintenance and development of PDFTeX 1.0 (and later) has been in the hands of a group of PDFTeX maintainers (which includes Thành); the group has managed to maintain a stable platform for general use.
|
||||
|
||||
Development of PDFTeX has mostly __stopped __(only bug fixes, and occasional small development items are processed): future development is focused on LuaTeX.
|
||||
@@ -0,0 +1,25 @@
|
||||
Content-Type: text/x-zim-wiki
|
||||
Wiki-Format: zim 0.4
|
||||
Creation-Date: 2011-09-07T21:27:37+08:00
|
||||
|
||||
====== PDFTeX and LuaTeX ======
|
||||
Created Wednesday 07 September 2011
|
||||
|
||||
As is said elsewhere in these FAQs, development of __PDFTeX is “in essence” complete__ — no new facilities are being developed at the time of writing. The PDFTeX team has announced that they have __frozen__ PDFTeX’s specification in its current state (version 1.40.11), and that nothing but bug corrections will be provided up to the time of the final release, PDFTeX 1.50.0. (The interpretation of the statement seems to allow sensible changes that are beyond any reasonable definition of bug\dots)
|
||||
|
||||
In parallel with the running-down of PDFTeX development, development of a new system,__ LuaTeX__ is under way. Lua is a script language, designed to offer an interpreter that may be incorporated into other applications. LuaTeX consists of a TeX-like __engine__ with a lua interpreter ‘embedded’ in it; the lua interpreter has access to many of the data structures used for typesetting, and the user may also interpolate chunks of lua code into their (La)TeX macros, or as ‘call-backs’ for use when the TeX-like engine does certain operations.
|
||||
|
||||
This arrangement offers the prospect of __a “semi-soft” typesetting engine__: it will have its basic behaviour, but the user gets to redefine functionality if an idea occurs — there will be no need to persuade the world first, and then find a willing developer to work on the sources of of the distribution.
|
||||
|
||||
The LuaTeX project is (with monetary support from various sources) pursuing avenues that many of the other current projects have in their sights, notably **Unicode** character representations and support for** OpenType** fonts. The intention is to integrate the extensions pioneered by Aleph.
|
||||
|
||||
The current released version (Beta 0.70.1, in June 2011) of LuaTeX is supposed at least to demonstrate the final functionality. This stability was declared with version 0.50.0, released near the end of December 2009. Much work remains to be done, and this remains a beta-release. TeX Live 2010 incorporates (at the time of writing) LuaTeX version 0.60.2, and current MiKTeX (version 2.9) offers version 0.70.0.
|
||||
|
||||
__ConTeXt ‘Mark 4’ can already make use of LuaTeX;__ much of its code already appears in two forms — a TeX-based version (.mkii) and a ‘.mkiv’ version, which uses LuaTeX extensions (including lua scripting). LaTeX packages that support its use are appearing (some of them providing re-implementations of existing ConTeXt code).
|
||||
|
||||
LuaTeX snapshot
|
||||
systems/luatex (or browse the directory); catalogue entry
|
||||
PDFTeX distribution
|
||||
systems/pdftex (or browse the directory); catalogue entry
|
||||
|
||||
This answer last edited: 2011-07-10
|
||||
@@ -0,0 +1,11 @@
|
||||
Content-Type: text/x-zim-wiki
|
||||
Wiki-Format: zim 0.4
|
||||
Creation-Date: 2011-09-07T21:24:11+08:00
|
||||
|
||||
====== The XeTeX project ======
|
||||
Created Wednesday 07 September 2011
|
||||
|
||||
===== XeTeX引擎 =====
|
||||
, by Jonathan Kew, is a successor to the shareware TeX/GX program for Macintoshes. It is a__ Unicode-based__ TeX implementation which is able to make direct use of the __fonts installed on a system__. It supports the advanced **typographical features** available in modern font technology (OpenType, AAT on Mac OS X, Graphite). XeTeX was originally developed for Mac OS X but it is now fully integrated in TeX Live on a wide range of platforms, as well as being available as part of MiKTeX. XeTeX supports Unicode character sets and bidirectional typesetting (via __e-TeX__ primitives). It is popular among linguists and scholars in the humanities, as well as an increasing range of people working in other fields. Support for mathematical Unicode fonts (such as Asana Math and Cambria) is progressing.
|
||||
|
||||
The project has an active mailing list; a collection of other information is to be found in a set of links on the TUG web site.
|
||||
@@ -0,0 +1,24 @@
|
||||
Content-Type: text/x-zim-wiki
|
||||
Wiki-Format: zim 0.4
|
||||
Creation-Date: 2011-09-07T21:32:49+08:00
|
||||
|
||||
====== What is e-TeX ======
|
||||
Created Wednesday 07 September 2011
|
||||
|
||||
While Knuth has declared that __TeX will never change__ in any substantial way, there remain things that one might wish had been done differently, or indeed implemented at all.
|
||||
|
||||
The NTS project set out to produce an __advanced replacement for TeX__, to provide a basis for developing such modifications: this “New Typesetting System” would share Knuth’s aims, but would implement the work in a modern way taking account of the lessons learned with TeX. While a first demonstrator NTS did appear, it wasn’t practically useful, and the project seems no longer active.
|
||||
|
||||
In parallel with its work on NTS itself, the project developed __a set of extensions__ that can be used with a (“true”) TeX system. Such a modified system is known as an__ e-TeX__ system, and the concept has proved widely successful.
|
||||
|
||||
Indeed, current TeX distributions are delivered with __most formats built with an e-TeX-based system__ (for those who don’t want them, e-TeX’s extensions can be disabled, leaving a functionally standard TeX system).
|
||||
|
||||
当前的发行版使用的主要就是e-Tex
|
||||
|
||||
The extensions range from the seemingly simple (increasing the number of available registers from 256 to 32768) through to extremely subtle programming support.
|
||||
|
||||
ConTeXt has required e-TeX for its operation for some time, though development is now focused on the use of LuaTeX.
|
||||
|
||||
Some LaTeX packages already specify the use of **e-TeX**. Some such packages may not work at all on a non-e-TeX system; others will work, but not as well as on an e-TeX system. The LaTeX team has announced that future LaTeX packages (specifically those from the team, as opposed to those individually contributed) may require e-TeX for optimum performance.
|
||||
|
||||
e-TeX
|
||||
@@ -0,0 +1,22 @@
|
||||
Content-Type: text/x-zim-wiki
|
||||
Wiki-Format: zim 0.4
|
||||
Creation-Date: 2011-09-07T21:08:39+08:00
|
||||
|
||||
====== What is TeX(宏包,利用引擎提供高级抽象) ======
|
||||
Created Wednesday 07 September 2011
|
||||
http://www.tex.ac.uk/cgi-bin/texfaq2html?label=whatTeX
|
||||
|
||||
TeX is a **typesetting system(排版系统)** written by Donald E. Knuth, who says in the Preface to his book on TeX (see books about TeX) that it is “intended for the creation of **beautiful books** — and especially for books that contain a lot of mathematics”. (If TeX were only good for mathematical books, much of its use nowadays would not happen: it’s actually a pretty good general typesetting system.)
|
||||
|
||||
Knuth is Emeritus Professor of the Art of Computer Programming at Stanford University in California, USA. Knuth developed the first version of TeX in 1978 to deal with revisions to his series “the Art of Computer Programming”. The idea proved popular and Knuth produced a second version (in 1982) which is the basis of what we use today.
|
||||
|
||||
Knuth developed a system of __‘literate programming’ __to write TeX, and he provides the literate (WEB) source of TeX free of charge, together with tools for processing the web source into something that can be compiled and something that can be printed; there is (in principle) never any mystery about what TeX does. Furthermore, the WEB system provides mechanisms to port TeX to new operating systems and computers; and in order that one may have some confidence in the ports, Knuth supplied a test by means of which one may judge the fidelity of a TeX system. TeX and its documents are therefore highly portable.
|
||||
|
||||
For the interested programmer, the distribution of TeX has some fascination: it’s nothing like the way one would construct such a program nowadays, yet it has lasted better than most, and has been ported to many different computer architectures and operating systems — the sorts of attributes that much modern programming practice aims for. The processed ‘readable’ source of TeX the program may be found in the TDS structured version of the distribution.
|
||||
|
||||
Knuth’s source distribution
|
||||
systems/knuth/dist (or browse the directory); catalogue entry
|
||||
Knuth’s sources in TDS layout
|
||||
macros/latex/contrib/latex-tds/knuth.tds.zip
|
||||
|
||||
This answer last edited: 2011-06-01
|
||||
@@ -0,0 +1,17 @@
|
||||
Content-Type: text/x-zim-wiki
|
||||
Wiki-Format: zim 0.4
|
||||
Creation-Date: 2011-09-07T21:11:09+08:00
|
||||
|
||||
====== What is ConTeXt ======
|
||||
Created Wednesday 07 September 2011
|
||||
|
||||
===== ConTeXt =====
|
||||
is a **macro package(注意,不是引擎)** developed by Hans Hagen of Pragma-Ade; it started as a production tool for //Pragma// (which is a publishing company). ConTeXt is a document-production system based, like LaTeX, on the TeX typesetting system. Whereas LaTeX insulates the writer from **typographical details**, ConTeXt takes a complementary approach by providing structured interfaces for handling __typography__, including extensive support for** colors, backgrounds, hyperlinks, presentations, figure-text integration, and conditional compilation**. It gives the user extensive control over formatting while making it easy to create new layouts and styles without learning the TeX macro language. ConTeXt’s **unified design** avoids the package clashes that can happen with LaTeX.
|
||||
|
||||
ConTeXt also integrates **MetaFun**, a superset of MetaPost and a powerful system for **vector graphics**. MetaFun can be used as a stand-alone system to produce figures, but its strength lies in enhancing ConTeXt documents with accurate graphic elements.
|
||||
|
||||
ConTeXt allows the users to specify **formatting commands** in English, Dutch, German, French, or Italian, and to use different **typesetting engines** (PDFTeX, XeTeX, Aleph and LuaTeX) without changing the user interface. ConTeXt continues to develop, often in response to requests from the user community.
|
||||
|
||||
ConTeXt has been bound to the development of** LuaTeX(引擎)**, almost from the start of that project. Nowadays, it is distributed in two versions — mark two (files with extension .mkii (which runs on PDFTeX but is not under active development) and mark four files with extension .mkiv (which runs on LuaTeX and is where development happens).
|
||||
|
||||
ConTeXt has a large developer community (though possibly not as large as that of latex), but those developers who are active seem to have prodigious energy. Support is available via a WIKI site and via the mailing list.
|
||||
@@ -0,0 +1,12 @@
|
||||
Content-Type: text/x-zim-wiki
|
||||
Wiki-Format: zim 0.4
|
||||
Creation-Date: 2011-09-07T21:38:04+08:00
|
||||
|
||||
====== What is LaTeX2e ======
|
||||
Created Wednesday 07 September 2011
|
||||
|
||||
Lamport’s last version of LaTeX (LaTeX 2.09, last updated in 1992) was superseded in 1994 by a new version (LaTeX2e) provided by the LaTeX team. LaTeX2e is now the only readily-available version of LaTeX, and draws together several threads of LaTeX development from the later days of LaTeX 2.09. The “e” of the name is (in the official logo) a single-stroke epsilon (ε, supposedly indicative of no more than a small change).
|
||||
|
||||
LaTeX2e has several enhancements over LaTeX 2.09, but they were all rather minor, with a view to continuity and stability rather than the “big push” that some had expected from the team. LaTeX2e continues to this day to offer a compatibility mode in which most files prepared for use with LaTeX 2.09 will run (albeit with somewhat reduced performance, and subject to voluminous complaints in the log file). Differences between LaTeX2e and LaTeX 2.09 are outlined in a series of ‘guide’ files that are available in every LaTeX distribution (the same directory also contains “news” about each new release of LaTeX2e).
|
||||
|
||||
Note that, now, LaTeX2e is “__feature frozen__” (the only allowed changes come from bug reports); this, too, is in pursuit of stability, and is a driving force for many of the efforts to contribute LaTeX packages.
|
||||
@@ -0,0 +1,15 @@
|
||||
Content-Type: text/x-zim-wiki
|
||||
Wiki-Format: zim 0.4
|
||||
Creation-Date: 2011-09-07T21:15:05+08:00
|
||||
|
||||
====== What is Texinfo ======
|
||||
Created Wednesday 07 September 2011
|
||||
|
||||
===== Texinfo =====
|
||||
is a documentation system that uses** one source file to produce both on-line information and printed output.** So instead of writing two different documents, one for the on-line help and the other for a typeset manual, you need write __only one__ document source file. When the work is revised, you need only revise one document. By convention, Texinfo source file names end with a **.texi or .texinfo** extension.
|
||||
|
||||
Texinfo is a __macro language__, somewhat similar to LaTeX, but with slightly less expressive power. Its appearance is of course rather similar to any TeX-based macro language, except that its** macros start with @** rather than the \ that’s more commonly used in TeX systems.
|
||||
|
||||
You can write and format Texinfo files into __Info__ files within GNU emacs, and read them using the emacs Info reader. You can also format Texinfo files into Info files using **makeinfo** and read them using info, so you’re not dependent on emacs. The distribution includes a Perl script,** texi2html**, that will convert Texinfo sources into HTML: the language is a far better fit to HTML than is LaTeX, so that the breast-beating agonies of converting LaTeX to HTML are largely avoided.
|
||||
|
||||
Finally, of course, you can also print the files, or convert them to PDF using PDFTeX.
|
||||
63
Zim/LaTex/ctex_宏包.txt
Normal file
@@ -0,0 +1,63 @@
|
||||
Content-Type: text/x-zim-wiki
|
||||
Wiki-Format: zim 0.4
|
||||
Creation-Date: 2012-01-01T14:06:06+08:00
|
||||
|
||||
====== ctex 宏包 ======
|
||||
Created Sunday 01 January 2012
|
||||
https://code.google.com/p/ctex-kit/wiki/UnixFonts
|
||||
|
||||
===== ctex 宏包为什么(目前)没有为 Linux 系统设置字体选项? =====
|
||||
|
||||
ctex 宏包在使用 XeTeX 为引擎编译时,提供了 __winfonts, adobefonts, nofonts __等不同选项,在最新的 svn 版本中还给 Mac OS X 用户提供了 macfonts 选项。
|
||||
|
||||
来自 Linux 社区的用户曾多次在不同场合要求为其系统增加免费中文字体的配置选项,如 issue 41 , issue 54 都曾要求增加 unixfonts 选项,并给出代码。不过,这样的建议未予采纳,原因如下:
|
||||
|
||||
* 类 Unix 平台是一个宽泛的平台,__没有统一的中文字体预装方案__。
|
||||
|
||||
除 Mac 系统相对统一,类 Unix 平台的用户主要来自各个 Linux 发行版。尽管开源社区主要的免费字体来源单一:__文鼎公司__捐助的报宋、楷体,__文泉驿项目__的黑体,以及类似 Cyberbit.ttf 这样的字体;但是,各个发行版/桌面预装的中文字体版本及字体名则极不统一,难以用一个字体选项表示。
|
||||
|
||||
仅以文鼎的宋体(或明体)为例,就有 AR PL SungtiL GB, AR PL New Sung, AR PL ShanHeiSun Uni, AR PLBaosong2GBK Light, AR PL UMing CN, AR PLMingU20 Light 等许多变体。在不同的 Linux 发行版中其配置确有不同,因而配置文件难以统一。
|
||||
|
||||
* XeTeX 没有字体检测机制,在配置文件中写入系统中不存在的字体会产生编译错误。
|
||||
|
||||
不过,尽管存在兼容性问题,但多出若干选项通常也是无害的。Mac OS X 有一个__标准的华文字体集__,因此可以新建 macfonts 字体选项。如果 Linux 社区在统计现有的多种发行版后,能给出相对一致的预装字体的一个交集,那么也可以据此增加选项。
|
||||
|
||||
===== 为什么 winfonts 选项在 Linux 下面编译错误? =====
|
||||
|
||||
XeTeX 引擎下,winfonts 选项是面向 Windows 用户设计的字体选项。其中经常被类 Uniux 平台用户误认为有错误的是楷体和仿宋体的设置:
|
||||
|
||||
\setCJKfamilyfont{zhkai}{[simkai.ttf]}
|
||||
\setCJKfamilyfont{zhfs}{[simfang.ttf]}
|
||||
|
||||
这段代码其实并没有问题。这里没有使用 fontconfig 库读取的**字体族名**,而是使用方括号外的__字体文件名__设置字体,这是符合 XeTeX 的字体语法的;对较新版本 fontspec 宏包,方括号可以省略,但旧版本仍需要保留。
|
||||
|
||||
采用字体文件名的原因是,在 Windows XP 及之前的 Windows 版本中,楷体和仿宋体为 GB_2312 字符集,其字体名分别是 KaiTi_GB2312 与 FangSong_GB2312;而在 Windows Vista 及之后的 Windows 版本中,楷体和仿宋体则改为__强制标准 GB18030 字符集__,其字体名分别是 KaiTi 与 FangSong。这两种版本的字体名称不同,为保证不同版本 Windows 用户的**兼容性**,只能采用字体文件名的方式。
|
||||
|
||||
这一设置在部分类 Unix 平台下编译会产生找不到字体的错误,即使用户已经在其类 Unix 系统中安装了来自 Windows 的字体。其原因是:Windows 不区分文件名的大小写,而其他系统一般是大小写敏感的。在不同 Windows 版本中字体文件名的大小写也各有不同,同时 ctex 宏包的字体文件名大小写也几经修改,难以统一。统一文件名大小写后即可正常编译。
|
||||
|
||||
===== 解决方案 =====
|
||||
|
||||
* **使用 nofonts 选项设置字体**
|
||||
|
||||
示例:
|
||||
|
||||
\documentclass[UTF8,__nofonts__]{ctexart}
|
||||
\setCJKmainfont[ItalicFont={AR PL KaitiM GB}]{AR PL SungtiL GB}% 文鼎宋体和楷书
|
||||
\setCJKsansfont{WenQuanYi Zen Hei}% 文泉驿的黑体
|
||||
|
||||
\begin{document}
|
||||
文章内容
|
||||
\end{document}
|
||||
|
||||
如果设置的字体较多,为方便使用可以把相关代码作为__单独的 .sty 文件__保存。
|
||||
|
||||
* **使用来自 Windows 系统的字体,同时统一字体文件名大小写**
|
||||
|
||||
* 在类 Unix 系统中安装从 Windows 系统中复制来的字体时,请注意将所有字体都设置为相同的大小写,这里__建议为小写__。
|
||||
* __ctex-xecjk-winfonts.def__ 文件中,确保楷体与仿宋体的大小写与**系统安装**的相同,也可以根据具体版本改为字体族名。这将影响__ xelatex__ 编译 ctex 宏包的效果。
|
||||
在 ctex 宏包的 * 在 TeX Live 的 texmf-dist/tex/generic/**zhmetrics**/ 目录下的** zhwinfonts.tex** 文件中,确保各个中文字体的大小写与系统一致。这将影响 pdflatex 和 latex+dvipdfmx 编译 ctex 宏包的效果。
|
||||
* (可选)在 TeX Live 的 texmf-dist/source/fonts/zhmetrics/ 目录下的 ttfonts.map 文件中,确保各个中文字体的大小写与系统一致,然后用它代替或合并于原有生效的 ttfonts.map。这将影响 ttf2pk、dvi2png 等程序的效果。
|
||||
|
||||
* **使用 ctex 宏包的配置文件设置默认行为**
|
||||
|
||||
CTeXPackage 页面介绍了 ctex 宏包的两个配置文件,可以使用 ctexopts.cfg 修改宏包的默认字体选项为 nofonts,然后使用 ctex.cfg 探测宏包选项,在默认选项时引入自定义的字体设置。
|
||||
144
Zim/LaTex/ctex_宏包/CTeXPackage.txt
Normal file
@@ -0,0 +1,144 @@
|
||||
Content-Type: text/x-zim-wiki
|
||||
Wiki-Format: zim 0.4
|
||||
Creation-Date: 2012-01-01T14:20:30+08:00
|
||||
|
||||
====== CTeXPackage ======
|
||||
Created Sunday 01 January 2012
|
||||
https://code.google.com/p/ctex-kit/wiki/CTeXPackage
|
||||
|
||||
===== 安装或更新 =====
|
||||
|
||||
=== 发布版本 ===
|
||||
|
||||
一般用户请使用稳定的发布版本。
|
||||
常见的 TeX 发行版应该已经安装了 ctex 宏包。请检查使用的最新的发行版。如果你在安装发行版时没有选择安装全部的宏包,请使用 MiKTeX Package Manager 或 TeX Live Manager 来安装 CTAN 上面的发布版本。
|
||||
|
||||
如果你使用的发行版没有 ctex 宏包,可以在 CTAN 的镜象服务器上找到当前的发行版本(这里使用 CTeX 网站的镜象):
|
||||
ftp://ftp.ctex.org/CTAN/language/chinese/ctex.zip
|
||||
|
||||
但手工安装通常需要检查 ctex 宏包的依赖项,重要的包括 CJK 宏包、CJKpunct 宏包、xeCJK 宏包、zhwinfonts.tex、zhmetrics 字体包等等。
|
||||
|
||||
=== 开发版本 ===
|
||||
|
||||
可以从本网站的 SVN 仓库中获取开发中的版本。开发版本可能带有一些新的特性,修正了一些新的错误,但也可能带来不稳定的情况。
|
||||
|
||||
使用 http://code.google.com/p/ctex-kit/source/checkout 中说明的方式从仓库中获取源代码。
|
||||
|
||||
获取源代码后,需要按照__ TDS 目录结构__重新组织源代码,然后按目录结构复制到发行版中的**本地 TEXMF 目录**。例如,在 TeX Live 系统中,本地的 TEXMF 目录一般是
|
||||
|
||||
安装目录/texmf-local/
|
||||
|
||||
将 ctex 源码目录下的 doc 和 test 目录内容放在 TDS 的 __TEXMF/doc/latex/ctex/ __目录下;将其他目录放在 TDS 结构的 __TEXMF/tex/latex/ctex/__ 目录下;然后运行
|
||||
|
||||
texhash
|
||||
|
||||
刷新文件名数据库。
|
||||
|
||||
===== 一般配置 =====
|
||||
|
||||
一般情况下,安装后的 ctex 宏包不需要进一步的配置即可正常使用。
|
||||
|
||||
=== 字体依赖 ===
|
||||
|
||||
ctex 宏包__默认使用 winfonts 选项__,如果不使用其他选项修改字体配置,则需要操作系统中安装有中文 Windows 操作系统自带的四种 TrueType 字体:宋体、黑体、仿宋体、楷体。字体文件名为 sinsun.ttc, sinhei.ttf, simfang.ttf, simkai.ttf,字体名随不同 Windows 版本可能会有区别。
|
||||
|
||||
* 英文 Windows 操作系统中只有宋体和黑体,需要自行安装仿宋和楷体才能使用。
|
||||
* 非 Windows 操作系统如果需要使用此选项,参看页面 UnixFonts 中的说明。
|
||||
|
||||
如果使用 adobefonts 选项(目前仅支持 xelatex),则需要操作系统中安装有 Adobe 公司的四款 __OpenType__ 字体:Adobe 宋体 Std,Adobe 黑体 Std,Adobe 仿宋 Std,Adobe 楷体 Std。
|
||||
|
||||
=== 中文相关配置 ===
|
||||
|
||||
尽管 ctex 宏包本身不需要配置,但在特定环境中可能需要对系统字体做简单配置。这里对 Linux 下的 TeX Live 进行简单说明(严格地说这是 TeX Live 的论题)。
|
||||
|
||||
TeX Live(这里描述 TeX Live 2010)安装在 Linux 系统上时,需要设置 TeX Live 的 __texmf.cnf __配置文件中的 OSFONTDIR 变量,才能使相关程序找到系统中的字体,特别是中文字体。用 pdflatex 或 latex + dvipdfmx 编译时需要这一设置以找到操作系统中的中文字体。XeLaTeX 编译__不需要__这种设置。
|
||||
|
||||
=== 可能改变兼容性的配置 ===
|
||||
|
||||
请有经验的用户仔细浏览过 ctex 宏包的源代码后再考虑下面的内容。
|
||||
|
||||
本地修改配置文件可能改变 ctex 宏包的兼容性,字体等格式上的改变应该__做成独立的文件__另外使用。因此,如果需要安装用于某特定操作系统的字体,或是让章节标题的格式变化,不应该使用 ctex 宏包的配置文件达到此目的。例如,可以编写 myfontset.sty 文件设置用户 Linux 的字体:
|
||||
|
||||
% myfontset.sty
|
||||
\ProvidesPackage{myfontset}[2011/01/01 ver 1.0 My local font settings of ctex]
|
||||
\setCJKmainfont[ItalicFont={AR PL KaitiM GB}]{AR PL SungtiL GB}% 文鼎宋体和楷书
|
||||
\setCJKsansfont{WenQuanYi Zen Hei}% 文泉驿的黑体
|
||||
\setCJKmonofont{WenQuanYi Zen Hei}
|
||||
\endinput
|
||||
|
||||
然后在文档中设置 ctex 宏包的** nofonts **选项,以 \usepackage{myfontset} 使用此配置。
|
||||
|
||||
ctex 宏包提供了两个额外的配置文件:
|
||||
|
||||
__ctex.cfg __中的代码将在 ctex 宏包末尾执行。可以使用此配置文件增加任意自定义配置,但建议只使用它解决错误。例如某些版本的 ctex 宏包中因 xunicode 造成的符号冲突问题。
|
||||
|
||||
__ ctexopts.cfg__ 中的代码将在 ctex 宏包的开头(选项定义后面)执行。请只使用此配置文件改变 ctex 宏包的缺省选项。例如,可以使用:
|
||||
|
||||
\ExecuteOptions{adobefonts}
|
||||
\ExecuteOptions{fntef}
|
||||
|
||||
将 XeTeX 下默认的字体选项更改为 Adobe 的字体配置,并调用 CJKfntef 宏包。
|
||||
|
||||
===== 使用 =====
|
||||
|
||||
关于 ctex 宏包的详细使用说明请参考宏包所附的 PDF 文档。这里只对个别兼容性问题做一说明。
|
||||
|
||||
=== 源文件编码 ===
|
||||
|
||||
* 使用 CCT 方式处理汉字支持 GBK 文件编码。
|
||||
* 使用 CJK 方式处理汉字(latex 或 pdflatex 编译自动选择),支持 GBK 和 UTF-8 两种文件编码。缺省的编码是 GBK。可以使用宏包选项 GBK 和 UTF8 进行选择;也可以使用 ctexutf8 等宏包名。
|
||||
* 使用 xeCJK 方式处理汉字(xelatex 编译__自动选择__),可以使用 GBK 和 UTF-8 两种文件编码,但只有 UTF-8 编码是原生支持的。如果需要使用 GBK 编码,需要在源文档前面增加 XeTeX 原语:
|
||||
|
||||
\XeTeXinputencoding "GBK"
|
||||
|
||||
===== 基本测试文件 =====
|
||||
|
||||
XeTeX (xeCJK) 模式: (__推荐__使用的模式)
|
||||
|
||||
% 使用 UTF-8 编码
|
||||
\documentclass{ctexart}
|
||||
\begin{document}
|
||||
你好 CTeX 文档类
|
||||
\end{document}
|
||||
|
||||
用 xelatex 编译时会__自动使用__ XeTeX 相关配置。
|
||||
|
||||
传统 CJK 模式:
|
||||
|
||||
% 默认使用 GBK 编码,如需要 UTF-8 编码需加 UTF8 选项
|
||||
\documentclass{ctexart}
|
||||
\begin{document}
|
||||
你好~CTeX~文档类
|
||||
\end{document}
|
||||
|
||||
传统 CCT 模式: (不建议使用,仅为个别历史文档保留)
|
||||
|
||||
\documentclass[cct]{ctexart}
|
||||
\begin{document}
|
||||
你好 CTeX 文档类
|
||||
\end{document}
|
||||
|
||||
===== 复杂的测试 =====
|
||||
|
||||
测试使用 XeTeX (xeCJK) 版本:
|
||||
|
||||
cd ~/texmf/tex/latex/ctex/test
|
||||
xelatex test-xetex.tex
|
||||
|
||||
检查输出信息是否有异常,生成的 test-xetex.pdf 内容是否正确。
|
||||
|
||||
测试使用 CJK 版本:
|
||||
|
||||
cd ~/texmf/tex/latex/ctex/test
|
||||
pdflatex test-cjk.tex
|
||||
|
||||
检查输出信息是否有异常,生成的 test-cjk.pdf 内容是否正确。
|
||||
|
||||
great work!
|
||||
Comment by song.opp...@gmail.com, Jan 17, 2010
|
||||
|
||||
xetex下使用xecjk,修改字体配置应该在~/texmf/__tex/latex/ctex/fontset/xecjk-adobefonts.def__ 和xecjk-winfonts.def中修改吧?是不是需要更新一下当前的文档了?
|
||||
Comment by project member LeoLiu....@gmail.com, Jan 13, 2011
|
||||
|
||||
最好不要修改字体配置文件,这会造成不兼容。个人的字体配置在单独的包中写就行了。
|
||||
Comment by xiaohany...@gmail.com, May 29, 2011
|
||||
218
Zim/LaTex/ctex_宏包/SimpleChineseTemplates.txt
Normal file
@@ -0,0 +1,218 @@
|
||||
Content-Type: text/x-zim-wiki
|
||||
Wiki-Format: zim 0.4
|
||||
Creation-Date: 2012-01-01T14:35:52+08:00
|
||||
|
||||
====== SimpleChineseTemplates ======
|
||||
Created Sunday 01 January 2012
|
||||
|
||||
SimpleChineseTemplates
|
||||
各种工具链下最简单的中文文档模板
|
||||
|
||||
目的
|
||||
LaTeX
|
||||
xelatex (推荐)
|
||||
latex + dvipdfmx
|
||||
pdflatex
|
||||
latex + dvips + ps2pdf (过时,不推荐,仅供参考)
|
||||
ConTeXt
|
||||
MkIV (推荐)
|
||||
MkII
|
||||
|
||||
v0.3, 2010-03-06
|
||||
|
||||
===== 目的 =====
|
||||
|
||||
希望 google code 上的 ctex-kit 和 ctex-doc 成为 TeX 中文支持信息的权威集中点,为中文用户使用 TeX 排版中文文档提供__最基本的模板__,解决如下问题:
|
||||
|
||||
* 可以生成中文显示正常的 PDF 文件;
|
||||
* 复制 PDF 中的中文文字不会乱码;
|
||||
* PDF 中的中文书签不乱码;
|
||||
* PDF 可以搜索中文。
|
||||
|
||||
**更细致**的符合中文排版习惯的模板不在此页面考虑范围之内,请参考 cjk、xecjk、ctex 宏包的文档以及 Li Yanrui 的 ConTeXt 笔记。
|
||||
|
||||
使用的 TeX 发行版为 T__eX Live__ 和 ConTeXt Minimals,因为这俩能在多个 OS 上使用,使用人数众多。
|
||||
|
||||
页面中的模板来自各种角落的收集:
|
||||
|
||||
* http://tex.board.newsmth.net/
|
||||
* http://www.ctex.org
|
||||
* CTeXLive ISO 镜像文件中的例子
|
||||
* CJK、xeCJK、ctex 宏包的例子
|
||||
* Li Yanrui 的 ConTeXt 笔记等等。
|
||||
|
||||
====== LaTeX ======
|
||||
|
||||
文档参考:
|
||||
|
||||
* lshort - http://ctex-doc.googlecode.com/svn/trunk/lshort-zh-cn/
|
||||
* lnotes - http://ctex-doc.googlecode.com/svn/trunk/latex-notes-zh-cn/
|
||||
* ctex-faq - http://ctex-doc.googlecode.com/svn/trunk/ctex-faq/
|
||||
* texlive-zh-cn - http://www.tug.org/texlive/doc/texlive-zh-cn/texlive-zh-cn.pdf
|
||||
* xetex-about-fonts - http://bbs.ctex.org/viewthread.php?tid=43244
|
||||
* milksea-readme - http://www.newsmth.net/bbscon.php?bid=460&id=282515
|
||||
* tl2007-cjk-howto(old??) - http://mailboxpublic.googlepages.com/texlive2007cjkchinesehowto
|
||||
|
||||
由于 __xelatex 使用的是近来开发的 XeTeX 引擎__,能容易的使用字体,所以推荐使用。下面__后三种__工具链使用的都是 __pdftex 引擎加 CJK 宏包__,它们间的区别只是得到 PDF 文件的方式不一样,各有一些细微的优缺点,参考 ctex-faq 第 32 个问题“在 CJK 中都可以使用哪些矢量字库?”。
|
||||
|
||||
模板文件:http://ctex-kit.googlecode.com/svn/trunk/templates/LaTeX ,在 Linux 下可以用 make TOOLCHAINS=xxx gbk utf8 来编译 gbk.tex 和 utf8.tex,TOOLCHAINS 可以是 __xelatex、pdflatex、dvipdfmx、dvips__ 的一种或者组合(**前两种是直接从源文件生成pdf文档,而后两者是先生成dvi文件,然后再转换为pdf文档**。),以逗号或者空格分隔。当使用**后三者**并且使用 winfonts 时,需要把 C:\WINDOWS\Fonts\ 目录下的 sim*.ttf、sim*.ttc 复制到TEXMFHOME/fonts/truetype/sim/ 目录下(没有此目录则新建之),TEXMFHOME 指 kpsexpand '$TEXMFHOME' 命令的输出。
|
||||
|
||||
测试环境如下,更详细的软件包信息见模板文件末尾的注释:
|
||||
|
||||
* Debian GNU/Linux Squeeze
|
||||
* TeXLive 20090910
|
||||
* ctex r167 at http://ctex-kit.googlecode.com (ctex r189 对 hyperref 支持做了修改,可以使用 ctex 宏包的 hyperref 选项,不再需要模板中繁琐的 hyperref 设置)
|
||||
* zhwinfonts r167 at http://ctex-kit.googlecode.com
|
||||
* xecjk r167 at http://ctex-kit.googlecode.com
|
||||
* evince 2.26.2-2
|
||||
* libpoppler4 0.10.6-1
|
||||
* poppler-data 0.2.1-5
|
||||
|
||||
==== xelatex (推荐的工具链) ====
|
||||
|
||||
编译方式:
|
||||
|
||||
xelatex a.tex
|
||||
xelatex a.tex # 使用交叉引用信息,书签需要这个
|
||||
|
||||
编译结果:
|
||||
|
||||
模板 字体选项 实际字体 pdf 大小 显示 超链接 字体信息 选择 复制 书签 搜索
|
||||
gbk.tex adobefonts Adobe 22118 极好 正常 正常 正常 正常 正常 正常
|
||||
gbk.tex winfonts 中易 20903 极好 正常 正常 正常 正常 正常 正常
|
||||
utf8.tex adobefonts Adobe 22120 极好 正常 正常 正常 正常 正常 正常
|
||||
utf8.tex winfonts 中易 20904 极好 正常 正常 正常 正常 正常 正常
|
||||
|
||||
此方式编译时 ctex __基于 xecjk 宏包__,cjkfonts 等价于 adobefonts。
|
||||
|
||||
==== latex + dvipdfmx ====
|
||||
|
||||
如果没有 GBK-EUC-UCS2 文件,则需要 gbk2uni,参见下一节 pdflatex。 Debian 上 cmap-adobe-gb1 和 poppler-data 中都有 GBK-EUC-UCS2,也可以从 Adobe Reader 简体中文版中获取,复制到 TEXMFHOME/fonts/cmap/dvipdfmx/ 目录下。
|
||||
|
||||
编译方式:
|
||||
|
||||
latex a.tex
|
||||
latex a.tex # 使用交叉引用信息,书签需要这个
|
||||
gbk2uni a.out # 如果是 GBK 编码,并且没有 GBK-EUC-UCS2 文件
|
||||
latex a.tex # 如果是 GBK 编码,并且没有 GBK-EUC-UCS2 文件。使用正确编码的交叉引用信息。
|
||||
__dvipdfmx__ a.dvi
|
||||
|
||||
编译结果:
|
||||
|
||||
模板 字体选项 实际字体 pdf 大小 显示 超链接 字体信息 选择 复制 书签 搜索
|
||||
gbk.tex cjkfonts 文鼎 失败
|
||||
gbk.tex winfonts 中易 17051 很好 正常 正常 正常 正常 正常 正常
|
||||
utf8.tex cjkfonts 文鼎 27615 很好 正常 正常 正常 正常 正常 正常
|
||||
utf8.tex winfonts 中易 17049 很好 正常 正常 正常 正常 正常 正常
|
||||
|
||||
此方式编译时** ctex 基于 cjk 宏包**,adobefonts 等价于 winfonts。
|
||||
|
||||
==== pdflatex ====
|
||||
|
||||
需要 gbk2uni : ftp://ftp.cc.ac.cn/pub/cct/src/ ,下载 cct 源码包,取出其中的 gbk2uni.h 和 gbk2uni.c,编译:
|
||||
|
||||
gcc -o gbk2uni gbk2uni.c
|
||||
mv gbk2uni `kpsexpand '$TEXMFMAIN'`/../bin/i386-linux/
|
||||
|
||||
为了使 GBK 编码的文件被 pdflatex 编译后可以搜索中文,需要取出 cct 源码中 ccmap 目录,复制到 TEXMFHOME/tex/latex/ccmap/ 目录,然后执行:
|
||||
|
||||
mkdir t.$$ && cd t.$$ && latex "\def\cmapEnc{GBK} \input{makecmap.tex}"
|
||||
todir=`kpsexpand '$TEXMFMAIN'`/tex/latex/ccmap
|
||||
mkdir -p $todir
|
||||
mv *.cmap $todir
|
||||
cd - && rm -rf t.$$
|
||||
|
||||
编译方式:
|
||||
|
||||
pdflatex a.tex
|
||||
pdflatex a.tex # 使用交叉引用信息,书签需要这个
|
||||
gbk2uni a.out # 如果是 GBK 编码
|
||||
pdflatex a.tex # 如果是 GBK 编码。使用正确编码的交叉引用信息。
|
||||
|
||||
!!! 注:pdftex <= 1.40.9 对 simsun.ttc 支持有问题,导致 winfonts 下没能嵌入 truetype 字体,使得显示效果一般,TeXLive 2009 最新版已经包含 pdftex 1.40.10 (2009-11-30 发布),支持 .ttc 字体文件,因此显示效果很好。
|
||||
|
||||
编译结果:
|
||||
|
||||
模板 字体选项 实际字体 pdf 大小 显示 超链接 字体信息 选择 复制 书签 搜索
|
||||
gbk.tex cjkfonts 文鼎 失败
|
||||
gbk.tex winfonts 中易 102851 很好 正常 正常 乱码 正常 正常 正常
|
||||
utf8.tex cjkfonts 文鼎 873447 一般 正常 正常 乱码 正常 正常 正常
|
||||
utf8.tex winfonts 中易 73237 很好 正常 正常 乱码 正常 正常 正常
|
||||
|
||||
此方式编译时 ctex 基于 cjk 宏包,adobefonts 等价于 winfonts。
|
||||
|
||||
==== latex + dvips + ps2pdf (过时,不推荐,仅供参考) ====
|
||||
|
||||
ps2pdf 需要安装 ghostscript,另外 Debian 上 texlive-extra-utils 包有 epstopdf, context 包有 pstopdf,但这两个程序在 TeXLive 2009 都没有。
|
||||
dvips 方式不能嵌入 truetype 字体,生成的 pdf 里中文不能搜索,因此建议不要使用。
|
||||
为了使书签不乱码,需要把模板中 hyperref 的 dvipdfmx 选项改成 ps2pdf,并使用 gbk2uni,见下面小节 pdflatex。
|
||||
|
||||
编译方式:
|
||||
|
||||
latex a.tex
|
||||
latex a.tex # 使用交叉引用信息,书签需要这个
|
||||
gbk2uni a.out # 如果是 GBK 编码
|
||||
latex a.tex # 如果是 GBK 编码,使用正确编码的交叉引用信息
|
||||
dvips a.dvi
|
||||
ps2pdf a.ps
|
||||
|
||||
编译结果:
|
||||
|
||||
模板 字体选项 实际字体 pdf 大小 显示 超链接 字体信息 选择 复制 书签 搜索
|
||||
gbk.tex cjkfonts 文鼎 失败
|
||||
gbk.tex winfonts 中易 36979 一般 正常 丢失 乱码 乱码 正常 不支持
|
||||
utf8.tex cjkfonts 文鼎 42573 一般 正常 正常 乱码 乱码 正常 不支持
|
||||
utf8.tex winfonts 中易 36800 一般 正常 丢失 乱码 乱码 正常 不支持
|
||||
|
||||
此方式编译时 ctex 基于 cjk 宏包,adobefonts 等价于 winfonts。
|
||||
|
||||
后注:snoopyzhao@newsmth 指出 dvips 方式制作出的中文 PDF 也是可以正常搜索复制的,我实验了下,发现使用 Type 1 字体就可以,TeXLive 2009 默认只配备了文鼎几款覆盖 GB2312 字符集的 Type 1 中文字体,上面表格的结果是从 truetype 自动生成的 Type 3 字体,而如果用 Type 1 字体,GB 编码下字体信息、选择、复制、搜索都正常,显示效果也很好,例子如下,编译方式同上。
|
||||
|
||||
\documentclass{article}
|
||||
\usepackage{CJK} % 如果文档内容用 UTF-8 编码,把 CJK 换成 CJKutf8
|
||||
\usepackage[CJKbookmarks,ps2pdf]{hyperref} % 如果文档内容用 UTF-8 编码,把 CJKbookmarks 改成 unicode
|
||||
\begin{document}
|
||||
\begin{CJK*}{GB}{gbsn} % 如果文档内容用 UTF-8 编码,把 GB 改成 UTF8
|
||||
|
||||
\title{latex + dvips + ps2pdf 编译方式的中文支持}
|
||||
\author{作者}
|
||||
\maketitle
|
||||
\tableofcontents
|
||||
|
||||
\section{第一段}
|
||||
我来试试复制与搜索……
|
||||
\section{第二段}
|
||||
我来试试复制与搜索……
|
||||
\section{第三段}
|
||||
我来试试复制与搜索……
|
||||
% See http://lists.ffii.org/pipermail/cjk/2008-April/002218.html
|
||||
% "CJKutf8 results in error in TOC": This is documented in CJK.txt, section 'Possible errors'
|
||||
%\clearpage % UTF-8 编码时打开, 否则第二遍 latex 时报告章节标题错误,感谢 snoopyzhao@newsmth 指出
|
||||
\end{CJK*}
|
||||
\end{document}
|
||||
|
||||
====== ConTeXt ======
|
||||
|
||||
文档参考:
|
||||
|
||||
ctx-notes - http://ctex-doc.googlecode.com/svn/trunk/context-notes-zh-cn/
|
||||
way2ctx - http://code.google.com/p/way2ctx/downloads/list
|
||||
ctx-top10 - http://ctex-doc.googlecode.com/svn/trunk/context-top-ten/
|
||||
ctx-tutor - http://meeting.contextgarden.net/2008/talks/2008-08-21-willi-aditya-beginners/
|
||||
|
||||
特别注意: ctex 论坛有人说 2008 年以前的 ConTeXt 文档大多不适用于 ConTeXt MkIV,阅读时需要小心。
|
||||
|
||||
由于 ConTeXt MkIV 使用近来开发的 LuaTeX 引擎,能容易的使用字体,所以推荐使用。 ConTeXt MkII 使用 pdftex 引擎排版。
|
||||
|
||||
==== MkIV (推荐) ====
|
||||
|
||||
所有模板都是 UTF-8 编码,参照 way2ctx 安装好 ConTeXt Minimals 后,找到 Adobe 的四款字体(AdobeFangsongStd-Regular.otf AdobeHeitiStd-Regular.otf AdobeKaitiStd-Regular.otf AdobeSongStd-Light.otf) 放到某个目录下并设置 好 OSFONTDIR,编译方法见 way2ctx 文档。
|
||||
|
||||
所有模板都在 ConTeXt Minimals 2009-09-02 Linux 版编译通过。
|
||||
|
||||
使用 Li Yanrui 的 zhfonts.tex - http://ctex-kit.googlecode.com/svn/trunk/templates/ConTeXt-MkIV/zhfonts/
|
||||
使用 Li Yanrui 的新 zhfonts.tex - http://ctex-kit.googlecode.com/svn/trunk/templates/ConTeXt-MkIV/zhfonts-new/
|
||||
使用 Li Yanrui 的 t-zhfonts - http://ctex-kit.googlecode.com/svn/trunk/templates/ConTeXt-MkIV/t-zhfonts/
|
||||
使用 t-simplefonts - http://ctex-kit.googlecode.com/svn/trunk/templates/ConTeXt-MkIV/t-simplefonts/
|
||||
|
||||
!!! Sorry, I'm stupid, I have no idea which one is better...
|
||||
16
Zim/LaTex/latex中的盒子.txt
Normal file
@@ -0,0 +1,16 @@
|
||||
Content-Type: text/x-zim-wiki
|
||||
Wiki-Format: zim 0.4
|
||||
Creation-Date: 2011-09-26T20:07:19+08:00
|
||||
|
||||
====== latex中的盒子 ======
|
||||
http://blog.sina.com.cn/s/blog_5e16f1770100gwkw.htmltop
|
||||
Created Monday 26 September 2011
|
||||
任何 LATEX 对象(字符,图形等)都把盒子作为单位, 每个盒子在它的左侧均有一参考点 (Reference point)。盒子的基线(baseline,见图 )是通过参考点的一条水平线。当 LATEX 排列文本时,这些字符的参考点被从左到右的排成一条直线,称为当前基线(current baseline),并使它与字符的基线对齐。 LATEX 也用同样的方法来处理图形和其它对象,每个对象的参考点都被放置于当前基线上。
|
||||
{{./1.gif}}
|
||||
每个 LATEX 盒子的大小由高度、深度、宽度( height,depth,width)来决定。高度是参考点到盒子顶部的距离,深度是参考点到盒子底部的距离,宽度则是盒子的宽度。全部高度(totalheight)被定义为从盒子底部到顶部的距离,即:
|
||||
全部高度=高度+深度
|
||||
所有未曾旋转的 EPS 图形的参考点都是它的左下角(见下图的左边的盒子),它的深度为零,高度就等于全部高度。图中间的盒子则是将图形旋转后,它的高度就不等于全部高度了。右边的盒子则展示可将图形旋转使其高度为零。
|
||||
{{./2.gif}}
|
||||
|
||||
|
||||
地址:http://www.ctex.org/documents/latex/graphics/node6.html
|
||||
BIN
Zim/LaTex/latex中的盒子/1.gif
Normal file
|
After Width: | Height: | Size: 3.0 KiB |
BIN
Zim/LaTex/latex中的盒子/2.gif
Normal file
|
After Width: | Height: | Size: 6.0 KiB |
30
Zim/LaTex/tex系统概述.txt
Normal file
@@ -0,0 +1,30 @@
|
||||
Content-Type: text/x-zim-wiki
|
||||
Wiki-Format: zim 0.4
|
||||
Creation-Date: 2011-09-07T20:35:20+08:00
|
||||
|
||||
====== tex系统概述 ======
|
||||
Created Wednesday 07 September 2011
|
||||
http://bbs.ctex.org/viewthread.php?tid=49647
|
||||
语言层面:
|
||||
|
||||
TeX 是一种宏语言。就像别的语言有库一样,TeX 语言有宏的集合。这些宏,就是用这个语言写出来的东西,供大家共用的。TeX 有个最基本的宏集合,与基础语言一起构成一种“格式”,就是 Plain TeX。基本的 TeX 语言和 Plain TeX 的宏,都是 Knuth 完成的。
|
||||
后来有了 LaTeX,就是 Lamport TeX。LaTeX 也是宏的集合,也构成一种与 Plain TeX 不一样的格式。这种格式提供了不少方便的功能,并强调结构化的文档,因而很快风行起来。
|
||||
世界在发展,LaTeX 这个格式提供的基本功能并不能满足所有人的需要,就有人接着写宏。这些宏可能就是在 LaTeX 这个格式的框架下面编写的,也就是说是依赖于 LaTeX 宏的宏。一些有能力有精力的人把他觉得有用的宏打成包,公开发布,就成为了 LaTeX 的宏包。换言之,宏包就是基本的格式的扩展。当然它是人人可写的,特别有名的,比如美国数学会官方定制的 AMSTeX/AMSLaTeX,就是一套 TeX/LaTeX 格式下面的宏包。
|
||||
|
||||
再来说软件层面:
|
||||
|
||||
一个语言是抽象的,不能运行就没有结果。因此 Knuth 在设计这个语言的同时也给出了一个程序用来把 TeX 语言的代码转换为排版的结果——这个程序当然也叫 TeX。嗯,可以把这个程序看做编译器。直接运行 tex 命令(我用小写字母表示你实际使用的命令),默认就是用 Plain TeX 这种格式进行排版。为示区别,我们可以把 Knuth 的这个 TeX 程序叫 Knuth TeX。
|
||||
用 tex 加上一个选择格式的命令行编译选项,就可以改用 LaTeX 这种格式进行排版了。但这很麻烦,于是就把 tex 命令与对应编译选项合成为一个命令,叫 latex。简言之,latex 命令就是 tex 命令加一个选项的简写方式。
|
||||
Knuth TeX 这个程序有一些功能不好实现,后面就有人进行扩展,得到 ε-TeX 这个程序,一般写成 eTeX。eTeX 程序和 Knuth TeX 都是 TeX 语言的一个实现,eTeX 增加了少量的几个命令,但一般来说是没有太多区别的。
|
||||
Knuth TeX 输出的格式是 DVI(DeVice Independent)文件,但后来电子出版业和电子文档交换中常用的格式是 Adobe 公司开发的 PostScript 格式(PS)和 Portable Document Format 格式(PDF)。因此就需要有一些工具完成这样的转换,一些转换程序应运而生:Dvips(把 DVI 转换为 PS);DVIPDF、DVIPDFM、DVIPDFMx(把 DVI 转换为 PDF,可以认为后面的是前面的改进版)。
|
||||
转换的过程令人不爽,于是就又有了 TeX 语言的又一个实现,pdfTeX。它会把 TeX 语言写的代码直接编译成 PDF 文件。当然,不难理解 pdftex 命令就是用 pdfTeX 这个程序和 Plain TeX 这个格式进行排版,而 pdflatex 这个命令就是用 pdfTeX 这个程序和 LaTeX 格式进行排版。不过 pdfTeX 程序也保留了输出 DVI 格式的能力。
|
||||
时代在发展,多字节的编码渐渐代替 ASCII 成为主流。为了支持 Unicode 编码和直接访问操作系统字体,又出现了 TeX 语言的新的实现,即 XeTeX。作为一个现代的程序,XeTeX 也直接输出 PDF 文件(我们暂不去管它内部有格式转换的实现方式)。于是,不难理解 xetex 命令就是使用 XeTeX 程序以 Plain TeX 格式排版,而 xelatex 命令就是用 XeTeX 程序以 LaTeX 格式排版。
|
||||
哦,人们的要求总是在发展,现在又想在 TeX 中嵌入其他语言进行更强有力的扩展了。于是 Lua 脚本语言和 TeX 语言的结合体,LuaTeX 应运而生。LuaTeX 程序也是 TeX 语言的一个完整的有扩展的实现。LuaTeX 支持 Unicode、系统字体和内嵌语言扩展,能直接输出 PDF 格式文件,也可以仍然输出 DVI 格式。于是 LuaTeX 程序又对应了许多命令:luatex 使用 Plain TeX 格式,输出 DVI;lualatex 使用 LaTeX 格式,输出 DVI;pdfluatex 使用 Plain TeX 格式,输出 PDF;pdflualatex 使用 LaTeX 格式,输出 PDF。
|
||||
|
||||
瞧,语言的脉络是简单的,但软件程序总是层出不穷。
|
||||
|
||||
|
||||
故事还没有完,前面我遗漏了一个重要的格式,叫做 ConTeXt。这个格式从一开始就很强调与脚本语言,也就是具体实现程序的结合。过去旧版本的 ConTeXt 是使用 pdfTeX 程序作为它的排版引擎的,用来扩展的脚本语言是 ruby,编译文件使用的命令一般是 texexec;新版本的 ConTeXt 则使用 LuaTeX 作为它的排版引擎,脚本也都直接使用 Lua,编译时使用的命令是 context。那么不难猜,所谓“XeConTeXt”是什么东西,它事实上是 ConTeXt 改用 XeTeX 程序作为它的排版引擎的一种编译方式,实际的命令则是 texexec 或 context 加上适当的命令行选项。
|
||||
|
||||
|
||||
最后说一下 BibTeX 和 MakeIndex。这两个都是与 TeX 相关联的工具程序,一般用在 LaTeX 格式上。BibTeX 处理 .tex 文件,根据其中的引用,从文献数据库中提取生成参考文献列表;而 MakeIndex 处理 LaTeX 格式编译时输出的 .idx 文件(里面是索引条目),生成 .ind 文件(里面是排序整理好的索引条目)。
|
||||
95
Zim/LaTex/一些常见的字体示例.txt
Normal file
@@ -0,0 +1,95 @@
|
||||
Content-Type: text/x-zim-wiki
|
||||
Wiki-Format: zim 0.4
|
||||
Creation-Date: 2011-09-10T23:44:02+08:00
|
||||
|
||||
====== 一些常见的字体示例 ======
|
||||
Created Saturday 10 September 2011
|
||||
|
||||
http://www.hopestudio.cn/Item/52938.aspx
|
||||
作者:周梦蕾
|
||||
|
||||
做设计的时候,我们除了要和颜色、图片等要素打交道之外,文字也是另一个不可或缺的元素。要想将文字运用得当、使之最大限度地发挥出它的效果,就有必要掌握一些字体知识,就让我们从认识一些常规字体开始吧,这一篇先介绍一些常见中文字体,在下一篇会有一些英文字体的介绍。
|
||||
|
||||
(注:所有截图中字的字号均统一为初号)
|
||||
|
||||
xp 下主要字体为:宋体simsun.ttc、黑体simhei.ttc、仿宋simfang.ttf、楷体simkai.ttf、隶书simli.ttf、幼圆simyou.ttf,另外推荐大家安装微软雅黑字体,以便用来美化fedora 的显示,图1 就是使用雅黑字体的效果,挺养眼的。
|
||||
|
||||
字体是不分什么Windows、Linux的,只有是否有字体的授权,以及字体的授权是否许可的问题,我在Linux上主要用文泉驿,不过也用一些方正的字体,因为以前买过iwps,里面含有88套方正字体,所以也是合法使用。
|
||||
|
||||
===== 宋体 =====
|
||||
:想必大家对它都不陌生了,在Vista发布之前,它一直都是Windows简体中文版的系统默认字体,也常用于书籍、杂志、报纸印刷的正文排版。宋体的笔画__有粗细变化__,而且一般是横细竖粗,__末端有装饰部分__(即“字脚”,或称“衬线”),点、撇、捺、钩等笔画有尖端。
|
||||
|
||||
{{./宋体.jpg}}
|
||||
|
||||
===== 仿宋 =====
|
||||
:人们模仿宋体字的结构、笔意,改成笔画__粗细一致__、秀丽狭长的印刷字体,这就是仿宋体。
|
||||
{{./仿宋.jpg}}
|
||||
|
||||
===== 微软雅黑 =====
|
||||
:虽然宋体长期以来一直作为Windows的默认字体,但对于电脑显示器来说,应该选择无衬线字体作为__显示器字体__,才有助于显示和阅读,因为笔划上过多的点缀(笔划末端的小三角)很容易造成视觉疲劳,当显示在屏幕上时尤甚。微软已经随着Windows Vista的推出而改用“微软雅黑”作为系统的默认字体。这款字体是一种全新的无衬线黑体,它的字形略呈扁方而饱满,笔画简洁而舒展,易于阅读,清新优美。雅黑还有一个与众不同的特点:它的粗体字不像大多数字体那样通过内嵌点阵或者字体引擎渲染,而是重新进行设计,几乎相当于另外设计一套字体。当然,收到的效果也相当不错。想更详细地了解雅黑,请点击这里查阅工作室网站里的相关文章。
|
||||
|
||||
{{./微软雅黑.jpg}}
|
||||
|
||||
===== 黑体 =====
|
||||
:黑体同样也是没有衬线装饰的字体,字形端庄,笔画横平竖直,笔迹全部__一样粗细__。由于汉字笔划多,**小字黑体清晰度较差**,所以一开始主要用于文章标题,但随着制字技术的精进,已有许多适用于正文的黑体字型。
|
||||
{{./黑体.jpg}}
|
||||
(注:粗体在不正式的的场合里常常也被叫做“黑体”,造成了中文指称的混乱。这里所介绍的黑体只是一种字体而不是一类字体的统称。)
|
||||
|
||||
===== 幼圆 =====
|
||||
:幼圆是圆体的变体。由于圆体是黑体的变体,所以幼圆体也源自黑体。幼圆体的主要特点有三:一是笔划更加细长,便于阅读;二是拐弯处笔划处理尤为细腻;三是在旧版本的幼圆体中,对旧字形的处理比较到位。
|
||||
|
||||
{{./幼圆.jpg}}
|
||||
|
||||
===== 隶书 =====
|
||||
:亦称汉隶,是汉字中常见的一种__庄重的字体__,书写效果略微宽扁,横画长而直画短,呈长方形状,讲究“蚕头雁尾”、“一波三折”。隶书以后的汉字为“今汉字”,今汉字的特点为符号性强,定型性强,字由有限种类的笔画构成。正是由于有了今汉字的这些特点,隶书仍大量地用在包装设计的文字应用中。
|
||||
|
||||
{{./隶书.jpg}}
|
||||
|
||||
===== 楷体 =====
|
||||
:较为正式严谨。
|
||||
{{./楷体.jpg}}
|
||||
|
||||
====== 常见的英文字体。 ======
|
||||
|
||||
|
||||
|
||||
===== Helvetica =====
|
||||
:Helvetica在拉丁文中意为“瑞士的”,是一种非常经典的英文字体,甚至还有一部为纪念它诞生50周年而产生的纪录片(关于此纪录片,请点击这里)。Helvetica被大量使用在标志、电视、新闻标题以及无数的商标上,如BASF、美国航空、BMW、Epson、英特尔、无印良品、雀巢、松下、Microsoft、三菱电机、摩托罗拉、渣打银行等数百间大企业的标志都使用了Helvetica字体。另外,Helvetica也是Mac OS系统的默认字体。Helvetica出自瑞士字体设计师Eduard Hoffmannh和Max Miedinger之手,体现了瑞士设计的理性主义精神,同时被认为是现代主义设计理念的典范。
|
||||
|
||||
{{./Helvetica.jpg}}
|
||||
|
||||
===== Arial =====
|
||||
:Arial字体是由美国著名字体公司Monotype于1982年发表的一款无衬线字体,据称Monotype设计这套字体是要以其作为一个较便宜的替代品与Helvetica竞争。它已经是全世界使用范围最广的一款字体之一了。它已经可以和鼎鼎大名的Times相媲美,不仅在传统媒体,即使在新媒体的WEB网页中也同样具有压倒性的高占有率。
|
||||
|
||||
{{./Arial.jpg}}
|
||||
|
||||
===== Times New Roman =====
|
||||
:它在字体设计上属于__过渡型衬线__,对后来的字型产生了很深远的影响。另外由于其中规中矩、四平八稳的经典外观,所以常被选为__标准字体__之一。 Times New Roman为Stanley Morison、Starling Burgess和Victor Lardent共同创造,由Monotype公司于1932年发表,并为英国的《泰晤士报》首次采用。在电脑方面,现在很多应用程序,还有网页浏览器和文字处理软件都是用它作为默认字体。
|
||||
{{./Times-New-Roman.jpg}}
|
||||
|
||||
|
||||
===== Cambria =====
|
||||
:它是搭载于微软Windows Vista、Microsoft Office 2007和Microsoft Office 2008 for Mac等软件的一个__衬线字体__。其字符间距和比例相当的平均,对角和垂直方向的笔画和衬线比较粗,而水平向的衬线比较细,强调笔画的末笔。当Cambria使用在大小超过20点的标题时,其字体间的间距会些微的缩小以求美观,但这样的设计并不适用于商业文件。
|
||||
{{./Cambria.jpg}}
|
||||
|
||||
|
||||
===== Verdana =====
|
||||
:一套无衬线字体,它在__小字上有结构清晰端整__、阅读辨识容易等高品质表现,成为许多领域爱用的标准字型之一。微软将Verdana纳入网页核心字体之一。
|
||||
{{./Verdana.jpg}}
|
||||
|
||||
|
||||
===== Tahoma =====
|
||||
:Tahoma是一个十分常见的无衬线字体,字体结构和Verdana很相似,其字符间距较小,而且对Unicode字集的支援范围较大。Tahoma和Verdana师出同门,同为名设计师Matthew Carter的作品,由微软在1999年推出。Tahoma是种非常圆滑的字体,该字体比较均衡,显示中英文混排会不会出现中英文不对齐的状态。
|
||||
{{./Tahoma.jpg}}
|
||||
|
||||
|
||||
===== Calibri =====
|
||||
:一种无衬线字体,为微软Microsoft Office 2007套装软件的默认字体,也是Microsoft Word默认字体的第一个无衬线字体。Calibri为字型设计师Lucas de Groot替微软开发的字型,曾于2005年字型设计竞赛(Type Design Competition)中获得系统字型(Type System)类的奖项。
|
||||
{{./Calibri.jpg}}
|
||||
|
||||
===== Georgia =====
|
||||
:一种衬线字体,为著名字型设计师Matthew Carter于1993年为微软所设计的作品,具有在小字下仍能清晰辨识的特性,可读性十分优良。乍看之下,Georgia与Times New Roman相当类似,但它们有多处不同。首先,在相同的字号下,Georgia的字符比Times New Roman的字符略大;其次,Georgia的字符线条较粗,衬线部份也比较钝而平。另外在数字部份也非常不同,Georgia采用称为“不齐线数字”的数字,特色在于数字会像西文字母般有高矮大小之别。
|
||||
{{./Georgia.jpg}}
|
||||
|
||||
__Comic Sans MS__:Comic Sans是一个似手写的字体,由Vincent Connare设计,并在1994年由微软发布。其被分类为一种随性且不连续的字体,设计基础来自于漫画书里的字体,可使用在非正式的文件里。从Windows 95之后,此字体就一直附带在微软的视窗系统里,已变成微软系统内最常用的字体之一。
|
||||
{{./Comic-Sans-MS.jpg}}
|
||||
BIN
Zim/LaTex/一些常见的字体示例/Arial.jpg
Normal file
|
After Width: | Height: | Size: 16 KiB |
BIN
Zim/LaTex/一些常见的字体示例/Calibri.jpg
Normal file
|
After Width: | Height: | Size: 16 KiB |
BIN
Zim/LaTex/一些常见的字体示例/Cambria.jpg
Normal file
|
After Width: | Height: | Size: 18 KiB |
BIN
Zim/LaTex/一些常见的字体示例/Comic-Sans-MS.jpg
Normal file
|
After Width: | Height: | Size: 17 KiB |
BIN
Zim/LaTex/一些常见的字体示例/Georgia.jpg
Normal file
|
After Width: | Height: | Size: 17 KiB |
BIN
Zim/LaTex/一些常见的字体示例/Helvetica.jpg
Normal file
|
After Width: | Height: | Size: 17 KiB |
BIN
Zim/LaTex/一些常见的字体示例/Tahoma.jpg
Normal file
|
After Width: | Height: | Size: 17 KiB |
BIN
Zim/LaTex/一些常见的字体示例/Times-New-Roman.jpg
Normal file
|
After Width: | Height: | Size: 17 KiB |
BIN
Zim/LaTex/一些常见的字体示例/Verdana.jpg
Normal file
|
After Width: | Height: | Size: 17 KiB |
BIN
Zim/LaTex/一些常见的字体示例/仿宋.jpg
Normal file
|
After Width: | Height: | Size: 17 KiB |
BIN
Zim/LaTex/一些常见的字体示例/宋体.jpg
Normal file
|
After Width: | Height: | Size: 17 KiB |
BIN
Zim/LaTex/一些常见的字体示例/幼圆.jpg
Normal file
|
After Width: | Height: | Size: 18 KiB |
BIN
Zim/LaTex/一些常见的字体示例/微软雅黑.jpg
Normal file
|
After Width: | Height: | Size: 18 KiB |
BIN
Zim/LaTex/一些常见的字体示例/楷体.jpg
Normal file
|
After Width: | Height: | Size: 17 KiB |
BIN
Zim/LaTex/一些常见的字体示例/隶书.jpg
Normal file
|
After Width: | Height: | Size: 17 KiB |
BIN
Zim/LaTex/一些常见的字体示例/黑体.jpg
Normal file
|
After Width: | Height: | Size: 18 KiB |
7
Zim/LaTex/中文处理.txt
Normal file
@@ -0,0 +1,7 @@
|
||||
Content-Type: text/x-zim-wiki
|
||||
Wiki-Format: zim 0.4
|
||||
Creation-Date: 2012-01-01T13:55:21+08:00
|
||||
|
||||
====== 中文处理 ======
|
||||
Created Sunday 01 January 2012
|
||||
|
||||
180
Zim/LaTex/中文处理/LaTex.txt
Normal file
@@ -0,0 +1,180 @@
|
||||
Content-Type: text/x-zim-wiki
|
||||
Wiki-Format: zim 0.4
|
||||
Creation-Date: 2011-03-27T19:53:11+08:00
|
||||
|
||||
====== LaTex ======
|
||||
Created Sunday 27 March 2011
|
||||
|
||||
~~Ubuntu 下配置texlive + CJK 中文环境 ~~**(过时)**
|
||||
|
||||
~~在ubuntu10.10上试验出来的,效果挺好。跟其他的配置不同的是,本配置方法力求简单,易用。所以,步骤很少,也不要下载一大堆的东西。~~
|
||||
|
||||
~~1、apt-get install texlive-base-bin latex-cjk-chinese~~
|
||||
|
||||
~~2、生成字体Type1字体:~~
|
||||
|
||||
~~2.1 mkdir $HOME/texmf~~
|
||||
|
||||
~~2.2 下载gbkfonts程序,保存到$HOME/texmf下。~~
|
||||
|
||||
~~2.3 复制 simsun.ttf, simli.ttf, simhei.ttf, simkai.ttf 到$HOME/texmf 下。~~
|
||||
|
||||
~~2.4 运行命令 ./gbkfonts simsun.ttf song~~
|
||||
|
||||
~~./gbkfonts simkai.ttf kai~~
|
||||
|
||||
~~./gbkfonts simli.ttf li~~
|
||||
|
||||
~~./gbkfonts simhei.ttf hei~~
|
||||
|
||||
~~…~~
|
||||
|
||||
~~3、更新系统的搜索路径~~
|
||||
|
||||
~~3.1 mktexlsr~~
|
||||
|
||||
~~3.2 编辑 /etc/texmf/updmap.d/00updmap.cfg, 在文件最后面添加一行Map cjk.map~~
|
||||
|
||||
~~3.3 sudo update-updmap~~
|
||||
|
||||
~~3.4 updmap~~
|
||||
|
||||
~~差不多就好了。效果和Windows下用LaTeX没什么区别。按照这些步骤配出来的可以直接编译使用GBK编码的中文tex档。而且,xdvi,pdflatex,都可以直接用。~~
|
||||
|
||||
~~测试文件~~
|
||||
~~view plaincopy to clipboardprint?~~
|
||||
~~ 1 \documentclass{article} ~~
|
||||
~~ 2 \usepackage{CJK} ~~
|
||||
~~ 3 ~~
|
||||
~~ 4 \begin{CJK*}{GBK}{song} ~~
|
||||
~~ 5 \title{测试} ~~
|
||||
~~ 6 \author{tayoto} ~~
|
||||
~~ 7 \end{CJK*} ~~
|
||||
~~ 8 ~~
|
||||
~~ 9 \begin{document} ~~
|
||||
~~ 10 \begin{CJK*}{GBK}{song} ~~
|
||||
~~ 11 \maketitle ~~
|
||||
~~ 12 中文测试 ~~
|
||||
~~ 13 \end{CJK*} ~~
|
||||
~~ 14 \end{document} ~~
|
||||
|
||||
~~[TeX Live] TeX Live 2009/2010 的 LaTeX 中文支持~~
|
||||
|
||||
~~本帖最后由 LiYanrui 于 2010-9-21 21:46 编辑~~
|
||||
|
||||
|
||||
发信人: jjgod (while(!asleep()) sheep++;), 信区: TeX
|
||||
标 题: TeX Live 2009 的 LaTeX 中文支持
|
||||
发信站: 水木社区 (Sat Nov 21 22:38:11 2009), 站内
|
||||
|
||||
最近刚发布的 TeX Live 2009 [1] 是对中文支持有较大改进的一个版本,这里简单介绍一下。
|
||||
首先,一如 2007, 2008 版本,TeX Live 2009 有中文版本的安装使用指南 [2],强烈建议在提问前把相关章节好好看看,这份指南主要叙述的是和中文无关的一些通用的问题。
|
||||
|
||||
然后 TeX Live 2009 的中文支持主要分为两部分**,基于 XeTeX 的,和基于传统 CJK 宏包**的。(我这里只讨论 LaTeX的,如果你希望尝试 ConTeXt 和 luatex,可以参考 Li Yanrui 的 blog [3],他有很详细的介绍。)
|
||||
|
||||
===== 基于 XeTeX 的方案 =====
|
||||
-----------------
|
||||
|
||||
这是我们推荐的方案,又可分为高层与低层两种,分别适用于不同需求的用户。
|
||||
|
||||
首先,安装所需的宏包:
|
||||
|
||||
sudo tlmgr install** xecjk ctex**
|
||||
|
||||
高层的方案是使用 __ctex 宏包自带的文档类__,例如原来用 article 文档类的就改用 ctexart 文档类,原来用 book文档类的就改用 ctexbook 文档类,这样绝大部分你会遇到的中文问题,比如字体设置、hyperref的调用、章节标题的设置等等,都自动为你解决了。详情可以看 ctex 宏包的文档 [4]。下面是一个小例子:
|
||||
|
||||
\documentclass{ctexart}
|
||||
\begin{document}
|
||||
你好,TeX Live 2009!
|
||||
\end{document}
|
||||
|
||||
默认情况 (winfonts) 下,你需要宋体 (SimSun)、仿宋 (simfang)、黑体 (simhei)、楷体 (simkai)、隶书(LiSu)、幼圆 (YouYuan) 这六套 Windows 字体,如果你的字体不全,可以编辑ctex-xecjk-winfonts.def 文件 (用 kpsewhich 来找) 来修改设置,也可以选择 Adobe Reader等软件所带的 Adobe Song Std, Adobe Heiti Std, Adobe Kaiti Std, Adobe FangsongStd 四款字体,这时需要给 ctexart 加上__ [adobefonts] __选项。又或者,你可以不用这些预置的字体,使用__ [nofonts]__选项,然后参考 ctex-xecjk-winfonts.def 文件,自己定义对应各个 CJK 字体族的字体。
|
||||
|
||||
低层的方案则是__用原来__你自己的宏包,结合__ xeCJK 宏包来配置字体__,下面是一个小例子:
|
||||
|
||||
\documentclass__{article}__
|
||||
\usepackage{xeCJK}
|
||||
\setCJKmainfont{SimSun}
|
||||
\begin{document}
|
||||
你好,TeX Live 2009!
|
||||
\end{document}
|
||||
|
||||
当然,你得有 SimSun 这个字体。不管选用高层的还是低层的,都可以直接用 xelatex 命令直接编译你的文档。
|
||||
|
||||
===== 安装字体: =====
|
||||
在个人主目录先创建__.fonts文件夹__,把自己需要的字体复制进去就可以了。(我安装了,Adobe的4种字体,微软的6种,还有文泉驿的.)
|
||||
$fc-list :lang=zh-cn | sort
|
||||
查看已经安装的中文字体
|
||||
|
||||
到现在为止,中文的显示应该没有问题了。高层的方案比较好写,只是在很多场合**中英文要求不同字体显示**,我采用__低层xeCJK宏包__来解决的。
|
||||
下面是一个采用xeCJK处理的例子,简明易懂:
|
||||
==============================================================================================
|
||||
% !Mode:: "TeX:UTF-8"
|
||||
\documentclass[12pt,a4paper]__{article}__
|
||||
\usepackage{xltxtra,fontspec,xunicode}
|
||||
\usepackage[slantfont,boldfont]__{xeCJK}__ % 允许斜体和粗体
|
||||
|
||||
\setCJKmainfont{FZJingLeiS-R-GB} % 设置缺省中文字体 徐静蕾字体
|
||||
\setCJKmonofont{SimSun} % 设置等宽字体
|
||||
\setmainfont{TeX Gyre Pagella} % 英文衬线字体
|
||||
\setmonofont{Monaco} % 英文等宽字体
|
||||
\setsansfont{Trebuchet MS} % 英文无衬线字体
|
||||
|
||||
\begin{document}
|
||||
|
||||
\begin{verse}
|
||||
Stray birds of summer come to my window to sing and fly away. \\
|
||||
And yellow leaves of autumn, which have no songs, \\
|
||||
flutter and fall there with a sign.\\
|
||||
|
||||
\hfill \emph{Rabindranath Tagore}
|
||||
\end{verse}
|
||||
|
||||
\begin{verse}
|
||||
夏天的飞鸟,飞到我的窗前唱歌,又飞去了。\\
|
||||
秋天的黄叶,它们没有什么可唱,只叹息一声,飞落在那里。\\
|
||||
\hfill \emph{罗宾德拉纳特·泰戈尔}
|
||||
\end{verse}
|
||||
|
||||
\end{document}
|
||||
========================================================================
|
||||
|
||||
~~传统 CJK 方案(过时)~~
|
||||
~~-------------~~
|
||||
|
||||
~~传统 CJK 方案主要是为了方便使用以前的文档存在的。也分为两种,高层方案也是使用 ctex 宏包,低层方案和原来的文档一样,直接用 CJK 宏包。~~
|
||||
|
||||
~~使用 ctex 宏包的例子和前面用 ctexart 的那个完全一样:~~
|
||||
|
||||
~~\documentclass{ctexart}~~
|
||||
~~\begin{document}~~
|
||||
~~你好,TeX Live 2009!~~
|
||||
~~\end{document}~~
|
||||
|
||||
~~不过需要注意的是,你还得安装 zhmetrics 宏包。另外,如果文档保存的编码是 GBK,必须添加 [GBK] 选项,否则用 UTF-8 编码的也建议用 [UTF8] 选项。~~
|
||||
|
||||
~~可以看出,用高层方案最大的好处是文档代码可以最大限度地不修改就能换用不同的 TeX 引擎。~~
|
||||
|
||||
~~低层方案与原来的做法的区别是,需要载入 zhwinfonts,使用 zhwinfonts 定义的字体,而不是原来自己去生成字体的映射文件,这样要简便很多:~~
|
||||
|
||||
~~\documentclass{article}~~
|
||||
~~\usepackage{CJK}~~
|
||||
~~\input zhwinfonts~~
|
||||
~~\begin{document}~~
|
||||
~~\begin{CJK}{zhsong}~~
|
||||
~~你好,TeX Live 2009!~~
|
||||
~~\end{CJK}~~
|
||||
~~\end{document}~~
|
||||
|
||||
~~注意,这里用了 zhsong 这个字体族而不是 song,为了避免和 CJK 宏包原来定义的冲突,我们定义的所有字体族都带 zh 前缀。~~
|
||||
|
||||
~~对于上述这两种情况,你都可以使用 latex 编译,用 dvipdfmx 生成 pdf。~~
|
||||
|
||||
~~除了上述的 zhmetrics, ctex, xeCJK 宏包以外,我们还在 CTAN/TeX Live 中提交了 zhspacing,CJKpunct, zh-luatex 等宏包,ctex-faq, lshort 中文翻译等文档,以上工作都需要感谢参与维护 ctex-kit[5] 的全体开发者,为 ctex-doc [6] 贡献内容的全体作者,也欢迎你参加到我们的工作中来,帮助进一步改进 TeX 的中文支持。~~
|
||||
|
||||
~~[1] http://www.tug.org/texlive~~
|
||||
~~[2] http://www.tug.org/texlive/doc/texlive-zh-cn/texlive-zh-cn.pdf~~
|
||||
~~[3] http://liyanrui.is-programmer.com/~~
|
||||
~~[4] http://tug.ctan.org/tex-archive/language/chinese/ctex/doc/ctex.pdf~~
|
||||
~~[5] http://code.google.com/p/ctex-kit~~
|
||||
~~[6] http://code.google.com/p/ctex-doc~~
|
||||
160
Zim/LaTex/中文处理/Linux下的中文LATEX解决方案.txt
Normal file
@@ -0,0 +1,160 @@
|
||||
Content-Type: text/x-zim-wiki
|
||||
Wiki-Format: zim 0.4
|
||||
Creation-Date: 2012-01-01T12:12:59+08:00
|
||||
|
||||
====== Linux下的中文LATEX解决方案 ======
|
||||
Created Sunday 01 January 2012
|
||||
http://www.cnblogs.com/rockcode/archive/2011/08/06/2129561.html
|
||||
|
||||
真正的Linux下的中文LATEX解决方案:** CTeX + xeCJK + XeTEX**
|
||||
|
||||
lins05
|
||||
mysnowls@163.com
|
||||
August 6, 2011
|
||||
|
||||
===== 摘要 =====
|
||||
|
||||
Linux下用LaTeX很方便,但是要解决中文的问题就不怎么方便,因 为TeX的字体系统很难自己解决。
|
||||
Windows下可以使用配置好的CTeX套装1 , 现在本文中就简介如何在Linux下配置CTeX,以方便写中文文档。
|
||||
|
||||
===== 目录 =====
|
||||
|
||||
1 老的方法
|
||||
1.1 缺乏可用的字体
|
||||
1.2 默认的格式不符合中文排版要求
|
||||
1.3 不能满足中文的其他要求
|
||||
2 CTeX和xeCJK
|
||||
2.1 字体
|
||||
2.2 中文版式
|
||||
2.3 CTeX和xeCJK的关系
|
||||
3 简单的例子
|
||||
4 注意事项
|
||||
4.1 如何安装
|
||||
4.2 推荐字体
|
||||
4.3 其他设置
|
||||
1 老的方法
|
||||
|
||||
LATEX的**CJK宏包**,经过实践证明,确实是一个可行且实用的中文LATEX解决方 案。但是它有几点不足:
|
||||
|
||||
1.1 缺乏可用的字体
|
||||
|
||||
LATEX下的中文字体很少,Linux下的字体更少。因为TEX的字体系统比较复杂,使得用户想自己生成字体非难困难,门槛很高,并且管理不方便。
|
||||
|
||||
1.2 默认的格式不符合中文排版要求
|
||||
|
||||
CJK宏包__仅仅解决了中文字体的问题__,但是它默认的格式是__英文的排版方式__(CJK的 作者是德国人)。
|
||||
因此,一般用户都需要自己设置种种版式:首行缩进,行距和段距。中英文混排时的字距,等等。
|
||||
|
||||
1.3 不能满足中文的其他要求
|
||||
|
||||
比如生成目录时,中文文档应该叫“目录”,而不是”CONTENTS”。类似的还有“ 附录”、“表格索引”等等。
|
||||
CTeX宏包和xeCJK宏包的__组合__相当完美的解决了这些问题。
|
||||
|
||||
====== 2 CTeX和xeCJK ======
|
||||
|
||||
2.1 字体
|
||||
|
||||
xeCJK宏包所使用的XeTeX引擎,是从MacOS移植到Linux和Windows上的。它最大的特点是__从底层就具备对unicode的支持__,以及可以**直接调用系统中已有的字体**。
|
||||
这意味着将LaTeX用户从和字体相关的一大推问题中解决出来了。只要系统中安装了中文字体,那么使用XeTeX就能使用这些字体。
|
||||
xeCJK是必须__使用XeTeX引擎__的,这也是为什么标题叫做CTeX + xeCJK + XeTeX的原因。
|
||||
|
||||
2.2 中文版式
|
||||
|
||||
CTeX的开发者们是值得所有的LaTeX用户感激的。__使用CTeX的各个documentclass__, 我们就无须再手动地设置版式,因为CTeX的默认设置就是__最适合中文文档__的:行首缩进两个汉字; 行距和段距的适当调整,中英文的混排时的字距,都是适合中文版式 的。
|
||||
此外,CTeX将其他应该为中文文档考虑的地方大都包括了进去:”CONTENTS”改为 了“目录”,”Index”改为了”索引“,等等。
|
||||
|
||||
2.3 CTeX和xeCJK的关系
|
||||
|
||||
二者都是宏包,但是,CTeX是一个__上层的中文LaTeX宏包__。它的**下层是可选**的,可 以__支持xeCJK、CJK__,甚至更老的CCT宏包。对于不同的下层宏包它进行不同的设置。xeCJK完全可以脱离CTeX使用,但是这样你虽然不用担心字体,同样也**不能享受到CTeX的中文版式**。
|
||||
|
||||
总的来说,__xeCJK完美地解决了中英文字体的问题,而CTeX完美地解决了中文版式的问题__,因此两者结合起来就可以完美地解决用TeX写作、排版中文文档的问题。
|
||||
|
||||
====== 3 简单的例子 ======
|
||||
|
||||
例子总是最直观的。我们以一个最简单的例子来说明。
|
||||
|
||||
%---------------------------------------
|
||||
\documentclass[a4paper]{article}
|
||||
\usepackage[**adobefonts**]{ctex}
|
||||
\setCJKmainfont{SimSun}
|
||||
%---------------------------------------
|
||||
\author{小明}
|
||||
\title{记一次春游}
|
||||
\date{\today}
|
||||
%---------------------------------------
|
||||
\begin{document}
|
||||
\pagestyle{plain}
|
||||
\maketitle
|
||||
%---------------------------------------
|
||||
|
||||
昨天,老师带我们三年级二班的小朋友们全体去郊外春游。我非常高兴。
|
||||
我们在郊外看到了\textbf{老虎、狮子和熊猫}。
|
||||
我长大了要\textsl{保护动物}。
|
||||
|
||||
那天,老师要教我们学习\LaTeX 了,大家都非常激动。
|
||||
\end{document}
|
||||
|
||||
====== 4 注意事项 ======
|
||||
|
||||
4.1 如何安装
|
||||
|
||||
Linux下安装这三者的最方便的方法是安装__texlive系列__。texlive是一整套TEX__工具和引擎的集合__,包括了LaTeX等种种工具和一些相关的程序、宏包,不同的发行版里会把整个texlive分为**不同的软件包**,诸如__texlive-xetex、texlive-xecjk、texlive-ctex__。用包管理软件进行搜索,不难找到应该安装的软件包。
|
||||
|
||||
当然另一种方式是使用texlive的安装DVD或者在线安装 工具。笔者使用的slackware发行版里没有提供texlive的软件包2 ,因此是从中科大的CTAN镜像3 下 载的texlive2011DVD进行安装的。具体的安装过程可以读光盘里的README文 件。
|
||||
|
||||
由于texlive是一个TeX软件的大集合。因此它有一个__专门的包管理程序:tlmgr__。 这个程序类似debian下的apt-get,提供了搜索、查询、安装、卸载、升级各个tex软件包的功能。在DVD安装版中有这个软件,一般的发行版应该不会提供这个程序4 。
|
||||
|
||||
4.2 推荐字体
|
||||
|
||||
一般使用的字体有三套。
|
||||
|
||||
* 一是在Linux下常用的文泉驿字体,但它__不适合__写正式的文档。
|
||||
* 二是在网上下载__Adobe的四套字体__,分别是宋体、仿宋、黑体和楷体。
|
||||
* 三是可以拷贝Window下的字体。但是这涉及到版权问题。如果确实想用,可以在百度上搜索**“方正楷体”、“方正宋体”**,等等。
|
||||
|
||||
使用字体的方法如下:
|
||||
|
||||
先拷贝字体到**/usr/share/fonts/**下的相应的子目录中,然后运行__"fc-cache"__更新系统的字体缓存。
|
||||
在xeCJK中,设置主字体是使用\setCJKmainfont命令(因为我们的CTeX会调 用xeCJK,因此可以使用xeCJK中的命令)。
|
||||
具体的字体名字可以用__"fc-list :zh-cn"__命令来查看。
|
||||
|
||||
4.3 其他设置
|
||||
|
||||
1 如果你的系统中**没有CTeX要求的全套六种字体**5 , 那么,一定要在\usepackage{ctex}的选项中加上__adobefonts__这一条。
|
||||
|
||||
这样一来CTeX会用相应的Adobe字体去代替它要求的六套字体。不然有时会出现 找不到字体的现象,尤其是使用特殊字体的时候,比如在verbtim环境中。
|
||||
|
||||
2 一般情况下,**中文文档中是不使用斜体**的。因此在CTeX调用xeCJK时,__默认是不使用斜体__的,所以你就算在文档中使用\textsl{},最终也不会产生任何斜体效 果。
|
||||
|
||||
如果你真的要用,就要修 改/ctex/engine/__ctex-xecjk-engine__.def6 中 的一行:
|
||||
|
||||
\RequirePackage[BoldFont,normalindentfirst]{xeCJK}
|
||||
|
||||
改为:
|
||||
|
||||
\RequirePackage[BoldFont,slantfont,normalindentfirst]{xeCJK}
|
||||
|
||||
====== 5 使用CTeX的两种方法 ======
|
||||
|
||||
第一种是__直接使用CTeX的文档类,CTex自动调用底层的xeCJK宏包设置中英文字体和中文文档格式__。
|
||||
|
||||
\documentclass[adobefonts]{ctexart}
|
||||
|
||||
第二种是__使用CTeX包__。这时可以手动导入xeCJK宏包,设置中文。
|
||||
|
||||
\usepackage[adobefonts]{ctex}
|
||||
|
||||
二者的区别是:当通过\usepackage来使用CTeX包时,产生的仍然 是”CONTENTS”、”INDEX”,而不是“目录”、“索引”。
|
||||
|
||||
当然,如果要用__其他类__作为文档类,就必须使用第二种方式了,最典型就是 用beamer类做幻灯片的时候了。
|
||||
|
||||
这时,如果要使用中文的“目录”、“摘要”等样式,可以使用这两条命 令:
|
||||
|
||||
**\renewcommand*\contentsname{目录} **
|
||||
**\renewcommand*\abstractname{摘要}**
|
||||
|
||||
还有一个更折腾的方法。修改一下ctex/ctex.sty文件,在其中添加一 句
|
||||
|
||||
\input{ctex-caption.def}
|
||||
|
||||
这样就一直保持中文的名称了。
|
||||
66
Zim/LaTex/中文处理/XeLaTeX---完美支持中文的TeX系统.txt
Normal file
@@ -0,0 +1,66 @@
|
||||
Content-Type: text/x-zim-wiki
|
||||
Wiki-Format: zim 0.4
|
||||
Creation-Date: 2011-09-24T09:48:41+08:00
|
||||
|
||||
====== XeLaTeX---完美支持中文的TeX系统 ======
|
||||
Created Saturday 24 September 2011
|
||||
http://forum.ubuntu.org.cn/viewtopic.php?f=35&t=247476&start=0
|
||||
要做毕业论文了,遂打算用LaTeX写个模板,虽然成功配置了中文环境,却始终对其编译生成的PDF文档不满意,尤其是在在中文字号的处理上。在网上搜索了一段时间,发现XeLaTeX对中文的支持很好,几乎不需要任何配置就可以轻松使用中文环境,而且支持调用外部字体,相当方便。由于 Texlive08套装集成了,所以可以直接使用了!为了更好的发挥作用,一般还需如下配置:
|
||||
新建一个zhfontcfg.sty文件(文件名无所谓了),内容如下:
|
||||
代码:
|
||||
% xetex/xelatex 字体设定宏包
|
||||
|
||||
\ProvidesPackage{zhfontcfg}
|
||||
\usepackage[cm-default]{fontspec} %[cm-default]选项主要用来解决使用数学环境时数学符号不能正常显示的问题
|
||||
|
||||
\usepackage{xunicode,xltxtra}
|
||||
\defaultfontfeatures{Mapping=tex-text} %如果没有它,会有一些 tex 特殊字符无法正常使用,比如连字符。
|
||||
% 中文断行
|
||||
\XeTeXlinebreaklocale "zh"
|
||||
\XeTeXlinebreakskip = 0pt plus 1pt minus 0.1pt
|
||||
%将系统字体名映射为逻辑字体名称,主要是为了维护的方便
|
||||
\newcommand\fontnamehei{文泉驿正黑}
|
||||
\newcommand\fontnamesong{SimSun}
|
||||
\newcommand\fontnamekai{AR PL KaitiM GB}
|
||||
\newcommand\fontnamemono{FreeMono}
|
||||
\newcommand\fontnameroman{Times New Roman}
|
||||
%%设置常用中文字号,方便调用
|
||||
\newcommand{\erhao}{\fontsize{22pt}{\baselineskip}\selectfont}
|
||||
\newcommand{\xiaoerhao}{\fontsize{18pt}{\baselineskip}\selectfont}
|
||||
\newcommand{\sanhao}{\fontsize{16pt}{\baselineskip}\selectfont}
|
||||
\newcommand{\xiaosanhao}{\fontsize{15pt}{\baselineskip}\selectfont}
|
||||
\newcommand{\sihao}{\fontsize{14pt}{\baselineskip}\selectfont}
|
||||
\newcommand{\xiaosihao}{\fontsize{12pt}{\baselineskip}\selectfont}
|
||||
\newcommand{\wuhao}{\fontsize{10.5pt}{\baselineskip}\selectfont}
|
||||
\newcommand{\xiaowuhao}{\fontsize{9pt}{\baselineskip}\selectfont}
|
||||
\newcommand{\liuhao}{\fontsize{7.5pt}{\baselineskip}\selectfont}
|
||||
%设置文档正文字体为宋体
|
||||
\setmainfont[BoldFont=\fontnamehei]{\fontnamesong}
|
||||
\setsansfont[BoldFont=\fontnamehei]{\fontnamekai}
|
||||
\setmonofont{\fontnamemono}
|
||||
%楷体
|
||||
\newfontinstance\KAI {\fontnamekai}
|
||||
\newcommand{\kai}[1]{{\KAI#1}}
|
||||
%黑体
|
||||
\newfontinstance\HEI{\fontnamehei}
|
||||
\newcommand{\hei}[1]{{\HEI#1}}
|
||||
%英文
|
||||
\newfontinstance\ENF{\fontnameroman}
|
||||
\newcommand{\en}[1]{\,{\ENF#1}\,}
|
||||
|
||||
保存后,放在Xelatex文件夹下的fontspec(xelatex下的任意位置都可以)下,并sudo texhash 刷新。之后,就可以通过调用该包(\usepackage{zhfontcfg})实现应用。继续发现,开始享受吧!!
|
||||
|
||||
几个需要说明的问题:
|
||||
1)映射逻辑字体时,请确认系统中已经安装了相应字体,如不确定,可以通过如下命令查看:
|
||||
|
||||
代码:
|
||||
fc-list %查看系统安装的所有字体
|
||||
__fc-list :lang=zh-cn __%查看系统安装的中文字体(注意list后面有一个空格)
|
||||
|
||||
|
||||
2)要添加新字体,可参考已有命令; 其中:
|
||||
|
||||
\HEI 作用范围:{\HEI 内容},\HEI 内容,则“内容”都会是黑体;
|
||||
\hei 作用范围: \hei{内容}
|
||||
|
||||
目前为止,使用中文环境比较舒服了。而且,经过两天的努力,成功按照学校要求编写了学士论文的LaTeX+CJK 模板和XeLaTeX模板,并得到了精华鼓励。呵呵,以后,就用它工作了。
|
||||
80
Zim/LaTex/中文处理/XeLaTeX---完美支持中文的TeX系统/2.txt
Normal file
@@ -0,0 +1,80 @@
|
||||
Content-Type: text/x-zim-wiki
|
||||
Wiki-Format: zim 0.4
|
||||
Creation-Date: 2011-09-24T09:51:47+08:00
|
||||
|
||||
====== 2 ======
|
||||
Created Saturday 24 September 2011
|
||||
摸索的两个月,终于知道如何让latex完美支持中文了,那就是Xetex。
|
||||
|
||||
配置:
|
||||
从源中安装xetex.....ok。
|
||||
xetex将使用你系统的字体,也就是说你不用自己去编译字体了。
|
||||
|
||||
使用 $ fc-list :lang=zh-cn 可以看到你的中文字体。
|
||||
使用 $ fc-list 可以看到你的所有字体。
|
||||
# su
|
||||
# mkdir /usr/share/texmf/tex/xelatex/zhfontcfg
|
||||
|
||||
在zhfontcfg文件夹中创建一个“zhfontcfg.sty” 文件如下:
|
||||
|
||||
% xetex/xelatex 字体设定宏包
|
||||
|
||||
\ProvidesPackage{zhfontcfg}
|
||||
\usepackage{fontspec,xunicode}
|
||||
\defaultfontfeatures{Mapping=tex-text} %如果没有它,会有一些 tex 特殊字符无法正常使用,比如连字符。
|
||||
|
||||
% 中文断行
|
||||
\XeTeXlinebreaklocale "zh"
|
||||
\XeTeXlinebreakskip = 0pt plus 1pt minus 0.1pt
|
||||
|
||||
%将系统字体名映射为逻辑字体名称,主要是为了维护的方便
|
||||
\newcommand\fontnamehei{FZHeiTi}
|
||||
\newcommand\fontnamesong{Adobe Song Std}
|
||||
\newcommand\fontnamekai{FZKaiTi}
|
||||
\newcommand\fontnamemono{DejaVu Sans Mono}
|
||||
\newcommand\fontnameroman{Dustismo Roman}
|
||||
|
||||
%设置文档正文字体为宋体
|
||||
\setmainfont[BoldFont=\fontnamehei]{\fontnamesong}
|
||||
\setsansfont[BoldFont=\fontnamehei]{\fontnamekai}
|
||||
\setmonofont{\fontnamemono}
|
||||
|
||||
|
||||
%楷体
|
||||
\newfontinstance\KAI{\fontnamekai}
|
||||
\newcommand{\kai}[1]
|
||||
|
||||
%黑体
|
||||
\newfontinstance\HEI{\fontnamehei}
|
||||
\newcommand{\hei}[1]
|
||||
|
||||
%英文
|
||||
\newfontinstance\ENF{\fontnameroman}
|
||||
\newcommand{\en}[1]{\,{\ENF #1}\,}
|
||||
\newcommand{\EN}{\,\ENF\,}
|
||||
|
||||
注意:你可以选择你想要的字体。我是使用了Adobe Song Std,作为song体,这样文档可以在adobe reader墨色均匀。
|
||||
|
||||
运行:
|
||||
#sudo mktexlsr
|
||||
|
||||
一切ok.用xelatex编译,你的文档将不含任何乱码,包括书签,呵呵。
|
||||
|
||||
例子:test.tex
|
||||
|
||||
\documentclass{article}
|
||||
\usepackage{zhfontcfg}
|
||||
\usepackage[colorlinks,linkcolor=black]{hyperref}
|
||||
%opening
|
||||
\title{latex多字体简易示例}
|
||||
\author{颜开}
|
||||
\begin{document}
|
||||
\maketitle
|
||||
\section{楷体}
|
||||
\kai{楷体}
|
||||
\section{黑体}
|
||||
\hei{黑体}
|
||||
\end{document}
|
||||
|
||||
哈哈,搞定了吧
|
||||
|
||||
133
Zim/LaTex/中文处理/如何在_LaTeX_中处理中文.txt
Normal file
@@ -0,0 +1,133 @@
|
||||
Content-Type: text/x-zim-wiki
|
||||
Wiki-Format: zim 0.4
|
||||
Creation-Date: 2012-01-01T13:29:51+08:00
|
||||
|
||||
====== 如何在 LaTeX 中处理中文 ======
|
||||
Created Sunday 01 January 2012
|
||||
|
||||
===== 我该安装什么发行版? =====
|
||||
|
||||
* 我什么都不知道/大多数人: TeX Live 2011 或 CTeX 套装 2.9 以后版本
|
||||
* 我使用 ConTeXt: ConTeXt Minimals
|
||||
* 我还听说有XXX: 不妨自己试试
|
||||
|
||||
注:
|
||||
安装后建议使用 __TeX Live Manager__ 或 MiKTeX Maintenance 连接 CTAN 在线更新。部分中文支持的宏包可能需要更新后才能确保正常使用。
|
||||
|
||||
===== 我该用什么编辑器? =====
|
||||
|
||||
编辑器功能有简有繁,特色不一,从简单的纯文本编辑器到繁复的 Emacs,__因人而易__。基本功能有语法高亮、方便编译预览就很好了,扩充功能和定制有无限的可能。既可以使用界面友好、使用方便的专用编辑器,如 TeXWorks、Kile、WinEdt 等,或者接近所见即所得功能的 LyX;也可以使用定制性强的通用编辑器,如 Notepad++、SciTE、Vim、Emacs 等。这方面的介绍很多,一开始不妨多试几种,找到最适合自己的才是最好的。
|
||||
|
||||
另外提醒一句,编辑器只是工作的助力,不必把它看得太重。一些编辑器有极为繁杂的功能,一些编辑器常常会引来黑客们的论战(如 Emacs 与 Vim)。为工作,别为这些浪费太多精力,适用即可。
|
||||
|
||||
===== 我该去哪里寻找答案? =====
|
||||
0、绝对的新手,先读完一本入门读物,了解基本的知识。
|
||||
1、__无论如何,先读文档__!绝大部分问题都是文档可以解决的。
|
||||
2、再利用 Google 搜索,利用版面搜索。
|
||||
3、清楚、聪明地提出你的问题。
|
||||
|
||||
===== 我应该看什么 LaTeX 读物? =====
|
||||
这不是一个容易回答的问题,因为有许多选择,也同样有许多不合适的选择。这里只是选出一个比较好的答案。更多更详细的介绍可以在版面和网上寻找(注意时效)。近两年 TeX 的中文处理发展很快,目前没有哪本书在中文处理方面给出一个最新进展的合适综述,因而下面的介绍也不主要考虑中文处理。
|
||||
|
||||
一、我可以阅读英文
|
||||
1、我要迅速入门:ltxprimer.pdf (LaTeX Tutorials: A Primer, India TUG)
|
||||
2、我要系统学习:A Guide to LaTeX, 4th Edition, Addison-Wesley 有机械工业出版社的影印版(《LaTeX 实用教程》,e)
|
||||
3、我要深入学习:要读许多书和文档,__TeXbook __是必读的
|
||||
4、还有呢? 去读__你使用的每一个宏包__的说明文档。还有许多专题文档,如讲数学公式、图形、表格、字体等
|
||||
|
||||
二、我更愿意阅读中文
|
||||
1、我要迅速入门:lnotes.pdf (LaTeX Notes, 1.20, Alpha Huang)
|
||||
2、我要系统学习:《LaTeX2ε 完全学习手册》,胡伟
|
||||
《LaTeX2ε 科技排版指南》,邓建松(e)
|
||||
《LaTeX 入门与提高》第二版,陈志杰等
|
||||
3、我要深入学习:《特可爱原本》(TeXbook 的中译,by xianxian。e)
|
||||
4、还有呢? 英语,绝大多数 TeX 资料还是英文的
|
||||
|
||||
===== 从哪里得到各种书籍和文档? =====
|
||||
书籍需要自己买。已出版的书籍通常都比网上流传的教程质量为高。部分经典和常用的书籍可以在网上找到电子版,包括本版的保留区和精华区一些。
|
||||
诸宏包和一些常用的电子文档都会在 TeX 发行版里__默认安装__,除非特别指定不安装或使用的是精简文档的版本。MiKTeX 安装目录的 doc 路径,TeX Live 的 **texmf-doc** 以及** texmf-???/doc **目录都分类存放着各种文档。一般地,MiKTeX 和 TeX Live 都提供了一个叫做__ texdoc__ 的命令来直接调出文档,如在命令行下运行
|
||||
texdoc amsldoc
|
||||
将得到 AMS LaTeX(包括 amsmath 等宏包)的文档;而
|
||||
texdoc symbols-a4
|
||||
将得到著名的 The Comprehensive LaTeX Symbol List(一个符号大全)。进一步的用法可以通过
|
||||
texdoc texdoc
|
||||
查看。此外,TeX Live 发行版还有图形界面的 texdoc GUI (texdoctk) 列出常用的部分文档,安装主目录下的 doc.html 中则包括一个所有 pdf 和 html 格式文档的列表。如果在发行版里没有安装相应的文档,可以去 CTAN 寻找下载(后详)。
|
||||
由第三方发布的一些不大常见的文档,如印度 TUG 组织编写的 LaTeX Tutorials,__中文翻译的 beamer 文档__等,就需要自己在网络上搜索了(事实上本站就有许多)。在中文资源版、各版精华区和一些专门的 FTP 中,常常会留有许多文档。
|
||||
LaTeX 自身的一个很大的问题是__不知道用什么宏包__。而且许多人都在找大量例子-代码的对比、大而全的问题库。这里有两个常见的来源,都是英文的:
|
||||
1、UK-FAQ(在系统中通常可以 newfaq 的名字用 texdoc 调出)。讲了许多常见的问题,给了许多解决问题的代码,介绍了许多实用的宏包。
|
||||
2、书籍 LaTeX Companion 第二版。这是一本篇幅宏大的书,似乎没有引进到国内,只在一些图书馆内找到,但或许在网上能找到电子版(请不要向我索要)。
|
||||
|
||||
===== 如何使用 CTAN? =====
|
||||
|
||||
CTAN 就是 the Comprehensive TeX Archive Network,它以 HTTP 或 FTP 的形式提供大量 TeX 相关资源的下载。在 CTAN 上可以下载到最新版本的主要 TeX 发行版,如 TeX Live、MiKTeX,可以下载免费的 TeX 相关编辑器、支持工具、附件,如 LyX、WinEdt、GhostScript、TpX 等,也可以下载各种最新的 TeX 宏包。
|
||||
CTAN 的 HTTP 主站是 http://www.ctan.org/%EF%BC%8C%E5%8F%AF%E4%BB%A5%E5%9C%A8%E7%BA%BF%E8%BF%9B%E8%A1%8C%E6%90%9C%E7%B4%A2%EF%BC%9BCTAN 在世界各地有许多镜象服务器,处于教育网内的有北京交通大学和厦门大学的 CTAN 镜象:
|
||||
http://mirror.bjtu.edu.cn/CTAN/
|
||||
http://mirrors.xmu.edu.cn/CTAN/
|
||||
ftp://mirrors.xmu.edu.cn/CTAN/
|
||||
国内公网则有 CTeX 网站的镜象:
|
||||
ftp://ftp.ctex.org/CTAN/
|
||||
http://ftp.ctex.org/mirrors/CTAN/
|
||||
此外还有许多国外的镜象服务器,列表可以在 CTAN 主站找到。
|
||||
|
||||
===== 如何在 LaTeX 中处理中文?请举一个例子。 =====
|
||||
LaTeX 本身虽然变化不大,但中文处理的技术近两年发展飞快。现在(2011 年底)我们推荐使用__ XeTeX 引擎处理中文__,使用支持 XeLaTeX 的** ctex 宏包和文档类**(版本 0.9 以上)解决__中文版式__习惯的问题。在系统配置方面,使用 TeX Live 2011 或 CTeX 套装 2.9 以上版本。
|
||||
|
||||
使用上述 __XeLaTeX + xeCJK + ctex__ 的方式处理中文,可参考的文档包括:
|
||||
* fontspec 宏包文档(XeLaTeX 下的一般字体选择机制)
|
||||
* xeCJK 宏包文档(fontspec 字体选择机制的中文实现和标点特殊处理等)
|
||||
* ctex 宏包文档(中文版式的解决方案)
|
||||
|
||||
一个典型的中文支持例子(Windows 系统,用 xelatex 命令编译):
|
||||
|
||||
% 使用 Windows 六套字体(缺省的 __winfonts __选项),UTF-8 编码
|
||||
\documentclass[UTF8]{__ctexart__}
|
||||
\begin{document}
|
||||
文章内容。
|
||||
\end{document}
|
||||
|
||||
如果没有win字体,可以使用adobefonts选项。
|
||||
|
||||
注:即使不使用 xelatex 命令编译,上述代码也是一样可以用 latex 或 pdflatex 命令编译的。在使用 latex 或 pdflatex 编译时,**编码的选项**是重要的(UTF8 或 GBK)。
|
||||
|
||||
不使用商业中文字体的例子(Linux 系统,使用 xelatex 编译):
|
||||
|
||||
% -*- coding: utf-8 -*-
|
||||
\documentclass[UTF8,__nofonts__]{ctexart}
|
||||
\setCJKmainfont[ItalicFont={AR PL KaitiM GB}]{AR PL SungtiL GB}% 文鼎宋体和楷书
|
||||
\setCJKsansfont{WenQuanYi Zen Hei}% 文泉驿的黑体
|
||||
|
||||
\begin{document}
|
||||
文章内容
|
||||
\end{document}
|
||||
|
||||
ctex 宏包及文档类在 Linux 系统下字体难以统一设置,进一步的信息参见:
|
||||
https://code.google.com/p/ctex-kit/wiki/UnixFonts
|
||||
|
||||
===== 新手不建议做的几件事情: =====
|
||||
|
||||
* 不了解情况下复制他人代码:__代码最好都是自己写__,每句话啥意思要自己清楚,同时我也建议各位同学,给别人解决问题的时候,不要从自己文档里面咔嚓一段代码上来,最好是说明**用哪个宏包,有啥用处**,剩下的是提问者看文档,相信各位在每次帮助他人的同时更巩固了对某些常用宏包的理解。
|
||||
|
||||
* 有一点是特别让人不爽的,就是用 mathtype 还是什么然后生成 tex 代码,忽然有啥问题了,就划拉下来问怎么办。怎么说呢,一般有能力解决的人是不会痴迷这种代码的,好心的就让你看看 mathmode 好好学学,普通点的就直接看下一篇。在此忠告:__公式一定要自己手敲__。
|
||||
|
||||
* 求助模板相关问题:除了投稿,__尽量不要用现成的模板__,因为模板千差万别,良莠不齐,出了什么问题也较难定位。如果真的喜欢某个文档格式而用该模板,请确保你知道模板作者的联系方式,__直接向他提问__是最有效的解决途径,他人用这个模板而又这么巧看到了你的问题,又那么巧知道问题在哪里,又这么巧有空帮你,这就不是自己能控制的了。不用该模板的用户一般对这种问题是没有兴趣看一看的。
|
||||
|
||||
* __毫无基础就开始写文章__:我不是吓唬大家,不过不看点书、做点练习就想直接写书呢不是一种主流做法。花个个把礼拜学习未必使你的文章结束得晚。我经常看到一些代码中充斥着 \hskip, \quad, ~~~~, \indent 甚至无数的 \\ 等用来对齐或者换行,嗯,当时的情况就是这样的。这样写文章难道不累吗。我这里就不介绍应该如何写简练又有意义容易掌控的代码,看书吧。
|
||||
|
||||
* __试图修改 LaTeX 的默认表现__:比较有代表性的是浮动体等的标题等,一会儿说不要浮动了,一会儿说 figure 1.2 要改成中英文双语版而且后面的冒号要改成五角星,最麻烦的还是双栏下面一浮动咋跑下一页去了……,等等等等,不要管它们,随它们的便,这是最好的处理方式。
|
||||
|
||||
|
||||
===== 什么知识会过时?什么不会? =====
|
||||
|
||||
TeX 是**排版**__语言__,也是广泛使用的软件,并且不断在发展中;因此,总有一些东西会很快过时。作为学习 TeX 的人,免不了要看各种各样的书籍、电子文档和网络论坛上的只言片语,因此了解什么知识会迅速过时,什么知识不会是十分重要的。
|
||||
|
||||
最稳定的是关于 __Primitive TeX 和 Plain TeX__ 的知识,也就是 Knuth 在他的《The TeXbook 》中介绍的内容。因为 TeX 系统开发的__初衷就是稳定性__,要求今天的文档到很久以后仍可以得到完全相同的结果,因此 Knuth 限定了他的 TeX 语言和相关实现的命令、语法。这些内容许多年来就没有多少变化,在未来的一些年里也不会有什么变化。Primitive TeX 和 Plain TeX 的知识主要包括 TeX** 排版的基本算法和原理,盒子的原理,底层的 TeX 命令**等。其中技巧性的东西大多在__宏包设计__中,初学者一般不会接触到很多;而基本原理则是常常被提到的,譬如,TeX 把一切排版内容作为盒子(box)处理。
|
||||
|
||||
相对稳定的是关于__基本 LaTeX 2ε __的知识,也包括围绕 LaTeX 2ε 的一些__核心宏包__的知识。LaTeX 2ε 是自 1993 年以来的一个稳定的 LaTeX 版本,直到最近的一次修订(2005 年)都没有大的变动。LaTeX 的下一个计划中的版本 LaTeX 3 遥遥无期,在可预见的将来,LaTeX 2ε 不会过时。LaTeX 2ε 的知识是目前大部分 LaTeX 书籍的主体内容。关于 LaTeX 的__标准文档类__(article、report、book、letter、slide 等),关于__基本数学公式__的输入,文档的__章节层次__,__表格__和矩阵,图表__浮动体__,LR __盒子__与段落盒子……这些 LaTeX 的核心内容都是最常用的,相对稳定的。与 LaTeX 2ε 相匹配的核心宏包,如 graphics(x)、ifthen、fontenc、doc 等,也同样是相对稳定的。还有一些被非常广泛应用的宏包,如 amsmath 系列,也可以看作是相对稳定的。
|
||||
|
||||
简单地说,关于基本 TeX/LaTeX 的语言,都是比较稳定的。与之对应,实现或者支持 TeX/LaTeX 语言的软件,包括在 TeX/LaTeX 基础上建立的新的宏,都不大稳定。
|
||||
|
||||
容易过时的是关于__第三方__ LaTeX 宏包的知识、第三方 TeX 工具的知识,以及新兴 TeX 相关软件的知识等。TeX 和 LaTeX 语言是追求稳定的;但无论是宏包还是工具,作为不断更新软件,它们是不稳定的。容易过时的技术很多,而且现在广泛地出现在几乎所有 LaTeX 文档之中,因此需要特别引起注意:
|
||||
**宏包的过时**的原因可能是宏包本身的升级换代带来了新功能或不兼容,也可能是同一功能的更新更好的宏包代替了旧的宏包。前者的典型例子比如__绘图宏包 PGF/TikZ__,现在的 2.00 版功能十分强大,和旧的 1.1x 版相差很大,和更旧的 0.x 版本则几乎完全不同;后者的典型例子比如 caption 宏包先是被更新的 caption2 宏包代替,后来 caption 宏包更新又使得 caption2 宏包完全过时。——安装更新的发行版可以避免使用过旧的宏包;__认真阅读宏包自带的文档__而不是搜索得到的陈旧片断可以避免采用过时的代码。
|
||||
**工具过时**的主要原因也是升级换代和被其他工具替换。前者的典型例子是编辑器 WinEdt 在 5.5 以后的版本支持 UTF-8 编码,而旧版本不支持;后者的典型例子是中文字体安装工具从 GBKFonts 到 xGBKFonts 到 FontsGen 不断被取代。
|
||||
**图形插入**是一个在 TeX 实现、宏包与外围工具方面都更新很快的东西。在过去,最常用的输出格式是 PS(PostScript)格式,因此插入的图像以 EPS 为主流。使用 Dvips 为主要输出工具,外围工具有 GhostScript、bmeps 等等,相关宏包有 graphics 等,相关文档如《LaTeX2e 插图指南》。但凡提及“LaTeX 只支持 EPS 图形”的,就是这个过时的时代的产物。事实上 TeX/LaTeX __并不限定任何图形格式__,只不过是当时的输出格式(PS)和工具(Dvips)对 EPS 情有独钟而已。后来 PDF 格式成为主流,pdfTeX、DVIPDFM、DVIPDFMx、XeTeX 等工具则主要支持 PDF、PNG、JPG 格式的图形,涉及一系列工具如 ImageMagick、ebb 等。
|
||||
值得特别提出注意的就是,__中文处理__也一起是更新迅速、容易过时的部分。而且因为中文处理一直没有一个“官方”的“标准”做法,软件、工具、文档以及网上纷繁的笔记也就显得相当混乱。从八十年代开始的 CCT 系统、天元系统,到后来的 CJK 方式,到__近来的 XeTeX、LuaTeX 方式__,中文处理的原理、软件、宏包、配置方式等都在不断变化中。曾几何时天元、CCT 是中文 TeX 软件的代名词;五六年前的书籍尚在说 CJK 不成熟,CCT 是主流;两三年前出版的书籍却在说 CCT 已成为过去,CJK 成为主流;现在我们推荐却是 XeTeX;或许过不久又成为 LuaTeX 处理中文的天下……而且新方法确实也越来越简单、越来越直接了。是的,对此我们毫无办法,只有跟随潮流。
|
||||
47
Zim/LaTex/参考字体.txt
Normal file
@@ -0,0 +1,47 @@
|
||||
Content-Type: text/x-zim-wiki
|
||||
Wiki-Format: zim 0.4
|
||||
Creation-Date: 2011-09-24T11:02:50+08:00
|
||||
|
||||
====== 参考字体 ======
|
||||
Created Saturday 24 September 2011
|
||||
|
||||
中文:
|
||||
衬线字体(用于正文):
|
||||
Regular: Adobe Song Std
|
||||
Bold: Adobe Heiti Std //有的字体提供了加粗的类型,但是Adobe Song Std没有。
|
||||
Italic: Adobe Kaiti Std //中文根本没有斜体字型(一般都字体渲染引擎是把正常字体倾斜获得的)。
|
||||
无衬线字体(用于章节标题)
|
||||
Regular Adobe Heiti Std
|
||||
等宽字体(用于代码等原文输出)
|
||||
WenQuanYi ZenHei Mono
|
||||
英文:
|
||||
衬线字体:
|
||||
Apple Garamond (有各种样式输出)
|
||||
无衬线字体:
|
||||
Arial
|
||||
等宽字体:
|
||||
Consolas
|
||||
|
||||
#yaourt -Ql __ttf-mac-fonts__
|
||||
ttf-mac-fonts /usr/share/fonts/TTF/
|
||||
ttf-mac-fonts /usr/share/fonts/TTF/AppleGaramond-Bold.ttf
|
||||
ttf-mac-fonts /usr/share/fonts/TTF/AppleGaramond-BoldItalic.ttf
|
||||
ttf-mac-fonts /usr/share/fonts/TTF/AppleGaramond-Italic.ttf
|
||||
ttf-mac-fonts /usr/share/fonts/TTF/AppleGaramond-Light.ttf
|
||||
ttf-mac-fonts /usr/share/fonts/TTF/AppleGaramond-LightItalic.ttf
|
||||
ttf-mac-fonts /usr/share/fonts/TTF/AppleGaramond.ttf
|
||||
ttf-mac-fonts /usr/share/fonts/TTF/HardGothicNormal.ttf
|
||||
ttf-mac-fonts /usr/share/fonts/TTF/Lucida Console.ttf
|
||||
ttf-mac-fonts /usr/share/fonts/TTF/Lucida Grande Bold.ttf
|
||||
ttf-mac-fonts /usr/share/fonts/TTF/Lucida Grande.ttf
|
||||
ttf-mac-fonts /usr/share/fonts/TTF/Lucida MAC.ttf
|
||||
ttf-mac-fonts /usr/share/fonts/TTF/Lucida Sans Unicode.ttf
|
||||
ttf-mac-fonts /usr/share/fonts/Type1/
|
||||
ttf-mac-fonts /usr/share/fonts/Type1/Lucida G.pfb
|
||||
ttf-mac-fonts /usr/share/fonts/Type1/Lucida Gr Regular.pfb
|
||||
ttf-mac-fonts /usr/share/fonts/Type1/Lucida MAC Bold.pfb
|
||||
ttf-mac-fonts /usr/share/fonts/Type1/Lucida MAC.pfb
|
||||
ttf-mac-fonts /usr/share/fonts/Type1/MACGrande.pfb
|
||||
ttf-mac-fonts /usr/share/licenses/
|
||||
ttf-mac-fonts /usr/share/licenses/ttf-mac-fonts/
|
||||
ttf-mac-fonts /usr/share/licenses/ttf-mac-fonts/SafariWindows.pdf
|
||||
108
Zim/LaTex/安装.txt
Normal file
@@ -0,0 +1,108 @@
|
||||
Content-Type: text/x-zim-wiki
|
||||
Wiki-Format: zim 0.4
|
||||
Creation-Date: 2011-08-21T14:59:51+08:00
|
||||
|
||||
====== 安装 ======
|
||||
Created Sunday 21 August 2011
|
||||
|
||||
接下来安装中文支持,首先上网下载AdobeFonts 共有四种,宋体,仿宋,楷体,黑体。
|
||||
解压出来复制到:/usr/share/fonts
|
||||
然后执行:fc-cache -fsv 更新字体缓存
|
||||
然后查看以下:fc-list :lang=zh-cn >> zhcn.txt
|
||||
看看zhcn中有没有adobe字体:
|
||||
|
||||
Adobe 楷体 Std,Adobe Kaiti Std,Adobe Kaiti Std R,Adobe 楷体 Std R:style=R,Regular
|
||||
Adobe 黑体 Std,Adobe Heiti Std,Adobe Heiti Std R,Adobe 黑体 Std R:style=R,Regular
|
||||
Adobe 宋体 Std,Adobe Song Std,Adobe Song Std L,Adobe 宋体 Std L:style=L,Regular
|
||||
Adobe 仿宋 Std,Adobe Fangsong Std,Adobe Fangsong Std R,Adobe 仿宋 Std R:style=R,Regular
|
||||
如果安装成功就会显示上面的内容。
|
||||
|
||||
下面是编辑latex如何使用Adobe字体。按照下面的做法不会出错,字体也很漂亮
|
||||
\documentclass[11pt, a4paper]{article}
|
||||
\usepackage{__fontspec__}
|
||||
\setmainfont{Adobe Fangsong Std} %这里Fangsong 可以换成Adobe其他三种的任何一种,Song, Heiti,Kaiti
|
||||
\begin{document}
|
||||
你好,Tex
|
||||
\end{document}
|
||||
记住最后用 xelatex 进行编译,直接生成的是一个pdf文件,打开看看就知道字体使用对了没有。
|
||||
|
||||
===== texlive安装和中文支持 =====
|
||||
|
||||
有两种方法设置latex的中文支持
|
||||
|
||||
1.
|
||||
|
||||
==== 利用系统自带的字体 ====
|
||||
——xelatex 命令直接生成PDF
|
||||
1.1 系统字体目录:/usr/share/fonts
|
||||
添加Adobefonts——Fangsong,Song,Kaiti, Hei (google搜索之)于一个新文件夹adobe-fonts中,运行 fc-list 查看是否安装成功。
|
||||
1.2 在tex文件 可利用命令\setmainfont{} / \setromanfont{} / \setsanfont{}调用新建的系统字体。
|
||||
|
||||
eg.
|
||||
|
||||
\documentclass[12pt,a4paper]{article}
|
||||
|
||||
\usepackage{fontspec}
|
||||
|
||||
\setmainfont{Adobe Kaiti Std}
|
||||
|
||||
%括号里的字符应是fc-list中的
|
||||
|
||||
\begin{document}
|
||||
|
||||
{\setromanfont{Adobe Fangsong Std}不需要安装字体,仿宋 GB2312 \\}
|
||||
|
||||
\end{document}
|
||||
|
||||
然后终端运行xelatex.
|
||||
|
||||
2
|
||||
|
||||
==== 安装tex 系统的中文字体 ====
|
||||
|
||||
有一个简便的方法
|
||||
|
||||
2.1 直接下载 YWang-zhfonts (http://bj.soulinfo.com/~hugang/tex/tex2007/) ,解压——tar -jxf *.bz2 , 它是个隐藏文件。
|
||||
|
||||
查找texmf-local目录——利用配置文件texmf.cnf(/usr/share/texmf/web2c/texmf.cnf),如目录不存在则建立一个。
|
||||
|
||||
2.2 把刚解压的文件夹tex-var下的文件复制到/usr/local/share/texmf
|
||||
2.3 运行 texhash/ __mktexlsr__ 刷新tex系统
|
||||
|
||||
eg.
|
||||
|
||||
\documentclass{article}
|
||||
\usepackage{CJKutf8}
|
||||
\begin{document}
|
||||
\begin{CJK}{UTF8}{hei}
|
||||
I make it!
|
||||
|
||||
我成功了!
|
||||
\end{CJK}
|
||||
\end{document}
|
||||
|
||||
|
||||
===== 附录: =====
|
||||
|
||||
字体主要格式(http://www.ztxz.cn/ziti/11696.html)
|
||||
1.光栅字体(.FON) 这种字体是针对特定的显示分辨率以不同大小存储的位图,用于Windows系统中屏幕上的菜单、按钮等处文字的显示。它并不是 以矢量描述的,放大以后会出现锯齿,只适合屏幕描述。不过它的显示速度非常快,所以作为系统字体而在Windows中使用。
|
||||
2.矢量字体(.FON)
|
||||
虽然扩展名和光栅字体一样,但是这种字体却是由基于矢量的数学模型定义的,是Windows系统字体的一类,一些windows应用程序会在较大尺寸的屏幕显示中自动使用矢量字体来代替光栅字体的显示。
|
||||
3.PostScript字体(.PFM)
|
||||
这种字体基于另一种矢量语言(Adobe PostScript)的描述,常用于PostScript打印机中,不过Windows并不直接支持这类字体,要在Windows使用这类字体需要安装"Adobe Type Manger"(ATM)软件来进行协调。
|
||||
4.TrueType字体(.TTF)
|
||||
这是我们日常操作中接触得最多的一种类型的字体,其最大的特点就是它是由一种数学模式来进行定义的基于轮廓技术的字体,这使得它们比基于矢量的字体更容 易处理,保证了屏幕与打印输出的一致性。同时,这类字体和矢量字体一样可以随意缩放、旋转而不必担心会出现锯齿。我们下面要制作的字体就属于这一类型。
|
||||
5.OpenType字体(.OTF)
|
||||
__OpenType__,是一种可缩放字型(scalable font)电脑字体类型,采用PostScript格式,是美国微软公司与Adobe公司联合开发,用来替代TrueType字型的新字型。这类字体的文 件扩展名为.otf,类型代码是OTTO,现行标准为OpenType 1.4。
|
||||
OpenType最初发表于1996年,并在 2000年之后出现大量字体。它源于微软公司的TrueType Open字型,TrueType Open字型又源于TrueType字型。OpenType font包括了Adobe CID-Keyed font技术。Adobe公司已经在2002年末将其字体库全部改用OpenType格式。到2005年大概有一万多种OpenType字体,Adobe 产品占了三分之一。
|
||||
|
||||
汉字字符集(http://www.ztxz.cn/ziti/11212.html)
|
||||
①GB-2313字符集: 6763个简体汉字,715个符号,总计7478个字符
|
||||
②GBK字符集: 21003个简繁体汉字,882个符号,共计21885个字符(包含BIG-5字符集:13060个繁体汉字 + 808个符号 =13868个字符)
|
||||
③GB18030字符集:GBK字符集 + CJK Ext-A = 27533个汉字(CJK-A中有52字与GBK中的汉字重复,但内码不同,在计总数时不算在内)
|
||||
④UnicodeCJK:20902个汉字 (包含在GBK字符集中)
|
||||
⑤UnicodeCJK Ext-A: 6582个汉字 (包含在GB18030字符集中)
|
||||
⑥UnicodeCJK Ext-B: 42711个汉字
|
||||
⑦全部70244个汉字下载 ( 27533 + 42711 = 70244 )
|
||||
⑧古难字索引 ( CJK+Ext-A+Ext-B ) ★ 部首检字表
|
||||
字体名后面的数字,是指能显示的GBK + CJK-Ext-A + CJK-Ext-B汉字的个数。
|
||||
76
Zim/LaTex/安装/TeXlive_2011安装使用.txt
Normal file
@@ -0,0 +1,76 @@
|
||||
Content-Type: text/x-zim-wiki
|
||||
Wiki-Format: zim 0.4
|
||||
Creation-Date: 2011-08-21T15:16:51+08:00
|
||||
|
||||
====== TeXlive 2011安装使用 ======
|
||||
Created Sunday 21 August 2011
|
||||
|
||||
代码链接:
|
||||
|
||||
https://github.com/live5156go51/code/blob/master/Tex/xetexzh-cn.tex
|
||||
|
||||
===== 1 简介 =====
|
||||
|
||||
TEX Live 是一个完整的 TEX 系统,它的主页在 http://tug.org/texlive/
|
||||
|
||||
==== 2 下载TeXlive2011 ====
|
||||
厦门大学开源软件镜像:http://mirrors.xmu.edu.cn/CTAN/systems/texlive/Images/
|
||||
|
||||
===== 3 安装 =====
|
||||
命令挂载到本地磁盘: sudo mount -t iso9660 -o loop /pathto/texlive2011-
|
||||
20110705.iso /mnt/
|
||||
图形介面安装:sudo ./install-tl -gui
|
||||
|
||||
==== 4 关于环境变量设置 ====
|
||||
如果安装时候选择了在标准路径下创建符号连接,那就不需要设置环境变量了。否
|
||||
则,应该将使用的平台下TeX二进制程序的目录加入搜索路径,编辑用户目录 /̃.bash_profile
|
||||
PATH=/usr/local/texlive/2011/bin/i386-linux:$PATH; export PATH
|
||||
MANPATH=/usr/local/texlive/2011/texmf/doc/man:$MANPATH; export MANPATH
|
||||
INFOPATH=/usr/local/texlive/2011/texmf/doc/info:$INFOPATH; export IN-
|
||||
FOPATH
|
||||
|
||||
==== 5 解决XeTeX中文配置 ====
|
||||
参照TEX Live 指南 TEX Live 2011:
|
||||
1. 将 texlive-fontconfig.conf 文件复制到 /etc/fonts/conf.d/09-texlive.conf。
|
||||
2. 运行 __fc-cache -fsv__。
|
||||
以下是测试XeTeX中文环境代码。
|
||||
|
||||
\ documentclass { article }
|
||||
\ usepackage { fontspec }
|
||||
\ setmainfont { WenQuanYi Zen Hei Sharp }
|
||||
\ begin { document }
|
||||
Hello 中文,
|
||||
\ end { document }
|
||||
|
||||
第2行使用fontspec宏包以使用setmainfont命令设置导言区字体。
|
||||
linux 系统用命令:__fc-list :lang=zh-cn__ 查看setmainfont可设置的中文字体。
|
||||
|
||||
另外可以从Windows/Fonts/里复制些中文字体到/usr/share/fonts, 然后再用命令fc-cache更新字体系统,这样fc-list就可以识别了。
|
||||
|
||||
===== 6 XeTex beamer做slide =====
|
||||
|
||||
\ documentclass { beamer } 幻灯片宏包
|
||||
\ usepackage { beamerthemesplit } 主题风格
|
||||
\ usepackage { fontspec }
|
||||
\ setmainfont { AR PL UKai CN }
|
||||
__\ setsansfont { WenQuanYi Zen Hei Sharp }__
|
||||
\ usepackage { graphics }
|
||||
\ begin { document }
|
||||
\ title{ 创建slide } %添加标题
|
||||
|
||||
\ subtitle{副标题}% 附标题
|
||||
|
||||
\ author{李俊鹏} %添加作者
|
||||
|
||||
\ institute{hello}
|
||||
\ date {\ today {}} %添加日期
|
||||
\ frame {\ titlepage {}} %添加主题幻灯片
|
||||
\ frame {\ frametitle第一张幻灯片标题{}
|
||||
\ pause {}
|
||||
\ begin { itemize }
|
||||
\ item 第一名
|
||||
\ end { itemize }
|
||||
}
|
||||
\ end { document }
|
||||
|
||||
很多时候排Beamer幻灯片时,中文汉字显示为空白,是因为因为 __beamer 默认使用sans 字体__。所以加上第五行setsansfont字体即可解决中文beamer。
|
||||
114
Zim/LaTex/安装/texlive2009_及_中文配置教程总结.txt
Normal file
@@ -0,0 +1,114 @@
|
||||
Content-Type: text/x-zim-wiki
|
||||
Wiki-Format: zim 0.4
|
||||
Creation-Date: 2011-08-21T15:38:10+08:00
|
||||
|
||||
====== texlive2009 及 中文配置教程总结 ======
|
||||
Created Sunday 21 August 2011
|
||||
|
||||
===== 1. 安装xetex及相关 =====
|
||||
|
||||
sudo apt-get install texlive-xetex
|
||||
|
||||
至此,你已经有了基本的texlive,完全可以编译英文。
|
||||
|
||||
鉴于基本的tex功能有限,再装上额外和推荐的包:
|
||||
|
||||
sudo apt-get install texlive-latex-extra texlive-latex-recommended
|
||||
|
||||
===== 2. 让xeCJK调用系统字体 =====
|
||||
|
||||
打开文本编辑器(gedit,kate等)
|
||||
输入文本:
|
||||
|
||||
\documentclass{article}
|
||||
|
||||
\usepackage{xeCJK} %使用xeCJK
|
||||
\setCJKmainfont{WenQuanYi Micro Hei} %使用系统自带的字体
|
||||
|
||||
\begin{document}
|
||||
xeCJK 调用微米黑
|
||||
\end{document}
|
||||
|
||||
保存为test.tex。然后在当前目录输入命令:
|
||||
**xelatex test.tex**
|
||||
|
||||
记住哦,xetex的编译口令是xelatex。然后就会编译出一份pdf文件。
|
||||
想换个字体,修改\setCJKmainfont{……},替换上系统里有的字体即可。
|
||||
|
||||
===== 3. 关于 CJK 原始方案的错误 =====
|
||||
|
||||
看过帖子 “texlive2010安装与中文设置” 的同学知道一种CJK只处理宋体与楷体的原始方案:
|
||||
|
||||
\documentclass{article}
|
||||
\usepackage{CJKutf8}
|
||||
|
||||
\begin{document}
|
||||
\begin{CJK}{UTF8}{gkai}
|
||||
我是楷体
|
||||
\end{CJK}
|
||||
\begin{CJK}{UTF8}{gbsn}
|
||||
我是宋体
|
||||
\end{CJK}
|
||||
\end{document}
|
||||
|
||||
|
||||
编译命令是
|
||||
引用:
|
||||
latex test.tex
|
||||
|
||||
是latex哦。
|
||||
|
||||
但是,编译会出现错误:(我已经试过了)
|
||||
|
||||
LaTeX Error: File `CJKutf8.sty' not found.
|
||||
为什么?因为源安装2009不像镜像安装2010那样大包大揽,什么都有。我们之前安装的__xeCJK不是传统的CJK__,传统CJK根本没有安装,所以没有CJKutf8.sty,也没有 gbsn 和 gkai 字体。
|
||||
|
||||
安装很简单
|
||||
|
||||
sudo apt-get install latex-cjk-*
|
||||
|
||||
但是如果用传统的CJK,也没有必要用xetex,只需普通的latex套件就够了。所以这里说的东西意义不大。
|
||||
ps. latex命令编译出来的文件不是pdf,是dvi。
|
||||
|
||||
|
||||
===== 字体的小贴士>> =====
|
||||
|
||||
猜测:xeCJK是不能调用CJK之下的gbsn和gkai,因为gbsn和gkai在texmf的目录里而不是系统的字体目录。不要问我怎么拷贝windows下的字体并安装到linux,我不知道。我连windows都没有,更不懂怎么去搞SimSun。
|
||||
不过,我们有开源字体。而且11.04的源里面就有宋体(港台叫“明体”)和楷体。你可以在软件包管理器里搜索 ttf-arphic ,装一两个喜欢或者需要的就行了。
|
||||
|
||||
===== 4. 安装 ctex 宏包 =====
|
||||
|
||||
为什么要装 ctex 宏包?ctex 宏包可以使中国人更方便地写中文论文,比如自动编译的章节标题是“第一章”而非“Chapter 1”。
|
||||
|
||||
先下载 ctex 宏包:ftp://ftp.ctex.org/CTAN/language/chinese/ctex.zip
|
||||
源自 ctex 主页:http://code.google.com/p/ctex-kit/wiki/CTeXPackage
|
||||
|
||||
解压 zip ,然后以超级用户的身份把解压出来的 ctex 文件夹放至 /usr/share/texmf/tex/latex/ 内。
|
||||
接着运行
|
||||
|
||||
__sudo texhash__
|
||||
|
||||
为了运行 ctex ,确保已经安装了 texlive-latex-extra(见2),否则会出现错误 etoolbox.sty not found
|
||||
|
||||
然后测试:
|
||||
引用:
|
||||
\documentclass[__nofonts__]{ctexart}
|
||||
\setCJKmainfont{WenQuanYi Micro Hei}
|
||||
\begin{document}
|
||||
你好 CTeX 文档类
|
||||
\end{document}
|
||||
|
||||
!看见红色部分的[nofonts]了吗?一定一定要加上这个选项,否则 ctex 会默认去调用windows或者Adobe字体,然后,你的中文就编译不成了。
|
||||
另外 __ctex 封装了 xeCJK__ ,意思是,你不用\usepackage{xeCJK},可以直接\setCJKmainfont{WenQuanYi Micro Hei}
|
||||
|
||||
编译的口令依然是 xelatex ,中间会有停顿提示错误什么的,不用管它一路Enter到底,最后可以编译出中文的pdf。
|
||||
|
||||
|
||||
===== 5. 给新手的提示 =====
|
||||
|
||||
1 手动安装或者更新了宏包之后必须 sudo texhash 才能生效;
|
||||
2 看到错误不要怕,冷静,看看错误是什么,有可能只是个小小的拼写错误;
|
||||
3 如果手动安装了字体,一般需要__刷新字体映射__才能在 xetex 里使用;如果出现了错误“ ! Font 等等等等 at 10.0pt(或者别的字号) not loadable ”,解决的办法也是刷新字体映射。更新映射的命令是
|
||||
sudo updmap-sys
|
||||
4 宏包不会使用,多看文档。看文档的命令是 texdoc 要看的宏包名,比如看xeCJK文档:
|
||||
texdoc xecjk
|
||||
261
Zim/LaTex/安装/xelatex.txt
Normal file
@@ -0,0 +1,261 @@
|
||||
Content-Type: text/x-zim-wiki
|
||||
Wiki-Format: zim 0.4
|
||||
Creation-Date: 2011-08-21T15:24:59+08:00
|
||||
|
||||
====== xelatex ======
|
||||
Created Sunday 21 August 2011
|
||||
|
||||
在 Debian GNU/Linux 中安装 TeXLive lj605 [at] bbs.ctex.org
|
||||
|
||||
视频教程 http://v.youku.com/v_show/id_XMTc0NjIxNDk2.htm
|
||||
Debian GNU/Linux 中 TeXLive 的中文支持 (见2楼)
|
||||
视频教程 http://v.youku.com/v_show/id_XMTc1MDc3MTI4.html
|
||||
|
||||
|
||||
===== 环境介绍 =====
|
||||
|
||||
系统: Debian GNU/Linux sid
|
||||
版本: TeXLive 2009
|
||||
字体: 文泉驿正黑
|
||||
|
||||
==== 安装 TeXLive ====
|
||||
安装步骤:
|
||||
准备. 安装 perl-tk.
|
||||
$sudo aptitude install perl-tk
|
||||
下载安装程序
|
||||
$wget http://mirrors.xmu.edu.cn/CTAN/systems/texlive/tlnet/install-tl-unx.tar.gz
|
||||
安装
|
||||
$tar -zxvf install-tl-unx.tar.gz
|
||||
$cd install-tl*
|
||||
$sudo ./install-tl --gui -location http://mirrors.xmu.edu.cn/CTAN/systems/texlive/tlnet/
|
||||
安装 TeXworks.
|
||||
$sudo aptitude install texworks --without-recommends
|
||||
|
||||
==== 测试 ====
|
||||
例子: helloword.tex, 使用 XeLaTeX 编译
|
||||
|
||||
\documentclass[UTF8,__nofonts__]{__ctexart__}
|
||||
\setCJKmainfont{W\enQuanYi Zen Hei}
|
||||
\begin{document}
|
||||
Hello world! I am using \TeX.
|
||||
|
||||
大家好! 我在使用 \TeX.
|
||||
\end{document}
|
||||
|
||||
提示: 使用 \$fc-list :lang=zh-cn 查看系统安装的中文字体.
|
||||
注意:选项nofonts使ctexart使用系统字体
|
||||
|
||||
例子: mathexample.tex, 使用 LaTeX 编译
|
||||
源文件:
|
||||
\documentclass{article}
|
||||
\begin{document}
|
||||
Let $H$ be a Hilbert space, $C$ a closed bounded
|
||||
conver subset of $H$, $T$ is nonexpansive self map
|
||||
of $C$. Suppose that as $n\to\infty$, $a_{n,k}\to0$
|
||||
for each $k$, and $\gamma_n=
|
||||
\sum_{k=0}^\infty(a_{n,k+1}-a_{n,k})^+\to0$.
|
||||
Then for each $x$ in $C$, $A_nx=\sum_{k=0}^\infty
|
||||
a_{n,k}T^kx$ converges weakly to a fixed point of $T$.
|
||||
$$\lim_{n\to\infty}x_n\ {\rm\exists}\iff
|
||||
\limsup_{n\to\infty}x_n=\liminf_{n\to\infty}x_n.$$
|
||||
\end{document}
|
||||
|
||||
===== 管理宏包 =====
|
||||
|
||||
$sudo tlmgr --gui
|
||||
|
||||
The Comprehensive TeX Archive Network (CTAN) 镜像
|
||||
|
||||
http://tug.ctan.org/tex-archive/
|
||||
http://ftp.ctex.org/mirrors/CTAN/
|
||||
http://mirrors.xmu.edu.cn/CTAN/
|
||||
http://oss.ustc.edu.cn/CTAN/
|
||||
|
||||
===== 常用网站: =====
|
||||
|
||||
TUG (the TeX user group) http://www.tug.org
|
||||
CTeX 论坛 http://bbs.ctex.org
|
||||
华东师范大学数学系 LaTeX 科技排版网页http://www.math.ecnu.edu.cn/~latex/
|
||||
LaTeX 编辑部http://zzg34b.w3.c361.com/index.html
|
||||
|
||||
|
||||
|
||||
===== Debian GNU/Linux 中 TeXLive 的中文支持 =====
|
||||
|
||||
===== 环境介绍 =====
|
||||
|
||||
系统: Debian GNU/Linux sid
|
||||
版本: TeXLive 2009
|
||||
演示文稿: beamer 宏包
|
||||
字体: 文泉驿正黑
|
||||
locale: LANG=zh\_CN.UTF-8
|
||||
|
||||
===== 管理: =====
|
||||
|
||||
$sudo tlmgr --gui
|
||||
|
||||
确保已经安装: collection-langcjk, collection-xetex, ctex, xecjk
|
||||
|
||||
==== LaTeX 的中文支持 ====
|
||||
|
||||
CCT, 天元TeX
|
||||
CJK
|
||||
XeTeX XeLaTeX
|
||||
ctex, xeCJK 宏包
|
||||
|
||||
例子: helloword.tex, __使用 XeLaTeX 编译__.
|
||||
|
||||
\documentclass{article}
|
||||
\usepackage{fontspec}
|
||||
\XeTeXlinebreaklocale "zh" % 针对中文进行断行
|
||||
\setmainfont{WenQuanYi Zen Hei}
|
||||
\begin{document}
|
||||
Hello world! I am using \TeX.
|
||||
|
||||
大家好! 我在使用 \TeX.
|
||||
\end{document}
|
||||
|
||||
提示: 使用
|
||||
|
||||
$fc-list :lang=zh-cn
|
||||
查看系统安装的中文字体.
|
||||
http://wiki.ubuntu.org.cn/免费中文字体
|
||||
|
||||
例子: ctex.tex 使用 XeLaTeX 编译.
|
||||
|
||||
\documentclass[UTF8,nofonts]{ctexart}
|
||||
\setCJKmainfont{WenQuanYi Zen Hei}
|
||||
\begin{document}
|
||||
Hello world! I am using \TeX.
|
||||
|
||||
大家好! 我在使用 \TeX.
|
||||
|
||||
\zihao{1} 一号字体: \TeX 是一种排版工具
|
||||
|
||||
\end{document}
|
||||
|
||||
===== Adobe 字体 =====
|
||||
|
||||
AdobeSongStd-Light.otf
|
||||
AdobeFangsongStd-Regular.otf
|
||||
AdobeHeitiStd-Regular.otf
|
||||
AdobeKaitiStd-Regular.otf
|
||||
|
||||
下载: Adobe Reader 9.1 Font Packs - Chinese Simplified
|
||||
里面有宋体和黑体.
|
||||
|
||||
$sudo mkdir /usr/share/fonts/adobe
|
||||
|
||||
把otf字体文件复制到 /usr/share/fonts/adobe
|
||||
|
||||
$sudo cp Adobe*.otf /usr/share/fonts/adobe/
|
||||
$sudo fc-cache -fsv
|
||||
$ fc-list | grep Adobe
|
||||
|
||||
例子: adobefont.tex, 使用 XeLaTeX 编译.
|
||||
|
||||
\documentclass[UTF8,adobefonts]{ctexart}
|
||||
\begin{document}
|
||||
默认字体 default fonts \TeX 是一种排版工具 \\
|
||||
{\bfseries 粗体 bold \TeX 是一种排版工具}\\
|
||||
{\songti 宋体 songti \TeX 是一种排版工具}\\
|
||||
{\heiti 黑体 heiti \TeX 是一种排版工具}\\
|
||||
{\kaishu 楷书 kaishu \TeX 是一种排版工具}\\
|
||||
{\fangsong 仿宋 fangsong \TeX 是一种排版工具}\\
|
||||
\end{document}
|
||||
|
||||
安装 CJK 字体 uming ukai (明体是__港台__字体)
|
||||
|
||||
$wget ftp://cle.linux.org.tw/pub2/tex/cjk/fonts/nsungt1/nsungt1-1.4.2.tar.gz
|
||||
$wget ftp://cle.linux.org.tw/pub2/tex/cjk/fonts/nkait1/nkait1-1.4.2.tar.gz
|
||||
$tar -jxvf nsungt1-1.4.2.tar.gz
|
||||
$tar -jxvf nkait1-1.4.2.tar.gz
|
||||
$./nsungt1-1.4.2/install.sh
|
||||
$./nkait1-1.4.2/install.sh
|
||||
|
||||
注意: 普通用户安装, 而不是使用 root 用户安装.
|
||||
|
||||
例子: nsung.tex, 使用 pdflatex 编译
|
||||
|
||||
\documentclass[12pt,a4paper]{article}
|
||||
\usepackage{CJKutf8}
|
||||
\begin{document}
|
||||
\begin{CJK}{UTF8}{nsung}
|
||||
\section{New Sung 新宋字型 \LaTeX\ CJK 測試}
|
||||
晉太元中,武陵人,捕魚為業,緣溪行,忘路之遠近;忽逢桃
|
||||
花林,夾岸數百步,中無雜樹,芳草鮮美,落英繽紛,漁人甚
|
||||
異之。復前行,欲窮其林。林盡水源,便得一山。山有小口,
|
||||
彷彿若有光,便捨船,從口入。
|
||||
. . . . . .碁嫺。凃凉双崐喆峯酶酞肽脲腚釟迌堃韮。
|
||||
角觸過骨。許功蓋測試。这里是简体字。许功盖测试。
|
||||
這裡是日文:こんにちは 世界。
|
||||
\end{CJK}
|
||||
\end{document}
|
||||
|
||||
|
||||
|
||||
例子: nkai.tex, 使用 pdflatex 编译
|
||||
|
||||
\documentclass[12pt,a4paper]{article}
|
||||
\usepackage{CJKutf8}
|
||||
\begin{document}
|
||||
\begin{CJK}{UTF8}{nkai}
|
||||
\section{New Kai 新中楷字型 \LaTeX\ CJK測試}
|
||||
晉太元中,武陵人,捕魚為業,緣溪行,忘路之遠近;忽逢桃
|
||||
花林,夾岸數百步,中無雜樹,芳草鮮美,落英繽紛,漁人甚
|
||||
異之。復前行,欲窮其林。林盡水源,便得一山。山有小口,
|
||||
彷彿若有光,便捨船,從口入。
|
||||
. . . . . .碁嫺。凃凉双崐喆峯酶酞肽脲腚釟迌堃韮。
|
||||
角觸過骨。許功蓋測試。这里是简体字。许功盖测试。
|
||||
這裡是日文:こんにちは 世界。
|
||||
\end{CJK}
|
||||
\end{document}
|
||||
|
||||
|
||||
1,其余的adobe字体下载看这里
|
||||
http://bbs.ctex.org/viewthread.php?tid=47618&extra=page%3D2
|
||||
|
||||
2,除参考ctex.pdf xecjk.pdf
|
||||
外还可以参考xetexmain.pdf 的 Typesetting Chinese
|
||||
还有这里 http://bbs.ctex.org/viewthread.php?tid=54661&extra=page%3D1
|
||||
|
||||
3, 以 \setCJKmainfont{WenQuanYi Zen Hei} 正黑为默认字体有点怪.
|
||||
|
||||
如果不用adobe的字体, 只用__文鼎和文泉驿__的字体, 那么简体字只有__宋, 楷, 黑__可用. 可以设置为
|
||||
|
||||
\documentclass[UTF8,nofonts]{ctexart}
|
||||
\setCJKmainfont{AR PL SungtiL GB}
|
||||
\setCJKfamilyfont{song}{AR PL SungtiL GB}
|
||||
\setCJKfamilyfont{kai}{AR PL KaitiM GB}
|
||||
\setCJKfamilyfont{hei}{WenQuanYi Zen Hei}
|
||||
\begin{document}
|
||||
Hello world! I am using \TeX.
|
||||
|
||||
默认字体 default fonts \TeX 是一种排版工具
|
||||
|
||||
{\bfseries 粗体 bold \TeX 是一种排版工具}
|
||||
|
||||
\CJKfamily{song}
|
||||
宋体 songti \TeX 是一种排版工具
|
||||
|
||||
\CJKfamily{kai}
|
||||
楷书 kaishu \TeX 是一种排版工具
|
||||
|
||||
\CJKfamily{hei}
|
||||
黑体 heiti \TeX 是一种排版工具
|
||||
|
||||
|
||||
\end{document}
|
||||
|
||||
复制代码
|
||||
这时ctex宏包里的
|
||||
|
||||
\songti
|
||||
\heiti
|
||||
\kaishu
|
||||
|
||||
都无法使用,
|
||||
只能用相应的 \CJKfamily{}来设置字体. 这属于ctex帮助文档 ctex.pdf 版本号:v0.99b里说的
|
||||
|
||||
上面的字体在不同的字体选项下有不同的设置,不一定都有定义。
|
||||
4, 3中字体名称在其它发行版中可能不同, 请 fc-list :lang=zh-cn 查看相应的名称.
|
||||