The Documentation for DocBook

Netkiller Docbook 手札

Docbook, EPUB and Latex

Mr. Neo Chan, 陈景峯(BG7NYT)

中国广东省深圳市望海路半岛城邦三期
518067
+86 13113668890

<netkiller@msn.com>

电子书最近一次更新于 2021-10-09 09:49:05

版权 © 2008, -, 2020 Netkiller(Neo Chan). All rights reserved.

版权声明

转载请与作者联系，转载时请务必标明文章原始出处和作者信息及本声明。

http://www.netkiller.cn

http://netkiller.github.io

http://netkiller.sourceforge.net

微信订阅号 netkiller-ebook

微信：13113668890 请注明“读者”

QQ：13721218 请注明“读者”

QQ群：128659835 请注明“读者”

知乎专栏 | 多维度架构

$Date: 2013-04-10 15:03:49 +0800 (Wed, 10 Apr 2013) $

致读者

Netkiller 系列手札 已经被 Github 收录，并备份保存在北极地下250米深的代码库中，备份会保留1000年。

Preserving open source software for future generations

The world is powered by open source software. It is a hidden cornerstone of modern civilization, and the shared heritage of all humanity.

The GitHub Arctic Code Vault is a data repository preserved in the Arctic World Archive (AWA), a very-long-term archival facility 250 meters deep in the permafrost of an Arctic mountain.

We are collaborating with the Bodleian Library in Oxford, the Bibliotheca Alexandrina in Egypt, and Stanford Libraries in California to store copies of 17,000 of GitHub’s most popular and most-depended-upon projects—open source’s “greatest hits”—in their archives, in museum-quality cases, to preserve them for future generations.

https://archiveprogram.github.com/arctic-vault/

自述

《Netkiller 系列 手札》是一套免费系列电子书，netkiller 是nickname 从1999 开使用至今，“手札” 是札记，手册的含义。

2003年之前我还是以文章形式在BBS上发表各类技术文章，后来发现文章不够系统，便尝试写长篇技术文章加上章节目录等等。随着内容增加，不断修订，开始发布第一版，第二版......

IT知识变化非常快，而且具有时效性，这样发布非常混乱，经常有读者发现第一版例子已经过时，但他不知道我已经发布第二版。

我便有一种想法，始终维护一个文档，不断更新，使他保持较新的版本不过时。

第一部电子书是《PostgreSQL 实用实例参考》开始我使用 Microsoft Office Word 慢慢随着文档尺寸增加 Word 开始表现出力不从心。

我看到PostgreSQL 中文手册使用SGML编写文档，便开始学习Docbook SGML。使用Docbook写的第一部电子书是《Netkiller Postfix Integrated Solution》这是Netkiller 系列手札的原型。

至于“手札”一词的来历，是因为我爱好摄影，经常去一个台湾摄影网站，名字就叫“摄影家手札”。

由于硬盘损坏数据丢失 《Netkiller Postfix Integrated Solution》 的 SGML文件已经不存在; Docbook SGML存在很多缺陷UTF-8支持不好，转而使用Docbook XML.

目前技术书籍的价格一路飙升，动则￥80，￥100，少则￥50，￥60. 技术书籍有时效性，随着技术的革新或淘汰，大批书记成为废纸垃圾。并且这些书技术内容雷同，相互抄袭，质量越来越差，甚至里面给出的例子错误百出，只能购买影印版，或者翻译的版本。

在这种背景下我便萌生了自己写书的想法，资料主要来源是我的笔记与例子。我并不想出版，只为分享，所有我制作了基于CC License 发行的系列电子书。

本书注重例子，少理论（捞干货），只要你对着例子一步一步操作，就会成功，会让你有成就感并能坚持学下去，因为很多人遇到障碍就会放弃，其实我就是这种人，只要让他看到希望，就能坚持下去。

1. 写给读者

为什么写这篇文章

有很多想法,工作中也用不到所以未能实现，所以想写出来,和大家分享.有一点写一点,写得也不好,只要能看懂就行,就当学习笔记了.

开始零零碎碎写过一些文档，也向维基百科供过稿，但维基经常被ZF封锁，后来发现sf.net可以提供主机存放文档，便做了迁移。并开始了我的写作生涯。

这篇文档是作者20年来对工作的总结,是作者一点一滴的积累起来的，有些笔记已经丢失，所以并不完整。

因为工作太忙整理比较缓慢。目前的工作涉及面比较窄所以新文档比较少。

我现在花在技术上的时间越来越少，兴趣转向摄影，无线电。也想写写摄影方面的心得体会。

写作动力:

曾经在网上看到外国开源界对中国的评价，中国人对开源索取无度，但贡献却微乎其微.这句话一直记在我心中，发誓要为中国开源事业做我仅有的一点微薄贡献

另外写文档也是知识积累，还可以增加在圈内的影响力.

人跟动物的不同,就是人类可以把自己学习的经验教给下一代人.下一代在上一代的基础上再创新,不断积累才有今天.

所以我把自己的经验写出来,可以让经验传承

没有内容的章节:

目前我自己一人维护所有文档，写作时间有限，当我发现一个好主题就会加入到文档中，待我有时间再完善章节，所以你会发现很多章节是空无内容的.

文档目前几乎是流水帐试的写作，维护量很大，先将就着看吧.

我想到哪写到哪,你会发现文章没一个中心,今天这里写点,明天跳过本章写其它的.

文中例子绝对多,对喜欢复制然后粘贴朋友很有用,不用动手写,也省时间.

理论的东西,网上大把,我这里就不写了,需要可以去网上查.

我爱写错别字,还有一些是打错的,如果发现请指正.

文中大部分试验是在Debian/Ubuntu/Redhat AS上完成.

写给读者

至读者：

我不知道什么时候，我不再更新文档或者退出IT行业去从事其他工作，我必须给这些文档找一个归宿，让他能持续更新下去。

我想捐赠给某些基金会继续运转，或者建立一个团队维护它。

我用了20年时间坚持不停地写作，持续更新，才有今天你看到的《Netkiller 手扎》系列文档，在中国能坚持20年，同时没有任何收益的技术类文档，是非常不容易的。

有很多时候想放弃，看到外国读者的支持与国内社区的影响，我坚持了下来。

中国开源事业需要各位参与，不要成为局外人，不要让外国人说：中国对开源索取无度，贡献却微乎其微。

我们参与内核的开发还比较遥远，但是进个人能力，写一些文档还是可能的。

系列文档

下面是我多年积累下来的经验总结，整理成文档供大家参考:

Netkiller Architect 手札

Netkiller Developer 手札

Netkiller PHP 手札

Netkiller Python 手札

Netkiller Testing 手札

Netkiller Cryptography 手札

Netkiller Linux 手札

Netkiller FreeBSD 手札

Netkiller Shell 手札

Netkiller Security 手札

Netkiller Web 手札

Netkiller Monitoring 手札

Netkiller Storage 手札

Netkiller Mail 手札

Netkiller Docbook 手札

Netkiller Version 手札

Netkiller Database 手札

Netkiller PostgreSQL 手札

Netkiller MySQL 手札

Netkiller NoSQL 手札

Netkiller LDAP 手札

Netkiller Network 手札

Netkiller Cisco IOS 手札

Netkiller H3C 手札

Netkiller Multimedia 手札

Netkiller Management 手札

Netkiller Spring 手札

Netkiller Perl 手札

Netkiller Amateur Radio 手札

2. 作者简介

陈景峯 (ㄔㄣ ㄐ丨ㄥ ㄈㄥ)

Nickname：netkiller | English name: Neo chen | Nippon name: ちんけいほう (音訳) | Korean name: 천징봉 | Thailand name: ภูมิภาพภูเขา | Vietnam: Trần Cảnh Phong

Callsign: BG7NYT | QTH: ZONE CQ24 ITU44 ShenZhen, China

程序猿，攻城狮，挨踢民工, Full Stack Developer, UNIX like Evangelist, 业余无线电爱好者（呼号：BG7NYT）,户外运动，山地骑行以及摄影爱好者。

《Netkiller 系列 手札》的作者

成长阶段

1981年1月19日(庚申年腊月十四)出生于黑龙江省青冈县建设乡双富大队第一小队

1989年9岁随父母迁居至黑龙江省伊春市，悲剧的天朝教育，不知道那门子归定，转学必须降一级，我本应该上一年级，但体制让我上学前班，那年多都10岁了

1995年小学毕业，体制规定借读要交3000两银子(我曾想过不升初中)，亲戚单位分楼告别平房，楼里没有地方放东西，把2麻袋书送给我，无意中发现一本电脑书BASIC语言，我竟然看懂了，对于电脑知识追求一发而不可收，后面顶零花钱，压岁钱主要用来买电脑书《MSDOS 6.22》《新编Unix实用大全》《跟我学Foxbase》。。。。。。

1996年第一次接触UNIX操作系统，BSD UNIX, Microsoft Xinux(盖茨亲自写的微软Unix，知道的人不多)

1997年自学Turbo C语言，苦于没有电脑，后来学校建了微机室才第一次使用QBASIC(DOS 6.22 自带命令)，那个年代只能通过软盘拷贝转播，Trubo C编译器始终没有搞到，

1997年第一次上Internet网速只有9600Bps, 当时全国兴起各种信息港域名格式是www.xxxx.info.net, 访问的第一个网站是NASA下载了很多火星探路者拍回的照片，还有“淞沪”sohu的前身

1998~2000年在哈尔滨学习计算机，充足的上机时间，但老师让我们练打字（明伦五笔/WT）打字不超过80个/每分钟还要强化训练，不过这个给我的键盘功夫打了好底。

1999年学校的电脑终于安装了光驱，在一张工具盘上终于找到了Turbo C, Borland C++与Quick Basic编译器，当时对VGA图形编程非常感兴趣，通过INT33中断控制鼠标，使用绘图函数模仿windows界面。还有操作 UCDOS 中文字库，绘制矢量与点阵字体。

2000年沉迷于Windows NT与Back Office各种技术，神马主域控制器，DHCP，WINS，IIS，域名服务器，Exchange邮件服务器，MS Proxy, NetMeeting...以及ASP+MS SQL开发；用56K猫下载了一张LINUX。ISO镜像，安装后我兴奋的24小时没有睡觉。

职业生涯

2001 年来深圳进城打工,成为一名外来务工者. 在一个4人公司做PHP开发，当时PHP的版本是2.0, 开始使用Linux Redhat 6.2.当时很多门户网站都是用FreeBSD,但很难搞到安装盘，在网易社区认识了一个网友,从广州给我寄了一张光盘，FreeBSD 3.2

2002 年我发现不能埋头苦干,还要学会"做人".后辗转广州工作了半年，考了一个Cisco CCNA认证。回到深圳重新开始，在车公庙找到一家工作做Java开发

2003 年这年最惨,公司拖欠工资16000元,打过两次官司2005才付清.

2004 年开始加入分布式计算团队,目前成绩，工作仍然是Java开发并且开始使用PostgreSQL数据库。

2004-10月开始玩户外和摄影

2005-6月成为中国无线电运动协会会员,呼号BG7NYT,进了一部Yaesu FT-60R手台。公司的需要转回PHP与MySQL，相隔几年发现PHP进步很大。在前台展现方面无人能敌，于是便前台使用PHP，后台采用Java开发。

2006 年单身生活了这么多年,终于找到归宿. 工作更多是研究PHP各种框架原理

2007 物价上涨,金融危机，休息了4个月（其实是找不到工作）,关外很难上439.460中继，搞了一台Yaesu FT-7800.

2008 终于找到英文学习方法， 《Netkiller Developer 手札》，《Netkiller Document 手札》

2008-8-8 08:08:08 结婚,后全家迁居湖南省常德市

2009《Netkiller Database 手札》,2009-6-13学车，年底拿到C1驾照

2010 对电子打击乐产生兴趣，计划学习爵士鼓。由于我对Linux热爱，我轻松的接管了公司的运维部，然后开发运维两把抓。我印象最深刻的是公司一次上架10个机柜，我们用买服务器纸箱的钱改善伙食。我将40多台服务器安装BOINC做压力测试，获得了中国第二的名次。

2011 平凡的一年，户外运动停止，电台很少开，中继很少上，摄影主要是拍女儿与家人，年末买了一辆山地车

2012 对油笔画产生了兴趣，活动基本是骑行银湖山绿道，

2013 开始学习民谣吉他，同时对电吉他也极有兴趣；最终都放弃了。这一年深圳开始推数字中继2013-7-6日入手Motorola MOTOTRBO XIR P8668，Netkiller 系列手札从Sourceforge向Github迁移；年底对MYSQL UDF，Engine与PHP扩展开发产生很浓的兴趣，拾起遗忘10+年的C，写了几个mysql扩展（图片处理，fifo管道与ZeroMQ），10月份入Toyota Rezi 2.5V并写了一篇《攻城狮的苦逼选车经历》

2014-9-8 在淘宝上买了一架电钢琴 Casio Privia PX-5S pro 开始陪女儿学习钢琴，由于这家钢琴是合成器电钢，里面有打击乐，我有对键盘鼓产生了兴趣。

2014-10-2号罗浮山两日游，对中国道教文化与音乐产生了兴趣，10月5号用了半天时间学会了简谱。10月8号入Canon 5D Mark III + Canon Speedlite 600EX-RT香港过关被查。

2014-12-20号对乐谱制作产生兴趣（https://github.com/SheetMusic/Piano），给女儿做了几首钢琴伴奏曲，MuseScore制谱然后生成MIDI与WAV文件。

2015-09-01 晚饭后拿起爵士鼓基础教程尝试在Casio Privia PX-5S pro演练，经过反复琢磨加上之前学钢琴的乐理知识，终于在02号晚上，打出了简单的基本节奏，迈出了第一步。

2016 对弓箭（复合弓）产生兴趣，无奈兲朝法律法规不让玩。每周游泳轻松1500米无压力，年底入 xbox one s 和 Yaesu FT-2DR, 同时开始关注功放音响这块

2017 7月9号入 Yamaha RX-V581 功放一台，连接Xbox打游戏爽翻了，入Kindle电子书，计划学习蝶泳，果断放弃运维和开发知识体系转攻区块链。

2018 从溪山美地搬到半岛城邦，丢弃了多年攒下的家底。11 月开始玩 MMDVM，使用 Yaesu FT-7800 发射，连接MMDVM中继板，树莓派，覆盖深圳湾，散步骑车通联两不误。

2019 卖了常德的房子，住了5次院，哮喘反复发作，决定停止电子书更新，兴趣转到知乎，B站

2020 准备找工作

职业生涯路上继续打怪升级

3. 如何获得文档

下载 Netkiller 手札 (epub,kindle,chm,pdf)

EPUB https://github.com/netkiller/netkiller.github.io/tree/master/download/epub

MOBI https://github.com/netkiller/netkiller.github.io/tree/master/download/mobi

PDF https://github.com/netkiller/netkiller.github.io/tree/master/download/pdf

CHM https://github.com/netkiller/netkiller.github.io/tree/master/download/chm

通过 GIT 镜像整个网站

https://github.com/netkiller/netkiller.github.com.git

$ git clone https://github.com/netkiller/netkiller.github.com.git

镜像下载

整站下载

wget -m http://www.netkiller.cn/index.html

指定下载

wget -m wget -m http://www.netkiller.cn/linux/index.html

Yum 下载文档

获得光盘介质，RPM包，DEB包，如有特别需要，请联系我

YUM 在线安装电子书

http://netkiller.sourceforge.net/pub/repo/

# cat >> /etc/yum.repos.d/netkiller.repo <<EOF
[netkiller]
name=Netkiller Free Books
baseurl=http://netkiller.sourceforge.net/pub/repo/
enabled=1
gpgcheck=0
gpgkey=
EOF

查找包

# yum search netkiller

netkiller-centos.x86_64 : Netkiller centos Cookbook
netkiller-cryptography.x86_64 : Netkiller cryptography Cookbook
netkiller-docbook.x86_64 : Netkiller docbook Cookbook
netkiller-linux.x86_64 : Netkiller linux Cookbook
netkiller-mysql.x86_64 : Netkiller mysql Cookbook
netkiller-php.x86_64 : Netkiller php Cookbook
netkiller-postgresql.x86_64 : Netkiller postgresql Cookbook
netkiller-python.x86_64 : Netkiller python Cookbook
netkiller-version.x86_64 : Netkiller version Cookbook

安装包

yum install netkiller-docbook

4. 打赏（Donations）

If you like this documents, please make a donation to support the authors' efforts. Thank you!

您可以通过微信，支付宝，贝宝给作者打赏。

银行(Bank)

招商银行(China Merchants Bank)

开户名：陈景峰

账号：9555500000007459

微信（Wechat）

支付宝（Alipay）

PayPal Donations

https://www.paypal.me/netkiller

5. 联系方式

主站 http://www.netkiller.cn/

备用 http://netkiller.github.io/

繁体网站 http://netkiller.sourceforge.net/

联系作者

Mobile: +86 13113668890

Email: netkiller@msn.com

QQ群: 128659835 请注明“读者”

QQ: 13721218

ICQ: 101888222

注：请不要问我安装问题！

博客 Blogger

知乎专栏 https://zhuanlan.zhihu.com/netkiller

LinkedIn: http://cn.linkedin.com/in/netkiller

OSChina: http://my.oschina.net/neochen/

Facebook: https://www.facebook.com/bg7nyt

Flickr: http://www.flickr.com/photos/bg7nyt/

Disqus: http://disqus.com/netkiller/

solidot: http://solidot.org/~netkiller/

SegmentFault: https://segmentfault.com/u/netkiller

Reddit: https://www.reddit.com/user/netkiller/

Digg: http://www.digg.com/netkiller

Twitter: http://twitter.com/bg7nyt

weibo: http://weibo.com/bg7nyt

Xbox club

我的 xbox 上的ID是 netkiller xbox，我创建了一个俱乐部 netkiller 欢迎加入。

Radio

CQ CQ CQ DE BG7NYT:

如果这篇文章对你有所帮助,请寄给我一张QSL卡片, qrz.cn or qrz.com or hamcall.net

Personal Amateur Radiostations of P.R.China

ZONE CQ24 ITU44 ShenZhen, China

Best Regards, VY 73! OP. BG7NYT

守听频率 DMR 438.460 -8 Color 12 Slot 2 Group 46001

守听频率 C4FM 439.360 -5 DN/VW

MMDVM Hotspot:

Callsign: BG7NYT QTH: Shenzhen, China

YSF: YSF80337 - CN China 1 - W24166/TG46001

DMR: BM_China_46001 - DMR Radio ID: 4600441

第 1 章 Open Document Licenses

Creative Commons Attribution 3.0

GNU Free Documentation License

Open Publication License

The FreeBSD Documentation License

部分 I. Docbook

http://www.docbook.org/

http://docbook.org/tdg51/en/html/docbook.html

第 2 章 Docbook 环境安装

Document Tools

Docbook SGML,XML 转换程序

1. xsltproc - XSLT command line processor

xsltproc --stringparam html.stylesheet docbook.css ../../docbook-xsl-1.73.2/xhtml/chunk.xsl ../book.xml

$ sudo apt-get install docbook-xsl
$ export DSSSL=/usr/share/xml/docbook/stylesheet/nwalsh/xhtml/chunk.xsl
$ /usr/bin/xsltproc --stringparam html.stylesheet docbook.css ${DSSSL} ../book.xml

2. docbook-ebnf - EBNF module for the XML version of the DocBook DTD

docbook-ebnf - EBNF module for the XML version of the DocBook DTD

$ sudo apt-get install docbook-ebnf

3. docbook-xsl-saxon

			$ sudo apt-get install docbook-xsl-saxon

创建一个test.xml的测试文件

SRCS = test.xml

DESTDIR = .

all: html

html: $(SRCS:.xml=.noext.html) $(SRCS:.xml=.html)

%.png : %.png.uu
	[ -d ${DESTDIR} ] || mkdir -p ${DESTDIR}
	uudecode -o /dev/stdout < $< > ${DESTDIR}/$@

%.html : %.xml
	[ -d ${DESTDIR} ] || mkdir -p ${DESTDIR}
	java -cp "/usr/share/java/saxon.jar:/usr/share/java/xslthl.jar:/usr/share/java/docbook-xsl-saxon.jar" \
	  -Dhighlight.xslthl.config="/usr/share/xml/docbook/stylesheet/docbook-xsl/highlighting/xslthl-config.xml" \
	  com.icl.saxon.StyleSheet \
	  -u -o ${DESTDIR}/$@ $< db2html.xsl \
	  highlight.source=1

%.noext.html : %.xml
	[ -d ${DESTDIR} ] || mkdir -p ${DESTDIR}
	xsltproc --xinclude --nonet -o ${DESTDIR}/$@ \
			--stringparam highlight.source 1 \
			--stringparam xslthl.config /usr/share/xml/docbook/stylesheet/docbook-xsl/highlighting/xslthl-config.xml \
			--param use.extensions 0 \
			--stringparam  paper.type A4 \
			db2html.xsl $<

validate: check

check:
	xmllint --xinclude --nonet --noout --postvalid $(SRCS)

clean:
	rm -f ${DESTDIR}/*.html ${DESTDIR}/*.png

.PHONY: all check clean html validate

生成html

cp /usr/share/doc/docbook-xsl-saxon/examples/db2html.xsl 。

make html

4. PDF

sudo apt-get install docbook-xml docbook-xsl xsltproc fop

安装字体

sudo mkdir /usr/share/fonts/microsoft

将 C:\Windows\Fonts 目录中的字体复制到 /usr/share/fonts/microsoft

$ java -cp /usr/share/java/fop.jar org.apache.fop.fonts.apps.TTFReader /usr/share/fonts/microsoft/simhei.ttf simhei.xml
$ java -cp /usr/share/java/fop.jar org.apache.fop.fonts.apps.TTFReader -ttcname "SimSun" /usr/share/fonts/microsoft/simsun.ttc simsun.xml

sudo vim /usr/share/xml/docbook/stylesheet/docbook-xsl/fo/param.xsl
<xsl:param name="callout.unicode.font">simsun</xsl:param>
<xsl:param name="symbol.font.family">simsun</xsl:param>
<xsl:param name="callout.unicode.font">simsun</xsl:param>

$ vim fop.conf

<?xml version="1.0"?>
<fop version="1.0">
<base>.</base>

<renderers>
	<renderer mime="application/pdf">
     <filterList>
         <value>flate</value>
     </filterList>
      <fonts>
        <font metrics-url="simhei.xml" kerning="yes" embed-url="/usr/share/fonts/microsoft/simhei.ttf">
          <font-triplet name="simhei" style="normal" weight="normal"/>
          <font-triplet name="simhei" style="normal" weight="bold"/>
          <font-triplet name="simhei" style="italic" weight="normal"/>
          <font-triplet name="simhei" style="italic" weight="bold"/>
          </font>
          <font metrics-url="simsun.xml" kerning="yes" embed-url="/usr/share/fonts/microsoft/simsun.ttc">
          <font-triplet name="simsun" style="normal" weight="normal"/>
          <font-triplet name="simsun" style="normal" weight="bold"/>
          <font-triplet name="simsun" style="italic" weight="normal"/>
          <font-triplet name="simsun" style="italic" weight="bold"/>
          </font>
        </fonts>
    </renderer>
</renderers>
</fop>

			xsltproc -o helloworld.fo /usr/share/xml/docbook/stylesheet/docbook-xsl/fo/docbook.xsl helloworld.xml
			fop -c fop.conf helloworld.fo -pdf helloworld.pdf

5. CHM

下载 HTML Help Wordshop 工具，并安装

			copy “c:\Program Files\HTML Help Workshop\hhc.exe” d:\docbook\example
			xsltproc –xinclude docbook_chm.xsl docbook.xml
			hhc.exe htmlhelp.hhp

set PATH=C:\Program Files (x86)\HTML Help Workshop;%PATH%
hhc htmlhelp.hhp

6. docbook2odf - Convert docbook document to Oasis Open Document

sudo apt-get install docbook2odf

docbook2odf book.xml

7. EPUB

7.1. 创建.epub文件

<?xml version="1.0" encoding="utf-8"?>
<book>
  <bookinfo>
    <title>My EPUB book</title>
    <author><firstname>Liza</firstname>
            <surname>Daly</surname></author>
    <volumenum>1234</volumenum>
  </bookinfo>
  <preface id="preface">
    <title>Title page</title>
    <figure id="cover-image">
      <title>Our EPUB cover image icon</title>
      <graphic fileref="cover.png"/>
    </figure>
  </preface>
  <chapter id="chapter1">
    <title>This is a pretty simple DocBook example</title>
    <para>
      Not much to see here.
    </para>
  </chapter>
  <chapter id="end-notes">
    <title>End notes</title>
    <para>
      This space intentionally left blank.
    </para>
  </chapter>
</book>

				$ xsltproc /usr/share/xml/docbook/stylesheet/docbook-xsl/epub/docbook.xsl docbook.xml
				$ echo "application/epub+zip" > mimetype
				$ zip -0Xq my-book.epub mimetype
				$ zip -Xr9D my-book.epub *

7.2. Reader

http://calibre-ebook.com/

8. Apple Mac

安装 dtd 文件

neo@MacBook-Pro ~ % brew install docbook

安装目录 /usr/local/Cellar/docbook/5.0/docbook/xml/5.0

安装 xsl 文件

neo@MacBook-Pro ~ % brew install docbook-xsl

安装目录/usr/local/Cellar/docbook-xsl/1.79.1/docbook-xsl/

neo@MacBook-Pro /tmp/doc % cat sample.xml
<?xml version="1.0" encoding="utf-8"?>
<book>
  <bookinfo>
    <title>My EPUB book</title>
    <author><firstname>Liza</firstname>
            <surname>Daly</surname></author>
    <volumenum>1234</volumenum>
  </bookinfo>
  <preface id="preface">
    <title>Title page</title>
    <figure id="cover-image">
      <title>Our EPUB cover image icon</title>
      <graphic fileref="cover.png"/>
    </figure>
  </preface>
  <chapter id="chapter1">
    <title>This is a pretty simple DocBook example</title>
    <para>
      Not much to see here.
    </para>
  </chapter>
  <chapter id="end-notes">
    <title>End notes</title>
    <para>
      This space intentionally left blank.
    </para>
  </chapter>
</book>

neo@MacBook-Pro /tmp/doc % xsltproc /usr/local/Cellar/docbook-xsl/1.79.1/docbook-xsl/html/chunk.xsl sample.xml
Writing pr01.html for preface(preface)
Writing ch01.html for chapter(chapter1)
Writing ch02.html for chapter(end-notes)
Writing index.html for book

neo@MacBook-Pro /tmp/doc % ll
total 40
-rw-r--r--  1 neo  wheel   1.6K Sep 28 16:51 ch01.html
-rw-r--r--  1 neo  wheel   1.5K Sep 28 16:51 ch02.html
-rw-r--r--  1 neo  wheel   1.8K Sep 28 16:51 index.html
-rw-r--r--  1 neo  wheel   1.8K Sep 28 16:51 pr01.html
-rw-r--r--  1 neo  wheel   710B Sep 28 16:51 sample.xml

9. docbook-website - XML Website DTD and XSL Stylesheets

sudo apt-get install docbook-website

#!/bin/bash
export DSSSL=/usr/share/xml/docbook/stylesheet/nwalsh/xhtml/onechunk.xsl
mkdir tmp
cd tmp
xsltproc --stringparam html.stylesheet docbook.css ${DSSSL} ../book.xml

10. XML 工具

10.1. rxp - A validating XML parser

rxp -s file.xml

To validate file.xml, use the command:

$ rxp -s -V file.xml

10.2. XML 校验

$ xmllint book.xml

11. SGML 环境

sudo apt-get install docbook-utils

CentOS

# yum install docbook*

第 3 章 docbook-xsl

1. HTML

1.1. example

<?xml version='1.0' encoding="utf-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
   	<xsl:import href="/usr/share/xml/docbook/stylesheet/nwalsh/xhtml/chunk.xsl"/>
   	<xsl:param name="admon.graphics" 		select="1"/>
   	<xsl:param name="admon.graphics.path">/graphics/</xsl:param>
   	<xsl:param name="admon.graphics.extension">.png</xsl:param>
   	<xsl:param name="html.stylesheet" 	select="'/docbook.css'"/>
   	<xsl:param name="css.decoration" 	select="1"/>

   	<xsl:param name="toc.max.depth">5</xsl:param>
   	<xsl:param name="toc.section.depth">4</xsl:param>
   	<xsl:param name="use.id.as.filename" select="1"/>

	<xsl:param name="preface.autolabel" select="1"/>
	<xsl:param name="chapter.autolabel" select="1" />
	<xsl:param name="section.autolabel" select="1" />
	<xsl:param name="appendix.autolabel" select="1" />

	<xsl:param name="section.autolabel.max.depth">8</xsl:param>
	<xsl:param name="section.label.includes.component.label" select="1" />
	<xsl:param name="generate.meta.abstract" select="1"></xsl:param>

	<xsl:param name="highlight.source" select="1"/>
	<xsl:param name="highlight.xslthl.config">/usr/share/xml/docbook/stylesheet/docbook-xsl/highlighting/xslthl-config.xml</xsl:param>
<!--
	<xsl:param name="eclipse.autolabel" select="1"/>

	<xsl:param name="use.extensions" select="1"/>
	<xsl:param name="textinsert.extension" select="1"/>

	<xsl:param name="xslthl.config" select="/usr/share/xml/docbook/stylesheet/docbook-xsl/highlighting/xslthl-config.xml"/>
	<xsl:param name="highlight.xslthl.config">/usr/share/xml/docbook/stylesheet/docbook-xsl/highlighting/xslthl-config.xml</xsl:param>
-->

	<xsl:template name="user.preroot">
	</xsl:template>

   <xsl:template name="user.head.content">
   		<!--
		<xsl:copy-of select="document('myscriptfile.js',/)"/>
		 -->
   </xsl:template>

	<xsl:template name="user.header.navigation">

        <a href="//www.netkiller.cn/">Home</a> |
		<a href="//netkiller.github.io/">简体中文</a> |
	    <a href="http://netkiller.sourceforge.net/">繁体中文</a> |
	    <a href="/journal/index.html">杂文</a> |
	    <a href="//www.netkiller.cn/home/donations.html">打赏(Donations)</a> |
	    <a href="http://netkiller-github-com.iteye.com/">ITEYE 博客</a> |
	    <a href="http://my.oschina.net/neochen/">OSChina 博客</a> |
	    <a href="https://www.facebook.com/bg7nyt">Facebook</a> |
	    <a href="http://cn.linkedin.com/in/netkiller/">Linkedin</a> |
	    <a href="https://zhuanlan.zhihu.com/netkiller">知乎专栏</a> |
	    <a href="/search.html">Search</a> |
		<a href="mailto:netkiller@msn.com">Email</a>
<!--
<table width="100%" border="0">
  <tr>
    <td align="left" >
    </td>
    <td  align="right">
 -->
<!-- Google CSE Search Box Begins -->
<!--
  <form id="searchbox_008589143145807374698:f5uprauilyy" action="/search.html">

    <input type="hidden" name="cx" value="008589143145807374698:f5uprauilyy" />
    <input type="hidden" name="cof" value="FORID:11" />
    <input name="q" type="text" size="25" style="border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-color: rgb(126, 157, 185); border-right-color: rgb(126, 157, 185); border-bottom-color: rgb(126, 157, 185); border-left-color: rgb(126, 157, 185); padding-top: 2px; padding-right: 2px; padding-bottom: 2px; padding-left: 2px; background-image: url(http://www.google.com/cse/intl/en/images/google_custom_search_watermark.gif); background-attachment: initial; background-origin: initial; background-clip: initial; background-color: rgb(255, 255, 255); background-position: 0% 50%; background-repeat: no-repeat no-repeat; " />
    <input type="submit" name="sa" value="Search" />
    <input name="siteurl" type="hidden" value="http://netkiller.sourceforge.net/" />
  </form>
  <script type="text/javascript" src="http://www.google.com/coop/cse/brand?form=searchbox_008589143145807374698%3Af5uprauilyy"></script>
 -->
<!-- Google CSE Search Box Ends -->
<!--
    </td>
  </tr>
</table>
 -->
	</xsl:template>

   <xsl:template name="user.header.content">

<table><tr><td>
<iframe src="//ghbtns.com/github-btn.html?user=netkiller&repo=netkiller.github.io&type=watch&count=true&size=large" height="30" width="170" frameborder="0" scrolling="0" style="width:170px; height: 30px;" allowTransparency="true"></iframe>
</td><td>
<iframe src="//ghbtns.com/github-btn.html?user=netkiller&repo=netkiller.github.io&type=fork&count=true&size=large" height="30" width="170" frameborder="0" scrolling="0" style="width:170px; height: 30px;" allowTransparency="true"></iframe>
</td><td>
<iframe src="//ghbtns.com/github-btn.html?user=netkiller&type=follow&count=true&size=large" height="30" width="240" frameborder="0" scrolling="0" style="width:240px; height: 30px;" allowTransparency="true"></iframe>
</td></tr></table>

   </xsl:template>

   <xsl:template name="user.footer.content">

<div id="disqus_thread"></div>
<script>

var disqus_config = function () {
this.page.url = "http://www.netkiller.cn";  // Replace PAGE_URL with your page's canonical URL variable
this.page.identifier = 'netkiller'; // Replace PAGE_IDENTIFIER with your page's unique identifier variable
};

(function() { // DON'T EDIT BELOW THIS LINE
var d = document, s = d.createElement('script');
s.src = '//netkiller.disqus.com/embed.js';
s.setAttribute('data-timestamp', +new Date());
(d.head || d.body).appendChild(s);
})();
</script>
<noscript>Please enable JavaScript to view the <a href="https://disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript>

		<br />

		<script type="text/javascript" id="clustrmaps" src="//cdn.clustrmaps.com/map_v2.js?u=r5HG&d=9mi5r_kkDC8uxG8HuY3p4-2qgeeVypAK9vMD-2P6BYM"></script>

   </xsl:template>

   <xsl:template name="user.footer.navigation">

<script >
  (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
  (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
  m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
  })(window,document,'script','//www.google-analytics.com/analytics.js','ga');

  ga('create', 'UA-11694057-1', 'auto');
  ga('send', 'pageview');

</script>

<script async="async">
var _hmt = _hmt || [];
(function() {
  var hm = document.createElement("script");
  hm.src = "https://hm.baidu.com/hm.js?93967759a51cda79e49bf4e34d0b0f2c";
  var s = document.getElementsByTagName("script")[0];
  s.parentNode.insertBefore(hm, s);
})();
</script>

<!-- 搜索自动收录代码 -->
<script async="async">
(function(){
    var bp = document.createElement('script');
    var curProtocol = window.location.protocol.split(':')[0];
    if (curProtocol === 'https') {
        bp.src = 'https://zz.bdstatic.com/linksubmit/push.js';
    }
    else {
        bp.src = 'http://push.zhanzhang.baidu.com/push.js';
    }
    var s = document.getElementsByTagName("script")[0];
    s.parentNode.insertBefore(bp, s);
})();
</script>

<script type="text/javascript" src="/js/q.js" async="async"></script>

   </xsl:template>

</xsl:stylesheet>

1.2. Docbook参数

/usr/share/xml/docbook/stylesheet/nwalsh/xhtml/param.xsl

默认HTML格式输出文件中的章内小节是没有自动编号功能的，如果要实现小节自动编号需要设置HTML格式的两个转换参数。

section.autolabel参数为1代表章内小节可自动编号，为0表示不会自动编号；

section.label.includes.component.label参数为1表示章内小节编号包含章节编号,为0表示不包含章节编号。

设置这两个参数可通过命令行方式，也可通过修改XSL转换文件方法。下面分别介绍这两种方法：

通过命令行方式：

$ xsltproc --stringparam  section.autolabel 1 \
           --stringparam  section.label.includes.component.label 1 \
           docbook.xsl  myfile.xml>myfile.htm
修改XSL转换文件方式：

DocBook文档的HTML格式转换样式文件一般位于/usr/share/sgml/docbook/docbook-xsl-1.65.1/html/目录下。通过查看docbook.xsl文件可知，在docbook.xsl中引用param.xsl作为参数设置文件，所有的参数都在这里设置。我们打开param.xsl文件，找到以下两行，再把参数置成1就可以了。

<xsl:param name="section.autolabel" select="1"/>
<xsl:param name="section.label.includes.component.label" select="1"/>

另一种方法

cat my_docbook.xsl
<?xml version='1.0'?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                version='1.0'>
<xsl:include href="/usr/share/xml/docbook/stylesheet/nwalsh/html/docbook.xsl"/>
<xsl:output method="html"
            encoding="UTF-8"
            indent="no"/>
</xsl:stylesheet>

xsltproc -o docbook.html my_docbook.xsl docbook.xml

1.3. 生成目录深度

总深度
<xsl:param name="toc.max.depth">8</xsl:param>

章节深度
<xsl:param name="toc.section.depth">2</xsl:param>

1.4. 字符集

				--stringparam chunker.output.encoding UTF-8

1.5. Filename prefix

base.dir parameter value	Description	Example 					chunk filename
base.dir="htmlout/"			Output directory only.					htmlout/chap1.html
base.dir="refbook-"			Filename prefix only.					refbook-chap1.html
base.dir="htmlout/refbook-"	Output directory and filename prefix.	htmlout/refbook-chap1.html

base.dir parameter

				xsltproc --stringparam base.dir /usr/apache/htdocs/ chunk.xsl myfile.xml

2. htmlhelp

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
   	<xsl:import href="/usr/share/xml/docbook/stylesheet/docbook-xsl/htmlhelp/htmlhelp.xsl"/>
	<xsl:param name="htmlhelp.encoding">UTF-8</xsl:param>
   	<xsl:param name="chunker.output.encoding">UTF-8</xsl:param>
   	<xsl:param name="htmlhelp.autolabel" select="1"/>
   	<xsl:param name="htmlhelp.hhc.section.depth">3</xsl:param>
	<xsl:param name="htmlhelp.hhc.show.root" select="0"/> <!-- 1 目录收缩  0 目录展开 -->

   	<xsl:param name="section.autolabel" select="1"/>
	<xsl:param name="section.label.includes.component.label" select="1"/>
	<xsl:param name="bibliography.numbered" select="1"/>
	<xsl:param name="toc.max.depth">4</xsl:param>
   	<xsl:param name="toc.section.depth">3</xsl:param>

   	<!--
   	<xsl:param name="htmlhelp.chm">neo.chm</xsl:param>
   	<xsl:param name="htmlhelp.use.hhk" select="1"/>
   	<xsl:param name="use.id.as.filename" select="1"/>
   	 -->

   <xsl:template name="user.footer.content">

   </xsl:template>

   <xsl:template name="user.footer.navigation">

<script type="text/javascript">

  var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'UA-11694057-1']);
  _gaq.push(['_setDomainName', 'netkiller.github.io']);
  _gaq.push(['_setAllowLinker', true]);
  _gaq.push(['_trackPageview']);

  (function() {
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
  })();

</script>

<script type="text/javascript">
var _bdhmProtocol = (("https:" == document.location.protocol) ? " https://" : " http://");
document.write(unescape("%3Cscript src='" + _bdhmProtocol + "hm.baidu.com/h.js%3F997cd4a7320a82d72cb74d179118f697' type='text/javascript'%3E%3C/script%3E"));
</script>

   </xsl:template>
</xsl:stylesheet>

<!DOCTYPE stylesheet [
<!ENTITY xsl_ns_base_cygwin "/home/neo/docbook/tools/docbook-xsl-ns-1.76.1">
]>

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version='1.0'>

<xsl:import href="&xsl_ns_base_cygwin;/usr/share/xml/docbook/stylesheet/docbook-xsl/htmlhelp/htmlhelp.xsl"/>

<xsl:output encoding="UTF-8" indent="no"/>

<xsl:param name="title.font.family">msyhbd</xsl:param>
<xsl:param name="body.font.family">msyh</xsl:param>
<xsl:param name="monospace.font.family">msyh</xsl:param>

</xsl:stylesheet>

第 4 章 DOCTYPE

1. SYSTEM

在线引用DOCTYPE头，这样在创建文档的时候速度会比较慢。

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook V5.0//EN"
"http://www.oasis-open.org/docbook/xml/5.0/docbook.dtd">

我们也可使使用本地的DTD文件

<!DOCTYPE subject SYSTEM "/usr/share/xml/docbook/schema/dtd/4.5/docbookx.dtd" [
	<!ENTITY book.info.author.xml			SYSTEM "../common/book.info.author.xml">
	<!ENTITY book.info.legalnotice.xml		SYSTEM "../common/book.info.legalnotice.xml">
	<!ENTITY book.info.abstract.xml			SYSTEM "../common/book.info.abstract.xml">
    <!ENTITY book.preface.xml           	SYSTEM "../common/book.preface.xml">
	<!ENTITY preface.about.me.xml       	SYSTEM "../common/about.me.xml">

	<!ENTITY chapter.docbook 			 	SYSTEM "chapter.docbook.xml">
	<!ENTITY chapter.docbook.doctype.xml 	SYSTEM "chapter.docbook.doctype.xml">
	<!ENTITY chapter.docbook.list.xml	 	SYSTEM "chapter.docbook.list.xml">
	<!ENTITY chapter.docbook.paragraphs.xml	SYSTEM "chapter.docbook.paragraphs.xml">
	<!ENTITY chapter.docbook.admonition.xml	SYSTEM "chapter.docbook.admonition.xml">
	<!ENTITY chapter.docbook-website.xml	SYSTEM "chapter.docbook-website.xml">
	<!ENTITY chapter.docbook.epub.xml	 	SYSTEM "chapter.docbook.epub.xml">
]>

<!DOCTYPE article PUBLIC "-//FreeBSD//DTD DocBook XML V4.5-Based Extension//EN" "../../../share/xml/freebsd45.dtd">

2. DTD 引用

2.1. 引用本地DTD

<!DOCTYPE subject SYSTEM "/usr/share/xml/docbook/schema/dtd/4.5/docbookx.dtd" [
...
]>

2.2. oasis-open.org

<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V5.0//EN" "http://www.oasis-open.org/docbook/xml/5.0b5/dtd/docbook.dtd" [
...
]>

3. article

例 4.1. article

<!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook V4.1//EN">

<article>
  <articleinfo>
    <title>An example article</title>

    <author>
      <firstname>Your first name</firstname>
      <surname>Your surname</surname>
      <affiliation>
        <address><email>foo@example.com</email></address>
      </affiliation>
    </author>

    <copyright>
      <year>2000</year>
      <holder>Copyright string here</holder>
    </copyright>

    <abstract>
      <para>If your article has an abstract then it should go here.</para>
    </abstract>
  </articleinfo>

  <sect1>
    <title>My first section</title>

    <para>This is the first section in my article.</para>

    <sect2>
      <title>My first sub-section</title>

      <para>This is the first sub-section in my article.</para>
    </sect2>
  </sect1>
</article>

4. book

例 4.2. book

<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook V4.1//EN">

<book>
  <bookinfo>
    <title>An Example Book</title>

    <author>
      <firstname>Your first name</firstname>
      <surname>Your surname</surname>
      <affiliation>
        <address><email>foo@example.com</email></address>
      </affiliation>
    </author>

    <copyright>
      <year>2000</year>
      <holder>Copyright string here</holder>
    </copyright>

    <abstract>
      <para>If your book has an abstract then it should go here.</para>
    </abstract>
  </bookinfo>

  <preface>
    <title>Preface</title>

    <para>Your book may have a preface, in which case it should be placed
      here.</para>
  </preface>

  <chapter>
    <title>My first chapter</title>

    <para>This is the first chapter in my book.</para>

    <sect1>
      <title>My first section</title>

      <para>This is the first section in my book.</para>
    </sect1>
  </chapter>
</book>

5. include

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V5.0//EN"
	"http://www.oasis-open.org/docbook/xml/5.0b5/dtd/docbook.dtd" [

	<!ENTITY chapter.database SYSTEM "chapter.database.xml">
]>
<book xml:base="http://netkiller.mefound.com/book/publish/"
	xmlns="http://docbook.org/ns/docbook" xml:lang="zh-cn">
	<info>
		<title>Netkiller Document 手札</title>
		<author>
			<firstname>netkiller</firstname>
			<surname>Neo Chan</surname>
			<affiliation>
				<address>
					<email>openunix(at)163(dot)com</email>
				</address>
			</affiliation>
		</author>
		<copyright>
			<year>2008</year>
			<holder>Copyright netkiller</holder>
		</copyright>
		<releaseinfo>
			<para>修订版本 2008-5-24</para>
		</releaseinfo>

		<abstract>
			<title></title>
			<para></para>
		</abstract>
	</info>

	<preface>
		<title></title>
		<para></para>
	</preface>

	&chapter.database;

</book>

chapter.database.xml

<chapter>
	<title>Chapter 1</title>
</chapter>

6. xi:include

<book xmlns="http://docbook.org/ns/docbook" xmlns:xi="http://www.w3.org/2001/XInclude">
<title>Book</title>
<xi:include href="ch1.xml"/>
<xi:include href="ch2.xml"/>
<xi:include href="ch3.xml"/>
<xi:include href="ch4.xml"/>
</book>

7. Docbook HTML 输出选项

HTML output options

7.1. 指定多页输出时html文档名

我们把docbook文档转换成html文档时，可以转换成一个大的html文档，也可以转换成多页的html文档。当转换成多页是，默认的文件是以ch01.html、ch02.html方式命名的，较不直观。我们可在docbook文档中添加一个属性，使它输出时按我们指定的文件名输出。

方法一：
<chapter><?dbhtml filename="first.html" ?>
<title>Introduction</title>
...

方法二：
<chapter id="first">
<title>Introduction</title>
...

xsltproc --stringparam  use.id.as.filename 1 chunk.xsl myfile.xml

7.2. 指定输出路径

默认转换后的文档是保存在当前目录的，我们可在xsltproc命令行用-o选项指定转换后文档的输出路径，另外一种是在docbook中指定。

<book><?dbhtml dir="neo" ?>
<title>Docbook Guide</title>
...
<chapter id="first"><?dbhtml dir="technic" ?>
...
<chapter id="second">
...
<appendix id="three"><?dbhtml dir="read" ?>
...

输出后的路径：
jims/index.html
jims/technic/first.html
jims/second.html
jims/read/three.html

7.3. 包含HTML文件

...
</para>
<?dbhtml-include href="mycode.html"?>
<?dbhtml-include href="../additonal.html"?>
<para>
...

7.4. 包含HTML节点

<xsl:template name="user.header.content">
   <xsl:variable name="codefile" select="document('mycode.html',/)"/>
   <xsl:copy-of select="$codefile/htmlcode/node()"/>
</xsl:template>

7.5. 图标

Docbook icon graphics

Admonition graphics

admon.graphics 1

xsltproc  --stringparam admon.graphics 1 docbook.xsl myfile.xml

导航图标

Navigational icons

xsltproc --stringparam  navig.graphics 1  chunk.xsl  myfile.xml

Callout icons

If you use callout graphics, then there are three parameters that give you more control over the generated img tag.

callout.graphics.extension
Use this parameter to change the icon file extension from .png to something else. Of course, you must have the graphics that match that extension.

callout.graphics.path
Use this parameter to change the generated directory name from the default images/callouts/. Be sure to include the trailing slash.

callout.graphics.number.limit
Use this parameter to set the highest number for which you have a callout graphic. The stylesheets are distributed with callout graphics files with numbers up to 15, but you could create graphics with additional numbers if you need them. If you have more numbers but you do not reset this parameter, then any numbers over 15 will still format like (16).

7.6. dbhtml-include

包含html文件到当前页面

<?dbhtml-include href="file:///www/freebsd/faq.html"?>
<?dbhtml-include href="http://www.example.org/freebsd/faq.html"?>

注意：需要开启下面两个选项才能生效

	<xsl:param name="use.extensions" select="1"/>
	<xsl:param name="textinsert.extension" select="1"/>

7.7. 显示当前时间

<para>This document was generated <?dbtimestamp format="Y-m-d H:M:S"?>. </para>

<?dbtimestamp format="Y-m-d"  padding="0" ?>

第 5 章 The DocBook HTML Forms Document Type

$ sudo apt-get install docbook-html-forms

To use this module, specify the public and system identifiers of this module in your document type declaration. For example, to use this module to write a book, use the following document type declaration:

<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook HTML Forms Module V1.2CR1//EN"
               "http://www.oasis-open.org/docbook/xml/htmlforms/1.2CR1/dbforms.dtd">

Naturally, you can include an internal subset if you wish.

To incorporate this module into a higher-level customization layer, use the public and system identifiers of this module in your customization layer. For example:

<!DOCTYPE % docbookforms PUBLIC "-//OASIS//DTD DocBook HTML Forms Module V1.2CR1//EN"
                        "http://www.oasis-open.org/docbook/xml/htmlforms/1.2CR1/dbforms.dtd">
%docbookforms;

第 6 章 book 书 / article 文章

1. info

bookinfo / articleinfo

1.1. affiliation

  <affiliation>
    <shortaffil>IBM</shortaffil>
    <jobtitle>Senior LAMP Engineer</jobtitle>
    <orgname>ArborText, Inc.</orgname>
    <orgdiv>Application Developement</orgdiv>
  </affiliation>

1.2. address 地址

<address>
  <street>162 Guelph Street</street>
  <city>Georgetown</city>
  <state>ON</state>
  <country>Canada</country>
  <postcode>L7G 5X7</postcode>
  <phone>1-888-628-2028</phone>
  <fax>(905) 702-7851</fax>
  <email>info@cogent.ca</email>
  <otheraddr>www.cogent.ca</otheraddr>
</address>

1.3. reference 参考信息

<reference>
    <title>Reference</title>
    <refentry>
(The content here is shown in the Reference Entries appendix.)
    </refentry>
</reference>

1.4. author 作者

<authorgroup>
	<author>
		<FirstName>Bert</FirstName><Surname>Hubert</Surname>
		<affiliation>
	  		<orgname>Netherlabs BV</orgname>
	  		<address><email>bert.hubert@netherlabs.nl</email></address>
		</affiliation>
	</author>

    <collab>
		<collabname>Thomas Graf (Section Author)</collabname>
        <affiliation>
        	<address><email>tgraf%suug.ch</email></address>
		</affiliation>
	</collab>
</authorgroup>

contrib

<authorgroup>
    <author>
	<firstname>Jordan</firstname>
	<surname>Hubbard</surname>
	<contrib>原著</contrib>
    </author>
</authorgroup>

affiliation

<!DOCTYPE author PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN"
          "http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd">
<author>
  <honorific>Mr</honorific>
  <firstname>Norman</firstname>
  <surname>Walsh</surname>
  <othername role='mi'>D</othername>
  <affiliation>
    <shortaffil>ATI</shortaffil>
    <jobtitle>Senior Application Analyst</jobtitle>
    <orgname>ArborText, Inc.</orgname>
    <orgdiv>Application Developement</orgdiv>
  </affiliation>
</author>

editor

<!DOCTYPE authorgroup PUBLIC "-//OASIS//DTD DocBook V3.1//EN">
<authorgroup>
  <author>
    <honorific>Dr.</honorific>
    <firstname>Lois</firstname>
    <surname>Common-Demoninator</surname>
    <affiliation>
      <shortaffil>Director, M. Behn School of Coop. Eng.</shortaffil>
      <jobtitle>Director of Cooperative Efforts</jobtitle>
      <orgname>The Marguerite Behn International School of
               Cooperative Engineering</orgname>
    </affiliation>
  </author>

  <editor>
    <firstname>Peter</firstname>
    <surname>Parker</surname>
    <lineage>Sr.</lineage>
    <othername>Spiderman</othername>
    <authorblurb>
      <para>
      Peter's a super hero in his spare time.
      </para>
    </authorblurb>
  </editor>
</authorgroup>

othercredit

<article xmlns='http://docbook.org/ns/docbook'>
<info>
  <title>Example othercredit</title>
  <author>
    <personname>
      <firstname>Norman</firstname>
      <surname>Walsh</surname>
    </personname>
  </author>
  <othercredit>
    <personname>
      <firstname>John</firstname>
      <surname>Doe</surname>
    </personname>
    <contrib>Extensive review and rough drafts of Section 1.3, 1.4, and 1.5
    </contrib>
  </othercredit>
  <biblioid>5</biblioid>
</info>

<para>…</para>

</article>

<!DOCTYPE articleinfo PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN"
          "http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd">
<articleinfo>
  <title>Something Snappy</title>
  <author>
    <firstname>Norman</firstname>
    <surname>Walsh</surname>
  </author>
  <othercredit>
    <firstname>John</firstname>
    <surname>Doe</surname>
    <contrib>Extensive review and rough drafts of Section 1.3, 1.4, and 1.5
      </contrib>
  </othercredit>
  <pubsnumber>5</pubsnumber>
</articleinfo>

1.5. 出版信息

出版者

<publisher>                      <!-- 出版者 -->
    <publishername>XXXXXX有限公司</publishername>  <!-- 出版機構名稱 -->
    <address>
        <street>xxx道xxx巷12号204</street>
        <postcode>518000</postcode>
        <city>深圳</city>
        <state>广东</state>
        <country>中国</country>
        <phone>+86 755 xxxxxxxx</phone>
        <fax>+86 755 xxxxxxxx</fax>
        <email>your@domain.com</email>
      </address>
  </publisher>

印刷历史

<printhistory>
<para>
   June 2000: First Printed Edition.
</para>
</printhistory>

出版紀錄

	<edition>User's Guide version 1.0 for DocBook V3.0</edition>
	<pubdate>1997</pubdate>
	<releaseinfo></releaseinfo>
    <isbn>ISBN xx-xxxxxx-x-x</isbn>
	<revhistory>                     	<!-- 出版紀錄，可以有很多版本。 -->
		<revision>                     	<!-- 某一版本 -->
			<revnumber>1.0.0</revnumber> <!-- 版本編號 -->
			<date>2006-11-14</date>  	<!-- 發佈出版日期 -->
			<authorinitials></authorinitials>  <!-- 作者簡稱識別 -->
			<revremark></revremark>  	<!-- 版本發佈簡述 -->
		</revision>
	</revhistory>

1.6. copyright 版权

	<copyright>
		<year>2008</year>
		<year>2009</year>
		<year>2010</year>
		<year>2011</year>
		<holder>Netkiller(Neo Chan). All rights reserved.</holder>
	</copyright>

1.7. keyword

	<keywordset>
	    <keyword>Linux</keyword>
	    <keyword>Beginners</keyword>
	    <keyword>linux</keyword>
	    <keyword>start</keyword>
	    <keyword>Getting started</keyword>
	    <keyword>guide</keyword>
	    <keyword>Guide</keyword>
	    <keyword>Exercises</keyword>
	    <keyword>exercises</keyword>
	</keywordset>

1.8. abstract 摘要

<book>
	<info>
		<abstract><title>Abstract</title>
			<para></para>
			<para></para>
			<para></para>
			<para></para>
		</abstract>
	</info>
</book>

1.9. legalnotice 法律声明

<book>
	<info>
		<legalnotice><title>Legalnotice</title>
			<para></para>
			<para></para>
			<para></para>
			<para></para>
		</legalnotice>
	</info>
</book>

1.10. cover 书籍封面图

<book xmlns='http://docbook.org/ns/docbook'>
<info>
  <title>DocBook</title>
  <subtitle>The Definitive Guide</subtitle>
  <biblioid class="isbn">978-0-596-8050-2-9</biblioid>
  <authorgroup>
    <author>
      <personname>
	<firstname>Norman</firstname>
	<surname>Walsh</surname>
      </personname>
    </author>
  </authorgroup>
  <publisher>
    <publishername>O'Reilly Media, Inc.</publishername>
    <address><city>Beijing</city></address>
    <address><city>Cambridge</city></address>
    <address><city>Farnham</city></address>
    <address><city>Köln</city></address>
    <address><city>Paris</city></address>
    <address><city>Sebastopol</city></address>
    <address><city>Taipei</city></address>
    <address><city>Tokyo</city></address>
  </publisher>
  <copyright>
    <year>2010</year>
    <holder>Norman Walsh, All rights reserved.</holder>
  </copyright>
  <releaseinfo>Published by O'Reilly Media, Inc.,
101 Morris Street, Sebastopol, CA 95472.</releaseinfo>
  <editor>
    <personname>
      <firstname>Richard L.</firstname>
      <surname>Hamilton</surname>
    </personname>
  </editor>
  <revhistory>
    <revision>
      <date>March 2010</date>
      <revremark>Second Edition.</revremark>
    </revision>
    <revision>
      <date>October 1999</date>
      <revremark>First Edition.</revremark>
    </revision>
  </revhistory>
  <legalnotice>
    <para>Nutshell Handbook, the Nutshell Handbook logo, and the…</para>
    <para>Many of the designations used by manufacturers…</para>
    <para>While every precaution has been taken in the preparation…</para>
  </legalnotice>
  <cover>
    <para role="tagline">The Official Documentation for DocBook</para>
    <mediaobject>
      <imageobject>
	<imagedata fileref="graphics/duck-cover.png">
	  <info>
	    <othercredit>
	      <orgname>O'Reilly Media</orgname>
	    </othercredit>
	    <othercredit>
	      <orgname>Dover Archives</orgname>
	    </othercredit>
	  </info>
	</imagedata>
      </imageobject>
    </mediaobject>
  </cover>
  <cover>
    <mediaobject>
      <imageobject>
	<imagedata fileref="graphics/duck-backcover.png"/>
      </imageobject>
    </mediaobject>
    <para>DocBook is a system for writing structured documents using…</para>
    <para><citetitle>DocBook: The Definitive Guide</citetitle> is the…</para>
    <itemizedlist>
      <listitem>
	<para>A brief introduction to  …</para>
      </listitem>
      <listitem>
	<para>A guide to creating documents with the DocBook schema…</para>
      </listitem>
      <listitem>
	<para>…</para>
      </listitem>
    </itemizedlist>
    <para>In an era of collaborative creation of technology, …</para>
    <formalpara>
      <title>Norman Walsh</title>
      <para>is a …</para>
    </formalpara>
  </cover>
</info>

<preface>
<title>Preface</title>

<para>DocBook provides a system …</para>
</preface>

<!-- … -->

</book>

2. toc 自定义目录

<book xmlns='http://docbook.org/ns/docbook'>
<title>DocBook: The Definitive Guide</title>
<subtitle>TOC Markup Example</subtitle>

<toc>
  <title>Table of Contents</title>
  <tocdiv>
    <title>Preface</title>
    <tocentry>Why Read This Book?</tocentry>
    <tocentry>This Book's Audience</tocentry>
    <!-- ... -->
  </tocdiv>
  <tocdiv>
    <title>Part I. Introduction</title>
    <tocdiv>
      <title>Chapter 1. Getting Started with DocBook</title>
      <tocdiv>
        <title>A Short DocBook History</title>
        <tocentry>The HaL and O'Reilly era</tocentry>
        <tocentry>The Davenport era</tocentry>
        <tocentry>The OASIS era</tocentry>
      </tocdiv>
      <tocdiv>
        <title>DocBook V5.0</title>
        <tocdiv>
          <title>What's New in DocBook V5.0?</title>
          <tocentry>Renamed and removed elements</tocentry>
          <!-- ... -->
        </tocdiv>
      </tocdiv>
    </tocdiv>
    <tocdiv>
      <title>Chapter 2. Creating DocBook Documents</title>
      <tocdiv>
        <title>Making an XML Document</title>
        <tocentry>An XML Declaration</tocentry>
        <!-- ... -->
      </tocdiv>
    </tocdiv>
  </tocdiv>
</toc>

<preface>
  <title>Preface</title>
  <para>DocBook provides a system for writing structured documents using
  <acronym>XML</acronym>. …</para>

  <!-- ... -->

  <section>
    <title>Why Read This Book?</title>

    <para>This book is designed to be the clear, concise, normative reference to
    the DocBook schema. This book is the official documentation for DocBook.
    </para>

    <!-- ... -->
  </section>
</preface>

<!-- ... -->

</book>

3. topic

<topic xmlns='http://docbook.org/ns/docbook' version="5.1">
<info>
  <title>Troubleshooting</title>
</info>

<para>If your <citetitle>Joo Janta 200 Super-Chromatic Peril Sensitive
Sunglasses</citetitle> become opaque, do not be alarmed. That's more
or less the point.</para>

</topic>

4. dedication 感谢

<book>
	<dedication><title>鸣谢</title>
		<para></para>
		<para></para>
		<para></para>
		<para></para>
	</dedication>
</book>

5. preface 序言

<preface id="svn.foreword">
  <prefaceinfo>
    <author>
      <firstname>Neo</firstname>
      <surname>Chan</surname>
    </author>
    <pubdate>Chicago, March 14, 2004.</pubdate>
  </prefaceinfo>

  <title>Preface</title>
  <para>...</para>
</preface>

6. appendix 附录

<appendix>
    <title>Appendix One</title>
    <para>Appendix content.</para>
</appendix>

第 7 章 Part 部分 / Chapter 章 / Section 节

1. title 标题

<part>
	<title>Part I</title>
	<chapter>
		<title>Chapter 1</title>
		<section>
			<title>Section 1</title>
		</section>
	</chapter>
</part>

1.1. subtitle

<part>
	<title>Part I</title>
	<subtitle>Part I subtitle</subtitle>
	<chapter>
		<title>Chapter 1</title>
		<subtitle>Chapter 1 subtitle</subtitle>
		<section>
			<title>Section 1</title>
			<subtitle>Section 1 subtitle</subtitle>
		</section>
	</chapter>
</part>

1.2. titleabbrev

<part>
	<title>Part I</title>
	<subtitle>Part I subtitle</subtitle>
	<titleabbrev>Part I titleabbrev</titleabbrev>
	<chapter>
		<title>Chapter 1</title>
		<subtitle>Chapter 1 subtitle</subtitle>
		<titleabbrev>Chapter I titleabbrev</titleabbrev>
		<section>
			<title>Section 1</title>
			<subtitle>Section 1 subtitle</subtitle>
			<titleabbrev>Section I titleabbrev</titleabbrev>
		</section>
	</chapter>
</part>

2. part 部

<part>
	<title>Part</title>
	<partintro>
        <para></para>
	</partintro>
</part>

<?xml version="1.0" encoding="UTF-8"?>
<book version="5.0" xmlns="http://docbook.org/ns/docbook"
      xmlns:xlink="http://www.w3.org/1999/xlink"
      xmlns:xi="http://www.w3.org/2001/XInclude">
  <info>
    <title>The Gallio Book</title>
    <authorgroup>
      <author><personname>The Gallio Documentation Team</personname></author>
    </authorgroup>
    <copyright>
      <year>2009</year>
      <holder>Gallio Project</holder>
    </copyright>
    <address>http://www.gallio.org/</address>
    <xi:include href="ReleaseInfo.docbook"/>
  </info>

  <xi:include href="Preface.docbook" />
  <part label="I" xml:id="part_Using">
    <title>Using MbUnit and Gallio</title>
    <xi:include href="Installation/Installation.docbook" />
  </part>

  <part label="II" xml:id="part_Developing">
    <title>Developing MbUnit and Gallio</title>
    <xi:include href="GallioDevelopmentBasics/GallioDevelopmentBasics.docbook" />
  </part>

  <part label="III" xml:id="appendices">
    <title>Appendices</title>
    <xi:include href="Appendices/MigrationGuide.docbook" />
  </part>

</book>

partintro

<!DOCTYPE part PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN"
          "http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd">
<part label="II">
<title>Programming with the Java API</title>
<partintro>
<para>
The sections in Part II present real-world examples of
programming with Java.  You can study and learn from the
examples, and you can adapt them for use in your own programs.
</para>

<para>
The example code in these chapters is available for downloading.
See <systemitem role="url">http://www.ora.com/catalog/books/javanut</systemitem>.
</para>

<literallayout>
<xref linkend="jnut-ch-04"/>
<xref linkend="jnut-ch-05"/>
<xref linkend="jnut-ch-06"/>
<xref linkend="jnut-ch-07"/>
<xref linkend="jnut-ch-08"/>
<xref linkend="jnut-ch-09"/>
</literallayout>
</partintro>
<chapter id="jnut-ch-04"><title/><para>...</para></chapter>
<chapter id="jnut-ch-05"><title/><para>...</para></chapter>
<chapter id="jnut-ch-06"><title/><para>...</para></chapter>
<chapter id="jnut-ch-07"><title/><para>...</para></chapter>
<chapter id="jnut-ch-08"><title/><para>...</para></chapter>
<chapter id="jnut-ch-09"><title/><para>...</para></chapter>

3. chapter 章

	<part>
		<title>Part</title>
		<chapter>
			<title>Chapter</title>
		</chapter>
		<chapter>
			<title>Chapter</title>
		</chapter>
	</part>

3.1. chapterinfo

	<chapterinfo>
		<abstract>
		  <para>Kickstart 无人值守安装</para>
		</abstract>
		<keywordset>
			<keyword>ISO</keyword>
			<keyword>kickstart</keyword>
			<keyword>ks</keyword>
		</keywordset>
	</chapterinfo>

<chapterinfo>
    <authorgroup>
      <author>
    	<firstname>Tom</firstname>
	    <surname>Rhodes</surname>
    	<contrib>Written by </contrib>
      </author>
    </authorgroup>
</chapterinfo>

<chapterinfo>
<keywordset>
  <keyword>images</keyword>
  <keyword>illustrations</keyword>
</keywordset>
<itermset>
  <indexterm zone="figures"><primary>Figures</primary></indexterm>
  <indexterm zone="figures"><primary>Pictures</primary></indexterm>
  <indexterm zone="notreal">
    <primary>Sections</primary><secondary>Not Real</secondary>
  </indexterm>
</itermset>
</chapterinfo>

4. section 节

<part>
	<title>Part I</title>
	<chapter>
		<title>Chapter 1</title>
		<section>
			<title>Section 1</title>
		</section>
	</chapter>
</part>

4.1. simplesect

simplesect 下面不能再有 section/sect1..3/simplesect

<article xmlns='http://docbook.org/ns/docbook'>
	<title>Example simplesect</title>

	<section>
		<title>Additional Coding</title>

		<para>Support for the additional features requested will be provided. </para>

		<simplesect>
			<title>Estimated Time</title>

			<para>2 to 3 weeks.</para>

		</simplesect>
	</section>

</article>

Estimated Time

2 to 3 weeks.

4.2. bridgehead

<bridgehead renderas="sect3">Topic Heading</bridgehead>
<para>You can use the Bridgehead element to create a heading
between paragraphs, without creating a new section or
sub-section.</para>

Topic Heading

You can use the Bridgehead element to create a heading between paragraphs, without creating a new section or sub-section.

4.3. sidebar

<sidebar>
	<title>A Sidebar</title>
	<para>
	Sidebar content.
	</para>
</sidebar>

A Sidebar

Sidebar content.

5. Paragraphs 段落

5.1. para 段落

<para>helloworld</para>

5.2. simpara 简单段落

<simpara>
	Just the text, ma'am.
</simpara>

Just the text, ma'am.

5.3. formalpara 带标题的段落

<formalpara>
  <title>A Formal Paragraph</title>
  <para>has a title that appears in bold, and a body paragraph.
  The title paragraph is incorporated into the body paragraph in HTML,
  and is separate in PDF.  The body paragraph is a regular &lt;para&gt;
  paragraph, and there is only one body paragraph allowed per formal
  paragraph.</para>
</formalpara>

A Formal Paragraph.  has a title that appears in bold, and a body paragraph. The title paragraph is incorporated into the body paragraph in HTML, and is separate in PDF. The body paragraph is a regular <para> paragraph, and there is only one body paragraph allowed per formal paragraph.

5.4. 产品名

<para>
<productname class='trade'>Frobozz</productname>: it's not
just for breakfast anymore.
</para>

Frobozz™ : it's not just for breakfast anymore.

5.5. TM 商标

<trademark>Microsoft</trademark>

Microsoft™

5.6. 字体

Font Formatting Codes

strong

<para><emphasis role="strong">Note</emphasis></para>

Note

bold

<emphasis role="bold">text</emphasis>

text

italic

<emphasis role="italic">text</emphasis>

text

literal

<para><literal>literal</literal></para>

literal

Code

<literal role="code">< ! [ CDATA [ code ] ] ></literal>

code

remark

<remark>Some details are still a bit shaky</remark>

5.7. citetitle — The title of a cited work

<!DOCTYPE para PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN"
          "http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd">
<para>
The <emphasis>most</emphasis> important example of this
phenomenon occurs in A. Nonymous's book
<citetitle>Power Snacking</citetitle>.
</para>

<para>
For a complete methodology for DTD creation, see
<citetitle pubwork="book">Developing SGML DTDs: From Text to Model
to Markup</citetitle> by Eve Maler and Jeanne El Andaloussi.
</para>

The most important example of this phenomenon occurs in A. Nonymous's book Power Snacking .

For a complete methodology for DTD creation, see Developing SGML DTDs: From Text to Model to Markup by Eve Maler and Jeanne El Andaloussi.

pubwork 类型

article
bbs
book
cdrom
chapter
dvd
emailmessage
gopher
journal
manuscript
newsposting
part
refentry
section
series
set
webpage
wiki

5.8. medialabel

<para>
To install <application>The Great Foo</application>, insert the disk
labelled <medialabel>TGF Setup 1</medialabel> and run
<command>setup</command>.
</para>

<para>
The weekly incremental backup tape is labelled
<medialabel>Backup <replaceable>nn</replaceable></medialabel>, where
<replaceable>nn</replaceable> is the week number.
</para>

To install The Great Foo , insert the disk labelled TGF Setup 1 and run setup .

The weekly incremental backup tape is labelled Backup nn , where nn is the week number.

6. blockquote 内容引用

 <blockquote>
    <para>
      This text should be indented.
    </para>
</blockquote>

This text should be indented.

7. epigraph 题词

<epigraph>
	<attribution>William Safire</attribution>
	<para>
		Knowing how things work is the basis for appreciation, and is
		thus a source of civilized delight.
	</para>
</epigraph>

<epigraph>

<attribution>
   <ulink url="http://www.margepiercy.com/">Marge Piercy</ulink>
</attribution>

<para>
   Life is the first gift, love is the second, and understanding is the third.
</para>

</epigraph>

Knowing how things work is the basis for appreciation, and is thus a source of civilized delight.

—William Safire

8. 计算机专业标签

8.1. 软件名称

<para>
<application>Word Perfect</application> is one of several word
processors to claim support for <acronym>SGML</acronym>.
</para>

Word Perfect is one of several word processors to claim support for SGML .

8.2. 硬件名称

<para>
The <acronym>IRQ</acronym> of the <hardware>SCSI Controller</hardware>
can be set to 7, 11, or 15.  The factory default setting is 7.
</para>

The IRQ of the SCSI Controller can be set to 7, 11, or 15. The factory default setting is 7.

8.3. 数据库

<para>
The <database>ProjectStatus</database> database has been updated.
Please note that <database class='field'>Year</database> has been
extended to four digits.
</para>

The ProjectStatus database has been updated. Please note that Year has been extended to four digits.

8.4. 程序标签

函数

<funcprototype>
  <funcdef>void <function>sort</function></funcdef>
    <paramdef>int *<parameter>arr</parameter>[]</paramdef>
    <paramdef>int <parameter>(* comp)</parameter>
      <funcparams>int *, int *</funcparams></paramdef>
</funcprototype>

void sort ( | arr, |
| (* comp)); |

int * arr [] ;
int (* comp) (int *, int *) ;

类名

<para>
	All user-interface components must be descendants of the
	<classname>Widget</classname>
	class.
</para>

All user-interface components must be descendants of the Widget class.

变量名

<para>
	In Perl,
	<varname>@ARGV</varname>
	contains the command line parameters
	used when the script was run.
</para>

In Perl, @ARGV contains the command line parameters used when the script was run.

synopsis

<synopsis>
chgrp [-R [-H | -L | -P]] [-f] group file...
</synopsis>

				chgrp [-R [-H | -L | -P]] [-f] group file...

<para>
In ACL, <constant>main::PCS</constant> contains the path component
separator character.
</para>
<para>
The maximum legal length for a path name is
<constant class='limit'>PATH_MAX</constant>, defined in
<filename class='headerfile'>limits.h</filename>.
</para>

In ACL, main::PCS contains the path component separator character.

The maximum legal length for a path name is PATH_MAX , defined in limits.h .

8.5. 命令

<para>
In <acronym>UNIX</acronym>,
<command>ls</command> is used to get a directory listing.
</para>

In UNIX , ls is used to get a directory listing.

参数

<para>
Using the <parameter class='command'>/w</parameter> parameter on the
DOS <command>dir</command> command prints a wide directory listing.
</para>

Using the /w parameter on the DOS dir command prints a wide directory listing.

环境变量

<para>
In order to translate public identifiers into local system identifiers,
<application>Jade</application> and <application>SP</application> read the catalog files
pointed to by <envar>SGML_CATALOG_FILES</envar>.
</para>

In order to translate public identifiers into local system identifiers, Jade and SP read the catalog files pointed to by SGML_CATALOG_FILES .

输入提示

<para>
Enter your user name when the system presents the
<prompt>login:</prompt> prompt.
</para>

Enter your user name when the system presents the login: prompt.

用户输入

<para>
At the system prompt, enter <userinput>xyzzy</userinput> to gain
supervisor access to the system.
</para>

At the system prompt, enter xyzzy to gain supervisor access to the system.

主机名

<para>
For many years, O'Reilly's primary web server,
<ulink url="http://www.oreilly.com/">http://www.oreilly.com/</ulink>,
was hosted by <application>WN</application> on
<systemitem class="systemname">helio.oreilly.com</systemitem>.
</para>

For many years, O'Reilly's primary web server, http://www.oreilly.com/ , was hosted by WN on helio.oreilly.com .

文件名

<para>
The symbolic constants for error numbers are defined in
<filename class='headerfile'>errno.h</filename> in
<filename class='directory'>/usr/include/sys</filename>.
</para>

The symbolic constants for error numbers are defined in errno.h in /usr/include/sys .

cmdsynopsis

<cmdsynopsis>
  <command>cd</command>
  <arg choice='req'><replaceable>directory</replaceable></arg>
</cmdsynopsis>

<cmdsynopsis>
  <command>cal</command>
  <arg>-j</arg>
  <arg>-y</arg>
  <arg>month <arg>year</arg></arg>
</cmdsynopsis>

<cmdsynopsis>
  <command>chgrp</command>
  <arg>-R
    <group>
      <arg>-H</arg>
      <arg>-L</arg>
      <arg>-P</arg>
    </group>
  </arg>
  <arg>-f</arg>
  <arg choice='plain'><replaceable>group</replaceable></arg>
  <arg rep='repeat' choice='plain'><replaceable>file</replaceable></arg>
</cmdsynopsis>

<cmdsynopsis>
  <command>emacs</command>
  <arg>-t <replaceable>file</replaceable></arg>
  <arg>-q</arg>
  <arg>-u <replaceable>user</replaceable></arg>
  <arg>+<replaceable>number</replaceable></arg>
  <arg rep='repeat'>-f <replaceable>function</replaceable></arg>
  <sbr/>
  <arg rep='repeat'>-l <replaceable>file</replaceable></arg>
  <arg rep='repeat' choice='plain'><replaceable>file</replaceable></arg>
</cmdsynopsis>

cd { directory }

cal [-j] [-y] [ month [year] ]

chgrp [ -R [ [-H] | [-L] | [-P] ] ] [-f] group file ...

emacs [ -t file ] [-q] [ -u user ] [ + number ] [ -f function ...]
[ -l file ...] file ...

命令参数可选项

<para>
The <option>-a</option> option on the <acronym>UNIX</acronym>
<command>ls</command> command or the <option>/r</option> option on the
<acronym>DOS</acronym> <command>attrib</command>
command, for example.
</para>

<synopsis>
ls <optional><option>-abcCdfFgilLmnopqrRstux1</option></optional>
   <optional>names</optional>
</synopsis>

The -a option on the UNIX ls command or the /r option on the DOS attrib command, for example.

				ls
				[
					-abcCdfFgilLmnopqrRstux1
				]
				[names]

终端输出

<para>
The output from the date command,
<computeroutput>Sun  Nov 16, 1997  21:03:29</computeroutput>,
uses fixed-width fields so that it can easily be parsed.
</para>

The output from the date command, Sun Nov 16, 1997 21:03:29 , uses fixed-width fields so that it can easily be parsed.

第 8 章 Lists 项目符号与编号

calloutlist, glosslist, itemizedlist, listitem, orderedlist, segmentedlist, simplelist, variablelist

1. itemizedlist 符号列表

itemizedlist

<itemizedlist>
	<listitem><para>item 1</para></listitem>
	<listitem><para>item 2</para></listitem>
	<listitem><para>item 3</para></listitem>
</itemizedlist>

item 1

item 2

item 3

<itemizedlist mark='opencircle'>
<listitem>
<para>
Item 1
</para>
</listitem>
<listitem override='bullet'>
<para>
Item 2
</para>
</listitem>
<listitem>
<para>
Item 3
</para>
</listitem>
</itemizedlist>

Item 1

Item 2

Item 3

2. orderedlist 编号列表

普通列表 orderedlist

<orderedlist>
	<title>普通列表</title>
	<listitem><para>列表内容 1</para></listitem>
	<listitem><para>列表内容 2</para></listitem>
	<listitem><para>列表内容 3</para></listitem>
</orderedlist>

有序列表可以指定序号形式（arabic，upperalpha，loweralpha，upperroman，lowerroman）

<orderedlist numeration="lowerroman">
	<listitem><para>One</para></listitem>
	<listitem><para>Two</para></listitem>
	<listitem><para>Three</para></listitem>
	<listitem><para>Four</para></listitem>
</orderedlist>

普通列表

列表内容 1

列表内容 2

列表内容 3

3. simplelist 简单列表

简单列表只是分行显示

例 8.1. SimpleList

<para>Here is a <tag>SimpleList</tag>, rendered inline:
<simplelist type='inline'>
<member>A</member>
<member>B</member>
<member>C</member>
<member>D</member>
<member>E</member>
<member>F</member>
<member>G</member>
</simplelist>
</para>

Here is a SimpleList , rendered inline: A, B, C, D, E, F, G

<para>Here is the same <tag>SimpleList</tag> rendered horizontally with
three columns:
<simplelist type='horiz' columns='3'>
<member>A</member>
<member>B</member>
<member>C</member>
<member>D</member>
<member>E</member>
<member>F</member>
<member>G</member>
</simplelist>
</para>

Here is the same SimpleList rendered horizontally with three columns:

A | B | C
D | E | F
G |  |

<para>Finally, here is the list rendered vertically:
<simplelist type='vert' columns='3'>
<member>A</member>
<member>B</member>
<member>C</member>
<member>D</member>
<member>E</member>
<member>F</member>
<member>G</member>
</simplelist>
</para>

Finally, here is the list rendered vertically:

A | D | G
B | E |
C | F |

4. variablelist 定义列表

定义列表主要用于名词解释

<variablelist>
  <title>A variable list</title>
  <varlistentry>
    <term>First term</term>
    <listitem>
      <para>Definition or explanation.</para>
    </listitem>
  </varlistentry>
  <varlistentry>
    <term>Second term</term>
    <listitem>
      <para>Definition or explanation.</para>
    </listitem>
  </varlistentry>
</variablelist>

A variable list

First term

Definition or explanation.

Second term

Definition or explanation.

<variablelist>
	<title>Font Filename Extensions</title>
	<varlistentry>
		<term>
			<filename>TTF</filename>
		</term>
		<listitem>
			<para>TrueType fonts.</para>
		</listitem>
	</varlistentry>
	<varlistentry>
		<term>
			<filename>PFA</filename>
		</term>
		<term>
			<filename>PFB</filename>
		</term>
		<listitem>
			<para>
				PostScript fonts.
				<filename>PFA</filename>
				files are common on
				<acronym>UNIX</acronym>
				systems,
				<filename>PFB</filename>
				files
				are more common on Windows systems.
			</para>
		</listitem>
	</varlistentry>
</variablelist>

Font Filename Extensions

TTF

TrueType fonts.

PFA , PFB

PostScript fonts. PFA files are common on UNIX systems, PFB files are more common on Windows systems.

5. segmentedlist

<segmentedlist>
	<segtitle>Name</segtitle>
	<segtitle>Occupation</segtitle>
	<segtitle>Favorite Food</segtitle>
	<seglistitem>
		<seg>Tux</seg>
		<seg>Linux mascot</seg>
		<seg>Herring</seg>
	</seglistitem>
	<seglistitem>
		<seg>Konqui</seg>
		<seg>The KDE Dragon</seg>
		<seg>Gnomes</seg>
	</seglistitem>
</segmentedlist>

Name: Tux

Occupation: Linux mascot

Favorite Food: Herring

Name: Konqui

Occupation: The KDE Dragon

Favorite Food: Gnomes

6. procedure 过程

procedure

<procedure>
	<title>A procedure</title>
	<step>
		<para>Do this.</para>
	</step>

	<step>
		<para>Then do this.</para>
	</step>

	<step>
		<para>And now do this.</para>
	</step>
</procedure>

<procedure>
  <title>A procedure</title>
  <step>
    <para>Step 1.</para>
  </step>
  <step>
    <para>Step 2.</para>
    <substeps>
      <step>
        <para>Substep a.</para>
      </step>
      <step>
        <para>Substep b.</para>
      </step>
    </substeps>
  </step>
  <step>
    <para>Step 3.</para>
  </step>
</procedure>

过程 8.1. A procedure

Do this.

Then do this.

And now do this.

过程 8.2. A procedure

Step 1.

Step 2.

Substep a.

Substep b.

Step 3.

7. question/answer 问答

<qandaset>
	<qandaentry>
		<question>
			<para>What are little boys made of?</para>
		</question>
		<answer>
			<para>Snips and snails and puppy dog tails.</para>
		</answer>
	</qandaentry>
	<qandaentry>
		<question>
			<para>What are little girls made of?</para>
		</question>
		<answer>
			<para>Sugar and spice and everything nice.</para>
		</answer>
	</qandaentry>
</qandaset>

7.1. | What are little boys made of?
| Snips and snails and puppy dog tails.
7.2. | What are little girls made of?
| Sugar and spice and everything nice.

<article xmlns='http://docbook.org/ns/docbook'>
    <title>Example qandaset</title>

    <qandaset defaultlabel='qanda'>
      <qandaentry>
        <question>
          <para>To be, or not to be?</para>
        </question>
        <answer>
   		    <para>That is the question.</para>
        </answer>
   	  </qandaentry>
    </qandaset>

</article>

问： | To be, or not to be?
答： | That is the question.

8. glosslist 注解

<article xmlns='http://docbook.org/ns/docbook'>
	<title>Example glosslist</title>

	<glosslist>
		<glossentry><glossterm>C</glossterm>
			<glossdef>
				<para>A procedural programming language invented by K&amp;R.</para>
			</glossdef>
		</glossentry>
		<glossentry><glossterm>Pascal</glossterm>
			<glossdef>
				<para>A procedural programming language invented by Niklaus Wirth.</para>
			</glossdef>
		</glossentry>
	</glosslist>

</article>

<glosslist>
	<glossentry>
		<glossterm>C</glossterm>
		<glossdef>
			<para>
				A procedural programming language invented by K&amp;R.
			</para>
		</glossdef>
	</glossentry>
	<glossentry>
		<glossterm>Pascal</glossterm>
		<glossdef>
			<para>
				A procedural programming language invented by Niklaus Wirth.
			</para>
		</glossdef>
	</glossentry>
</glosslist>

C

A procedural programming language invented by K&R.

Pascal

A procedural programming language invented by Niklaus Wirth.

9. glossary 术语表

<glossary><title>词汇表的例子</title>
	<glossdiv><title>E</title>

		<glossentry id="xml"><glossterm>Extensible Markup Language</glossterm>
			<acronym>XML</acronym>
			<glossdef>
			<para>关于XML的定义...</para>
			<glossseealso otherterm="sgml">
			</glossdef>
		</glossentry>

	</glossdiv>
</glossary>

引用

<glossterm linkend="xml">Extensible Markup Language</glossterm> is a new standard…

第 9 章 Table 表格

<table>
   <title>表格标题</title>
   <tgroup cols="2">
     <thead>
       <row>
          <entry>列标题1</entry>
          <entry>列标题2</entry>
       </row>
     </thead>
    <tbody>
       <row>
          <entry>列内容1</entry>
          <entry>列内容2</entry>
       </row>
       ...
    </tbody>
   </tgroup>
</table>

表 9.1. 表格标题

列标题1 | 列标题2
列内容1 | 列内容2

1. informaltable

<article xmlns='http://docbook.org/ns/docbook'>
<title>Example footnoteref</title>
<informaltable>
<tgroup cols='2'>
<tbody>
<row>
<entry>foo<footnote xml:id='fnrex1a'><para>A meaningless word</para></footnote></entry>
<entry>3<footnote xml:id='fnrex1b'><para>A meaningless number</para></footnote></entry>
</row>
     <row>
  <entry>bar<footnoteref linkend='fnrex1a'/></entry>
<entry>5<footnoteref linkend='fnrex1b'/></entry>
  </row>
</tbody>
</tgroup>
</informaltable>
</article>

foo [a] | 3 [b]
bar [a] | 5 [b]

[a] A meaningless word

[b] A meaningless number

第 10 章 图片，视频，音乐

1. figure

<figure><title>Notre Dame Cathedral</title>
	<graphic srccredit="Norman Walsh, 1998" fileref="figures/notredame.png"/>
</figure>

<figure>
 <title>My Image</title>
 <screenshot>
  <screeninfo>Sample GNOME Display</screeninfo>
  <graphic  format="png" fileref="myfile" srccredit="me">
  </graphic>
 </screenshot>
</figure>

2. mediaobject

<figure>
	<title>OpenOffice MS-compatible Spreadsheet</title>
	<mediaobject>
		<imageobject>
			<imagedata fileref="images/openoffice.png" format="PNG"></imagedata>
		</imageobject>
		<imageobject>
			<imagedata fileref="images/openoffice.eps" format="EPS"></imagedata>
		</imageobject>
		<textobject>
			<phrase>OpenOffice spreadsheet looks just like MS Office .xls file.</phrase>
		</textobject>
	</mediaobject>
</figure>

<mediaobject>
	<videoobject>
		<videodata fileref='movie.avi'/>
	</videoobject>
	<imageobject>
		<imagedata fileref='movie-frame.gif'/>
	</imageobject>
	<textobject>
		<para>This video illustrates the proper way to assemble an
		inverting time distortion device.
		</para>
		<warning>
			<para>
			It is imperative that the primary and secondary temporal
			couplings not be mounted in the wrong order. Temporal
			catastrophe is the likely result. The future you destroy
			may be your own.
			</para>
		</warning>
	</textobject>
</mediaobject>

3. imageobject

<article xmlns='http://docbook.org/ns/docbook'>
<title>Example imageobject</title>

<mediaobject>
  <imageobject condition="web">
    <imagedata fileref="figs/web/db5d_ref09.png" format="PNG" scale="70"/>
  </imageobject>
  <imageobject condition="print">
    <imagedata fileref="figs/print/db5d_ref09.pdf" format="PDF"/>
  </imageobject>
  <textobject>
    <phrase>The Eiffel Tower</phrase>
  </textobject>
  <caption>
    <para>Designed by Gustave Eiffel in 1889, The Eiffel Tower is one
          of the most widely recognized buildings in the world.
    </para>
  </caption>
</mediaobject>

</article>

4. 视频

<article xmlns='http://docbook.org/ns/docbook'>
<title>Example videoobject</title>

<mediaobject>
  <videoobject>
    <videodata fileref='movie.avi' autoplay="true" classid="com.example.player">
      <multimediaparam name="crossfade" value="false"/>
    </videodata>
  </videoobject>
  <imageobject>
    <imagedata fileref='movie-frame.gif'/>
  </imageobject>
  <textobject>
    <para>This video illustrates the proper way to assemble an
    inverting time distortion device.
    </para>
    <warning>
      <para>It is imperative that the primary and secondary temporal
      couplings not be mounted in the wrong order. Temporal
      catastrophe is the likely result. The future you destroy
      may be your own.
      </para>
    </warning>
  </textobject>
</mediaobject>

</article>

<article xmlns='http://docbook.org/ns/docbook'>
<title>Example videoobject</title>

<mediaobject>
  <videoobject>
    <videodata fileref='movie.ogg' autoplay="true" classid="com.example.player">
      <multimediaparam name="type" value="video/ogg"/>
    </videodata>
    <videodata fileref='movie.mp4' autoplay="true" classid="com.example.player">
      <multimediaparam name="type" value="vidoe/mp4"/>
    </videodata>
    <videodata fileref='movie.webm' autoplay="true" classid="com.example.player">
      <multimediaparam name="type" value="video/webm"/>
    </videodata>
  </videoobject>
  <imageobject>
    <imagedata fileref='movie-frame.gif'/>
  </imageobject>
  <textobject>
    <para>This video illustrates the proper way to assemble an
    inverting time distortion device.
    </para>
    <warning>
      <para>It is imperative that the primary and secondary temporal
      couplings not be mounted in the wrong order. Temporal
      catastrophe is the likely result. The future you destroy
      may be your own.
      </para>
    </warning>
  </textobject>
</mediaobject>

</article>

5. 插入音乐

<article xmlns='http://docbook.org/ns/docbook'>
<title>Example audioobject</title>

<mediaobject>
  <audioobject>
    <audiodata fileref="phaser.wav"/>
  </audioobject>
  <textobject>
    <phrase>A <trademark>Star Trek</trademark> phaser sound effect</phrase>
  </textobject>
</mediaobject>

</article>

6. screenshot

<figure id="app-FIG-shot1">
 <title>Screenshot</title>
 <screenshot>
  <mediaobject>
   <imageobject>
    <imagedata fileref="figures/example_screenshot.png" format="PNG"/>
   </imageobject>
   <textobject>
     <phrase>Shows the application screenshot with several buttons.</phrase>
   </textobject>
   <caption>
    <para>Screenshot of a program</para>
   </caption>
  </mediaobject>
 </screenshot>
</figure>

第 11 章 Admonition 警告与提示

caution, important, note, tip, warning

1. caution

<para><caution>Text goes here.</caution></para>

小心

Text goes here.

2. important

<para><important>Text goes here.</important></para>

重要

Text goes here.

3. note

<para><note>Text goes here.</note></para>

注意

Text goes here.

4. tip

<para><tip>Text goes here.</tip></para>

提示

Text goes here.

5. warning

<para><warning>Text goes here.</warning></para>

警告

Text goes here.

第 12 章 Computer terminal

1. literallayout

<literallayout>
1
2
3
</literallayout>

2. programlisting

<programlisting role="c">
#include &lt;stdio.h&gt;

int
main(void)
{
    printf("hello, world\n");
}
</programlisting>

<programlisting language="java">
</programlisting>

<programlisting linenumbering="numbered" startinglinenumber="12">

</programlisting>

<programlisting linenumbering="numbered" >
<?dbhtml linenumbering.everyNth="2" linenumbering.separator=" &gt;" linenumbering.width="2" ?>
<?dbfo linenumbering.everyNth="2" linenumbering.separator=" &gt;" linenumbering.width="2" ?>
<textobject><textdata  fileref="mycode.c" /></textobject>
</programlisting>

<example><title>My program listing</title>
  <programlisting><textobject><textdata
     fileref="mycode.c" /></textobject></programlisting>
</example>

Using XInclude for text inclusions
<example><title>My program listing</title>
  <programlisting><xi:include  href="mycode.c"  parse="text"
      xmlns:xi="http://www.w3.org/2001/XInclude"/></programlisting>
</example>

<programlisting linenumbering="numbered" startinglinenumber="12">
<![CDATA[
#include <stdio.h>

int main(void)
{
   printf("Hello, world!\n");
   return 0;
}
]] >
</programlisting>

<programlisting linenumbering="numbered" >
	<?dbhtml linenumbering.everyNth="2" linenumbering.separator=" &gt;" linenumbering.width="2"?>
	<?dbfo linenumbering.everyNth="2"   linenumbering.separator=" &gt;" linenumbering.width="2"?>
	<textobject><textdata  fileref="mycode.c" /></textobject>
</programlisting>

<?php

class foo
{
	private $bar;

	public function __construct($bar)
	{
		$this->bar = $bar;
	}

	/**
	 * getFoo
	 *
	 * Returns bar if $this->bar is foo else foo .. Oo ;D
	 *
	 * @return string
	 */
	public function getFoo()
	{
		if($this->bar == 'foo')
		{
			return 'bar';
		}
		else
		{
			return 'foo';
		}
	}
}

2.1. Callouts

<screen>
bash@host:~/cvs/newbiedoc$ ls -l
total 48
<co id="perm">drwxr-sr-x    2 jesse    jesse        4096 May  4 16:26 CVS<co id="cvs">
drwxr-sr-x    3 jesse    jesse        4096 Mar 29 03:29 dev
drwxr-sr-x    3 jesse    jesse        4096 Apr  8 19:31 general
drwxr-sr-x    3 jesse    jesse        4096 Apr  9 00:15 images
</screen>

<calloutlist>
   <callout arearefs="cvs">
      <para>
      This is the CVS directory.  CVS files are stored here.
      </para>
   </callout>

   <callout arearefs="perm">
      <para>
      These are the permissions for the CVS directory.
      </para>
   </callout>
</calloutlist>

3. userinput

ls -l $KDEDIR

<userinput><command>ls</command>
<option>-l</option>
<parameter>$<envar>KDEDIR<envar></parameter>
</userinput>

export $KDEDIR=/usr/local/kde

<userinput>
<command>export</command>
<parameter>$<envar>KDEDIR</envar>=<filename>
/usr/local/kde</filename></parameter></userinput>

4. Keyboard Input

<keycombo>
 <keycap>Ctrl</keycap>
 <keycap>Alt</keycap>
 <keycap>F1</keycap>
</keycombo>

<menuchoice>
 <shortcut>
  <keycombo><keycap>Ctrl</keycap><keycap>q</keycap></keycombo>
 </shortcut>
 <guimenuitem> Quit</guimenuitem>
</menuchoice>

5. filename

office.exe

第 13 章 Cross references (参见项)

1. link 内部链接

<link linkend="table">Table</link>
<link linkend="article-My-Article-sec"><quote>sec</quote></link>

<link linkend="font"><quote>font</quote></link>

<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN"
          "http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd">
<sect1>
	<title>Examples of <sgmltag>Link</sgmltag></title>

	<para>
	In this sentence <link linkend='nextsect'>this</link> word is
	hot and points to the following section.
	</para>

	<para>
	There is also a link to the section called
	<quote><link linkend='nextsect' endterm="nextsect.title"/></quote>
	in this sentence.
	</para>

	<sect2 id='nextsect'>
		<title id='nextsect.title'>A Subsection</title>

	<para>
	This section only exists to be the target of a couple of links.
	</para>

	</sect2>
</sect1>

2. ulink 外部链接

<ulink url="http://netkiller.hikz.com">homepage</ulink>

3. xreflabel / xref

<para  id="ChooseSCSIid"  xreflabel="choosing a SCSI id">The methods
for choosing a <acronym>SCSI</acronym> id are ...
</para>
...
<para>
See the paragraph on <xref  linkend="ChooseSCSIid"/>.
</para>

<para  id="ChooseSCSIid"  >The methods
for <phrase  id="SCSIxref">choosing a <acronym>SCSI</acronym> id</phrase>
are ...
</para>
...
<para>
See the paragraph on <xref  linkend="ChooseSCSIid"  endterm="SCSIxref"/>.
</para>

<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN"
          "http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd">
<book>
	<title>An Example Book</title>
<chapter id="ch01">
	<title>XRef Samples</title>
	<para>This paragraph demonstrates several features of<sgmltag>XRef</sgmltag>.</para>
	<itemizedlist>
		<listitem><para>A straight link generates the cross-reference text: <xref linkend="ch02"/>.</para></listitem>
		<listitem><para>A link to an element with an <sgmltag class="attribute">XRefLabel</sgmltag>:<xref linkend="ch03"/>.</para></listitem>
		<listitem><para>A link with an<sgmltag class="attribute">EndTerm</sgmltag>:<xref linkend="ch04" endterm="ch04short"/>.</para></listitem>
	</itemizedlist>
</chapter>

<chapter id="ch02">
  <title>The Second Chapter</title>
  <para>Some content here</para>
</chapter>

<chapter id="ch03" xreflabel="Chapter the Third">
  <title>The Third Chapter</title>
  <para>Some content here</para>
</chapter>

<chapter id="ch04">
  <title>The Fourth Chapter</title>
  <titleabbrev id="ch04short">Chapter 4</titleabbrev>
  <para>Some content here</para>
</chapter>
</book>

4. footnote 脚注

<article xmlns='http://docbook.org/ns/docbook'>
<title>Example footnote</title>

<para>An annual percentage rate (<abbrev>APR</abbrev>) of 13.9%<footnote>
5	<para>The prime rate, as published in the <citetitle>Wall Street
Journal</citetitle> on the first business day of the month,
plus 7.0%.
</para>
</footnote>
10	will be charged on all balances carried forward.
</para>

</article>

<para>During the installation of the product<footnote><para>In versions 2.3 and 2.4.</para> </footnote> you may see messages such as these. </para>

<para>
			An annual percentage rate (
			<abbrev>APR</abbrev>
			) of 13.9%
			<footnote>
				<para>
					The prime rate, as published in the
					<citetitle>Wall Street
						Journal
					</citetitle>
					on the first business day of the month,
					plus 7.0%.
				</para>
			</footnote>
			will be charged on all balances carried forward.
		</para>

During the installation of the product [1] you may see messages such as these.

An annual percentage rate ( APR ) of 13.9% [2] will be charged on all balances carried forward.

[1] In versions 2.3 and 2.4.

[2] The prime rate, as published in the Wall Street Journal on the first business day of the month, plus 7.0%.

5. lot — A list of the titles of formal objects (as tables or figures) in a document

	<lot>
		<title>List of Figures</title>
		<lotentry pagenum='5'>The Letters inside their boxes</lotentry>
		<lotentry pagenum='15'>Example figure produced by both TeX and troff</lotentry>
		<!-- ... -->
	</lot>

第 14 章 equation 公式

<equation>
  <title>Fermat's Last Theorem</title>
  <alt>x^n + y^n ≠ z^n ∀ n ≠ 2</alt>
  <mathphrase>
    x<superscript>n</superscript>+y<superscript>n</superscript>≠z<superscript>n</superscript>
    ∀ n ≠ 2
  </mathphrase>
</equation>

<informalequation>
  <alt>e^(pi*i) + 1 = 0</alt>
  <mediaobject>
    <imageobject condition="print"><imagedata fileref="figs/print/db5d_refeqn02.pdf"/></imageobject>
    <imageobject condition="web"><imagedata fileref="figs/web/db5d_refeqn02.png"/></imageobject>
  </mediaobject>
</informalequation>

公式 14.1. Fermat's Last Theorem

x n +y n ≠z n ∀ n ≠ 2

1. 引用latex公式

<para>
A presentation system using TeX as a back end might allow you to insert inline markup, such as <markup role="tex">$x^2$</markup>, using TeX syntax directly.
</para>

A presentation system using TeX as a back end might allow you to insert inline markup, such as $x^2$ , using TeX syntax directly.

部分 II. Tex

第 15 章 Document Tools

1. texlive - TeX Live: A decent selection of the TeX Live packages

sudo apt-get install texlive

1.1. 安装 XeTeX

http://zh.wikipedia.org/wiki/XeTeX

xeTex是与tex平级的，都是排版引擎，而xeLatex和Latex刚分别基于两者的宏包。不同的是xeTex支持Unicode, 可以直接支持中文。

XeLaTeX是使用LaTeX的排版引擎

install usage apt-get

http://scripts.sil.org/xetex

$ sudo apt-get install texlive-xetex lmodern
$ sudo apt-get install texlive-latex-extra texlive-latex-recommended

1.2. XeLaTeX

安装XeTeX后现在我们尝试创建一个PDF文档

演示怎么创建文档

\documentclass[12pt,a4paper]{article}
\usepackage{fontspec}
\usepackage{xunicode}
\usepackage{xltxtra}
\setmainfont[Mapping=tex-text]{WenQuanYi Micro Hei}
\begin{document}
\XeTeX 可以使用系统自带的字体，而不需要再另外生成。
\end{document}

xelatex a.tex

1.3. 安装字体

查看已经安装的字体

$ fc-list :lang=zh
/usr/share/fonts/truetype/droid/DroidSansFallbackFull.ttf: Droid Sans Fallback:style=Regular

安装字体，将字体复制到/usr/share/fonts目录中，然后运行下面的命令。

$ sudo mkdir /usr/share/fonts/windows
$ sudo cp /media/Windows/Fonts/{SIM,sim}* /usr/share/fonts/windows/

安装免费字体

$ sudo apt-get install xfonts-wqy ttf-wqy-microhei ttf-wqy-zenhei

更新字体

$ sudo mkfontscale
$ sudo mkfontdir
$ sudo fc-cache -fv

查看字体

$ fc-list :lang=zh
/usr/share/fonts/windows/msyh.ttf: Microsoft YaHei,微软雅黑:style=Regular,Normal,obyčejné,Standard,Κανονικά,Normaali,Normál,Normale,Standaard,Normalny,Обычный,Normálne,Navadno,Arrunta
/usr/share/fonts/windows/FZYTK.TTF: FZYaoTi,方正姚体:style=Regular
/usr/share/fonts/windows/STXIHEI.TTF: STXihei,华文细黑:style=Regular
/usr/share/fonts/windows/simhei.ttf: SimHei,黑体:style=Regular,Normal,obyčejné,Standard,Κανονικά,Normaali,Normál,Normale,Standaard,Normalny,Обычный,Normálne,Navadno,Arrunta
/usr/share/fonts/truetype/wqy/wqy-microhei.ttc: WenQuanYi Micro Hei,文泉驛微米黑,文泉驿微米黑:style=Regular
/usr/share/fonts/windows/simsun.ttc: NSimSun,新宋体:style=Regular
/usr/share/fonts/windows/simsun.ttc: SimSun,宋体:style=Regular
/usr/share/fonts/X11/misc/wenquanyi_10ptb.pcf: WenQuanYi Bitmap Song:style=Bold
/usr/share/fonts/truetype/wqy/wqy-zenhei.ttc: WenQuanYi Zen Hei,文泉驛正黑,文泉驿正黑:style=Regular
/usr/share/fonts/X11/misc/wenquanyi_12pt.pcf: WenQuanYi Bitmap Song:style=Regular
/usr/share/fonts/truetype/wqy/wqy-zenhei.ttc: WenQuanYi Zen Hei Sharp,文泉驛點陣正黑,文泉驿点阵正黑:style=Regular
/usr/share/fonts/windows/STXINWEI.TTF: STXinwei,华文新魏:style=Regular
/usr/share/fonts/X11/misc/wenquanyi_10pt.pcf: WenQuanYi Bitmap Song:style=Regular
/usr/share/fonts/windows/simkai.ttf: KaiTi,楷体:style=Regular,Normal,obyčejné,Standard,Κανονικά,Normaali,Normál,Normale,Standaard,Normalny,Обычный,Normálne,Navadno,Arrunta
/usr/share/fonts/X11/misc/wenquanyi_9pt.pcf: WenQuanYi Bitmap Song:style=Regular
/usr/share/fonts/truetype/droid/DroidSansFallbackFull.ttf: Droid Sans Fallback:style=Regular
/usr/share/fonts/X11/misc/wenquanyi_11pt.pcf: WenQuanYi Bitmap Song:style=Regular
/usr/share/fonts/windows/mingliu.ttc: PMingLiU,新細明體:style=Regular
/usr/share/fonts/windows/simfang.ttf: FangSong,仿宋:style=Regular,Normal,obyčejné,Standard,Κανονικά,Normaali,Normál,Normale,Standaard,Normalny,Обычный,Normálne,Navadno,Arrunta
/usr/share/fonts/windows/STFANGSO.TTF: STFangsong,华文仿宋:style=Regular
/usr/share/fonts/windows/msjh.ttf: Microsoft JhengHei,微軟正黑體:style=Normal,Regular,obyčejné,Standard,Κανονικά,Normaali,Normál,Normale,Standaard,Normalny,Обычный,Normálne,Navadno,Arrunta
/usr/share/fonts/X11/misc/wenquanyi_9ptb.pcf: WenQuanYi Bitmap Song:style=Bold
/usr/share/fonts/windows/STLITI.TTF: STLiti,华文隶书:style=Regular
/usr/share/fonts/windows/msjhbd.ttf: Microsoft JhengHei,微軟正黑體:style=Negreta,Bold,tučné,fed,Fett,Έντονα,Negrita,Lihavoitu,Gras,Félkövér,Grassetto,Vet,Halvfet,Pogrubiony,Negrito,Полужирный,Fet,Kalın,Krepko,Lodia
/usr/share/fonts/windows/STZHONGS.TTF: STZhongsong,华文中宋:style=Regular
/usr/share/fonts/windows/msyhbd.ttf: Microsoft YaHei,微软雅黑:style=Bold,Negreta,tučné,fed,Fett,Έντονα,Negrita,Lihavoitu,Gras,Félkövér,Grassetto,Vet,Halvfet,Pogrubiony,Negrito,Полужирный,Fet,Kalın,Krepko,Lodia
/usr/share/fonts/X11/misc/wenquanyi_11ptb.pcf: WenQuanYi Bitmap Song:style=Bold
/usr/share/fonts/windows/FZSTK.TTF: FZShuTi,方正舒体:style=Regular
/usr/share/fonts/windows/STSONG.TTF: STSong,华文宋体:style=Regular
/usr/share/fonts/windows/STXINGKA.TTF: STXingkai,华文行楷:style=Regular
/usr/share/fonts/windows/STHUPO.TTF: STHupo,华文琥珀:style=Regular
/usr/share/fonts/windows/SIMLI.TTF: LiSu,隶书:style=Regular
/usr/share/fonts/windows/kaiu.ttf: DFKai\-SB,標楷體:style=Regular
/usr/share/fonts/windows/ARIALUNI.TTF: Arial Unicode MS:style=Regular,Normal,obyčejné,Standard,Κανονικά,Normaali,Normál,Normale,Standaard,Normalny,Обычный,Normálne,Navadno,Arrunta
/usr/share/fonts/truetype/wqy/wqy-zenhei.ttc: WenQuanYi Zen Hei Mono,文泉驛等寬正黑,文泉驿等宽正黑:style=Regular
/usr/share/fonts/windows/SIMYOU.TTF: YouYuan,幼圆:style=Regular
/usr/share/fonts/truetype/wqy/wqy-microhei.ttc: WenQuanYi Micro Hei Mono,文泉驛等寬微米黑,文泉驿等宽微米黑:style=Regular
/usr/share/fonts/windows/mingliu.ttc: MingLiU_HKSCS,細明體_HKSCS:style=Regular
/usr/share/fonts/windows/STCAIYUN.TTF: STCaiyun,华文彩云:style=Regular
/usr/share/fonts/windows/mingliu.ttc: MingLiU,細明體:style=Regular
/usr/share/fonts/windows/STKAITI.TTF: STKaiti,华文楷体:style=Regular
/usr/share/fonts/X11/misc/wenquanyi_12ptb.pcf: WenQuanYi Bitmap Song:style=Bold

测试Unicode文件 xetex.tex

%!Tex Program = xelatex
\documentclass[a4paper]{article}
\usepackage{xltxtra}
\setmainfont[Mapping=tex-text]{WenQuanYi Micro Hei}
\begin{document}\pagestyle{empty}
\section{Unicode support}

\subsection{English}
All human beings are born free and equal in dignity and rights.

\subsection{Íslenska}
Hver maður er borinn frjáls og jafn öðrum að virðingu og réttindum.

\subsection{Русский}
Все люди рождаются свободными
и равными в своем достоинстве и
правах.

\subsection{Tiếng Việt}
Tất cả mọi người sinh ra đều được tự do và bình đẳng về nhân phẩm và
quyền lợi.

\subsection{简体中文}
每个人生来平等，享有相同的地位和权利。

\subsection{繁體中文}
每個人生來平等，享有相同的地位和權利。

\subsection{日本語}
すべての人間は自由であり、かつ、尊厳と権利とについて平等である。

\section{Legacy syntax}
When he goes---``Hello World!''\\
She replies—“Hello dear!”

\section{Ligatures}
\fontspec[Ligatures={Common, Historical}]{Linux Libertine O Italic}
\fontsize{12pt}{18pt}\selectfont Questo è strano assai!

\section{Numerals}
\fontspec[Numbers={OldStyle}]{Linux Libertine O}Old style: 1234567\\
\fontspec[Numbers={Lining}]{Linux Libertine O}Lining: 1234567

\end{document}

测试字体

\documentclass[12pt,a4paper]{article}
\usepackage{fontspec,xunicode,xltxtra}
\usepackage{titlesec}
\usepackage[top=1in,bottom=1in,left=1.25in,right=1.25in]{geometry}

\titleformat{\section}{\Large\xbsong}{\thesection}{1em}{}

\XeTeXlinebreaklocale "zh"
\XeTeXlinebreakskip = 0pt plus 1pt minus 0.1pt

\newfontfamily\song{Simsun (Founder Extended)}
\newfontfamily\bwei{FZBeiWeiKaiShu-S19S}
\newfontfamily\zbhei{FZZhanBiHei-M22T}
\newfontfamily\xzt{FZXiaoZhuanTi-S13T}
\newfontfamily\xbsong{FZXiaoBiaoSong-B05}
\newfontfamily\dbsong{FZDaBiaoSong-B06}
\newfontfamily\gulif{FZGuLi-S12T}
\newfontfamily\gulij{FZGuLi-S12S}
\newfontfamily\kai{FZKai-Z03}
\newfontfamily\hei{FZHei-B01}
\newfontfamily\whei{WenQuanYi Zen Hei}
\newfontfamily\fsong{FZFangSong-Z02}
\newfontfamily\lanting{FZLanTingSong}
\newfontfamily\boya{FZBoYaSong}
\newfontfamily\lishu{FZLiShu-S01}
\newfontfamily\lishuII{FZLiShu II-S06}
\newfontfamily\yao{FZYaoTi-M06}
\newfontfamily\zyuan{FZZhunYuan-M02}
\newfontfamily\xhei{FZXiHei I-Z08}
\newfontfamily\xkai{FZXingKai-S04}
\newfontfamily\ssong{FZShuSong-Z01}
\newfontfamily\bsong{FZBaoSong-Z04}
\newfontfamily\nbsong{FZNew BaoSong-Z12}
\newfontfamily\caiyun{FZCaiYun-M09}
\newfontfamily\hanj{FZHanJian-R-GB}
\newfontfamily\songI{FZSongYi-Z13}
\newfontfamily\hcao{FZHuangCao-S09}
\newfontfamily\wbei{FZWeiBei-S03}
\newfontfamily\huali{FZHuaLi-M14}
\setmainfont{FZLanTingSong}

\renewcommand{\baselinestretch}{1.25}

\begin{document}

\title{\whei XeTeX使用小结}
\author{\fsong 何勃亮}
\date{\kai2009年6月21日}

\maketitle

\section{简介}
以前使用CJK进行中文的排版，需要自己生成字体库，近日，出现了XeTeX，可以比较好的解决中文字体问题，不需要额外
生成LaTeX字体库，直接使用计算机系统里的字体。

\section{字体列表}
本文使用了大量本机自带的字体。

\begin{table}[htbp]
\caption{字体列表}

\centering
\begin{tabular}{|l|c|r|}
\hline
\hei 字体 & \hei 命令 & \hei 字体效果 \\
\hline
\kai 宋体 & \verb+\song+ & \song 宋体 \\
\kai 楷体 & \verb+\kai+ & \kai 楷体 \\
\kai 黑体 & \verb+\hei+ & \hei 黑体 \\
\kai 仿宋体 & \verb+\fsong+ & \fsong 仿宋体 \\
\kai 文泉驿黑体 & \verb+\whei+ & \whei 文泉驿黑体 \\
\kai 书宋体 & \verb+\ssong+ & \ssong 书宋体 \\
\kai 报宋体 & \verb+\bsong+ & \bsong 报宋体 \\
\kai 新报宋体 & \verb+\nbsong+ & \nbsong 新报宋体 \\
\kai 兰亭宋体 & \verb+\lanting+ & \lanting 兰亭宋体 \\
\kai 博雅宋体 & \verb+\boya+ & \boya 博雅宋体 \\
\kai 宋体一 & \verb+\songI+ & \songI 宋体一 \\
\kai 隶书 & \verb+\lishu+ & \lishu 隶书 \\
\kai 隶书二 & \verb+\lishuII+ & \lishuII 隶书二 \\
\kai 古隶简体 & \verb+\gulij+ & \gulij 古隶简体 \\
\kai 古隶繁体 & \verb+\gulif+ & \gulif 古隶繁体 \\
\kai 华隶书 & \verb+\huali+ & \huali 华隶书 \\
\kai 小标宋 & \verb+\xbsong+ & \xbsong 小标宋 \\
\kai 大标宋 & \verb+\dbsong+ & \dbsong 大标宋 \\
\kai 小篆体 & \verb+\xzt+ & \xzt 小篆体 \\
\kai 姚体 & \verb+\yao+ & \yao 姚体 \\
\kai 准圆 & \verb+\zyuan+ & \zyuan 准圆 \\
\kai 细黑一 & \verb+\xhei+ & \xhei 细黑一 \\
\kai 行楷书 & \verb+\xkai+ & \xkai 行楷书 \\
\kai 彩云体 & \verb+\caiyun+ & \caiyun 彩云体 \\
\kai 汉简书 & \verb+\hanj+ & \hanj 汉简书 \\
\kai 魏碑体 & \verb+\wbei+ & \wbei 魏碑体 \\
\hline
\end{tabular}
\end{table}

\end{document}

xelatex xetex.tex

1.4. LuaTeX

http://www.luatex.org/

sudo apt-get install texlive-luatex

1.5. FAQ

! LaTeX Error: File `fontspec.sty' not found.

$ texdoc fontsepc
Sorry, no documentation found for fontsepc.
If you are unsure about the name, try searching CTAN's TeX catalogue at
http://ctan.org/search.html#byDescription.

2. latex2html

install latex2html

sudo apt-get install latex2html

latex2html charset='utf-8'

<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=utf-8">

latex2html -html_version 4.0,gb18030,unicode index.latex

Icons

latex2html -local_icons index.latex

3. texi2html

$ sudo apt-get install texi2html

4. tex2page

install tex2page

sudo apt-get install mzscheme

reference http://docs.huihoo.com/homepage/shredderyin/tex2page/intro.html

5. CJK

CJK

$ sudo apt-get install texlive cjk-latex freetype1-tools
$ sudo apt-get install latex-cjk-all
$ sudo mkdir -p  /usr/share/texmf/fonts/tfm /usr/share/texmf/fonts/truetype

例 15.1. example.latex

\documentclass{article}
\usepackage{CJK}
\begin{document}
\begin{CJK*}{UTF8}{simsun}
中文
\end{CJK*}
\end{document}

生成html文件

latex2html -split 0 example.latex

Fonts

neo@master:~$ cd /usr/share/fonts/
neo@master:/usr/share/fonts$ cp -r /home/neo/Fonts .
neo@master:/usr/share/fonts$ sudo cp -r /home/neo/Fonts .

neo@master:/usr/share/fonts$ cd Fonts/
neo@master:/usr/share/fonts/Fonts$ sudo mkfontscale
neo@master:/usr/share/fonts/Fonts$ sudo mkfontdir
neo@master:/usr/share/fonts/Fonts$ sudo fc-cache

6. TeXstudio(LaTeX 编辑器)

http://texstudio.sourceforge.net/

第 16 章 编码转换

gb2312转utf-8

for f in `find .`; do [ -f $f ] && perl -MEncode -pi -e '$_=encode_utf8(decode(gb2312=>$_))' $f; done;

第 17 章 排版

选择A4纸

\documentclass[a4paper,12pt]{book}

设置页边距

Word中默认的页边距为 上边距=2.54cm, 下边距=2.54cm, 左边距=3.17cm, 右边距=3.17cm

\usepackage[top=1in,bottom=1in,left=1.25in,right=1.25in]{geometry}

我的习惯 2cm

\usepackage[top=20mm,bottom=20mm,left=20mm,right=20mm]{geometry}

第 18 章 文章的组成元素

标题

\title{文章的题目}
\author{作者姓名}
\date{2005/09/23}
\maketitle

abstract

\begin{abstract}
	put your abstract here...
\end{abstract}

目录

\tableofcontents

章节

\chapter{章的名称}
\section{节的名称}
\subsection{小节的名称}
\subsubsection{子节的名称}

索引

\printindex

参考文献

\begin{thebibliography}
\bibitem{}参考文献1
\bibitem{}参考文献2
\end{thebibliography}

例 18.1. article.latex

% This is a comment line

\documentclass{article}

\begin{document}

% Note to self:
%    I must change this title later!
\title{Hello World}

\author{Your Name\\
	Department of Computer Science\\
	Courant Institute, NYU}
\maketitle

\begin{abstract}
	...put your abstract here...
\end{abstract}

\section{First Section}
	...text...
\subsection{First subsection}
	...text...
\subsection{Second subsection}
	...text...
\section{Second Section}
	...text...

...and so on...
\end{document}

例 18.2. book.latex

% This is a comment line

\documentclass{article}

\begin{document}

% Note to self:
%    I must change this title later!
\title{Hello World}

\author{Your Name\\
	Department of Computer Science\\
	Courant Institute, NYU}
\maketitle

\begin{abstract}
	...put your abstract here...
\end{abstract}

\chapter{First Chapter}
	...text...
\section{First Section}
	...text...
\subsection{First subsection}
	...text...
\subsection{Second subsection}
	...text...

\chapter{Second Chapter}
	...text...
\section{Second Section}
	...text...

...and so on...
\end{document}

第 19 章 Fonts

you can have bold font, italics font, etc as follows:

{\bf This is in bold} and
{\it this is in italics}
and this is in default roman
{\rm as is this}.

1. Sizes

\tiny
\scriptsize
\footnotesize
\small
\normalsize
\large
\Large
\LARGE
\huge
\Huge

2. Styles

Here is a simple example that will probably show you all you need to know about bold, italics, and underlining.

When something is \emph{really}, \textbf{really} important, you can \underline{underline it}, \emph{italicize it}, \textbf{bold it}. If you \underline{\textbf{\emph{must do all three}}}, then you can nest them.

第 20 章 项目符号和编号

项目符号

\begin{itemize}
\item 我的第一个项目
\item 我的第二个项目
\item 我的第三个项目
\end{itemize}

项目编号

\begin{enumerate}
\item 我的第一个项目
\item 我的第二个项目
\item 我的第三个项目
\end{enumerate}

修改 \enumerate 的编号格式

\usepackage{enumerate}

然后enumerate环境就可以使用一个可选参数，像这样：

\begin{enumerate}[(a)]
\item $(p\rightarrow(q\rightarrow p))$;
\item $((q\lor r)\rightarrow((\neg r)\rightarrow q))$;
\end{enumerate}

[]里面的 (a) 出来的结果是 (a)(b)(c)(d)这样子的。还可以用如下的：
1，得到1,2,3,4....
i，得到i,ii,iii.....
I，得到I,II,III....
a，得到a,b,c,d.....
A，得到A,B,C,D....

还可以加各种修饰，比如
[Exer. i]，得到 Exer. i，Exer. ii，Exer. iii， Exer. iv，等等

你要的这种结果稍微麻烦一点，要把[]用花括号括起来
\begin{enumerate}[{[}1{]}]
\item $(p\rightarrow(q\rightarrow p))$;
\item $((q\lor r)\rightarrow((\neg r)\rightarrow q))$;
\end{enumerate}

无符号

\begin{description}
\item 我的第一个项目
\item 我的第二个项目
\item 我的第三个项目
\end{description}

\begin{description}
\item[(a)] First item...
\item[(b)] Second item...
\end{description}

第 21 章 表格

使用tabular 环境可以生成表格，见下面这个例子：

\begin{tabular}{|c|c|c|c|c|c|}
\hline\\
编号 & 姓名 & 性别 & 年龄 & 地址 & 电话号码\\
\hline\\
1    & 张三 & 男 & 45 & 重庆工学院 &12345678\\
\hline\\
2 & 李四 & 女 & 29 & 重庆杨家坪 & 654321\\
\hline
\end{tabular}

这里要注意了，我们在第一行中，有几个 c 就表示有几列， c 表示你的列是居中对齐的，如果你想居左或居右，请用 l 或 r 。

如果你的某行中的某一列是空的，你也要列出来，放个空格在那里就行了，你甚至可以什么都不放，在要空的那里前后各放一个 & 符号就行。

在这里看到，对齐是用& 来实现的，我们前面说过。竖线是用 c 两边的那些竖杠实现的，横线是用命令\hline来实现的。如果你不想要这些线，你可以把它们去掉。

第 22 章 图片

\documentclass[12pt]{article} 下面加入

\usepackage{graphicx}

插入图片

\includegraphics[width=0.8\textwidth]{fig1.eps}

\begin{figure}[htp]
    \begin{center}
        \includegraphics[width=450pt]{image/arch_02.png}
        \caption{描述文字}
        \label{fig:arch_02}
    \end{center}
\end{figure}

第 23 章 分割章节

main.tex

\documentclass{article}
\usepackage{amsmath}
\usepackage{CJK}
\begin{document}
\begin{CJK*}{GBK}{song}

\input{sec1.tex}
\include{sec2.tex}
\end{CJK*}

sec1.tex

\section{第一节}
恭承嘉惠兮，俟罪长沙。侧闻屈原兮，自沉汩罗。造托湘流兮，敬吊先生。

sec2.tex

\section{第一节}
贾生名谊，洛阳人也。年十八，以能诵诗属书闻于郡中。

第 24 章 参考文献

\begin{thebibliography}{}
\bibitem[Gelman et al., 2004]{Gelman} Gelman, A., Carlin, J. B., Stern, H. S. \& Rubin, D. B.
 (2004) Bayesian Data Analysis (Second Edition). \newblock Chapman \& Hall/CRC.
\end{thebibliography}
\clearpage
\end{document}

第 25 章 Markdown

http://daringfireball.net/projects/markdown/

1. 章节

			A First Level Header
			====================

			A Second Level Header
			---------------------

#数量从1到6个代表HTML中的 H1...H6

			# 这是 H1

			## 这是 H2

			###### 这是 H6

			# 这是 H1 #

			## 这是 H2 ##

			### 这是 H3 ###

2. 项目符号与编号

项目符号

			* Candy.
			* Gum.
			* Booze.

			+ Candy.
			+ Gum.
			+ Booze.

			- Candy.
			- Gum.
			- Booze.

编号

			1. Bird
			2. McHale
			3. Parish

3. 引用

块引用

> This is a blockquote with two paragraphs. Lorem ipsum dolor sit amet,
> consectetuer adipiscing elit. Aliquam hendrerit mi posuere lectus.
> Vestibulum enim wisi, viverra nec, fringilla in, laoreet vitae, risus.
>
> Donec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisse
> id sem consectetuer libero luctus adipiscing.

> This is the first level of quoting.
>
> > This is nested blockquote.
>
> Back to the first level.

4. Code

4.1. JSON

```json
{"nickname":"netkiller"}
```

5. 分割线

			* * *

			***

			*****

			- - -

			---------------------------------------

6. 连接

			This is [an example](http://example.com/ "Title") inline link.

			[This link](http://example.net/) has no title attribute.

7. 图片

			![Alt text](/path/to/img.jpg)

			![Alt text](/path/to/img.jpg "Optional title")

8. 字体格式

强调

			*single asterisks*

			_single underscores_

			**double asterisks**

			__double underscores__

9. 范例

第 26 章 Jekyll

http://jekyllrb.com/

1. 安装 Jekyll

1.1. Ubuntu

sudo apt-get install ruby jekyll

2. 创建 Jekyll 项目

$ jekyll new my-web-site
$ cd my-web-site
$ jekyll serve

http://192.168.4.7:4000/

3. permalink

_config.yml：配置permalink格式

permalink: /:year/:month/:day/:title

4. _post

样式

layout: post

标题

title:  "FreeBSD"

文章分类

categories: ebook

5. category / categories

使用Category进行文章分类

使用 {{ category | first }} 输出分类的名称
使用 {{ category | last | size }} 输出该分类下文章的数目
遍历 category.last 输出所有文章的信息，构建到该文章的索引目录

单一分类

---
layout: Template
title: Category Sample
category: computer
---

多个分类

---
layout: Template
title: Category Sample
categories: [linux, freebsd]
---

显示分类名称

{% for category in site.categories %}
	{{ category | first }}
{% endfor %}

{% for category in site.categories %}
	<h2>{{ category | first }}</h2> </span>{{ category | last | size }}</span>
	<ul class="arc-list">
		{% for post in category.last %}
		<li>{{ post.date | date:"%d/%m/%Y"}}<a href="{{ post.url }}">{{ post.title }}</a></li>
		{% endfor %}
	</ul>
{% endfor %}

第 27 章 Sphinx

http://sphinx-doc.org/

1. 安装 Sphinx

1.1. Ubuntu

$ sudo apt-get install python3-sphinx

2. 建立sphinx工程

运行sphinx-quickstart创建项目

$ sphinx-quickstart
Welcome to the Sphinx 1.2.2 quickstart utility.

Please enter values for the following settings (just press Enter to
accept a default value, if one is given in brackets).

Enter the root path for documentation.
> Root path for the documentation [.]: Sphinx

You have two options for placing the build directory for Sphinx output.
Either, you use a directory "_build" within the root path, or you separate
"source" and "build" directories within the root path.
> Separate source and build directories (y/n) [n]:

Inside the root directory, two more directories will be created; "_templates"
for custom HTML templates and "_static" for custom stylesheets and other static
files. You can enter another prefix (such as ".") to replace the underscore.
> Name prefix for templates and static dir [_]:

The project name will occur in several places in the built documentation.
> Project name: Neo
> Author name(s): Neo

Sphinx has the notion of a "version" and a "release" for the
software. Each version can have multiple releases. For example, for
Python the version is something like 2.5 or 3.0, while the release is
something like 2.5.1 or 3.0a1.  If you don't need this dual structure,
just set both to the same value.
> Project version:
* Please enter some text.
> Project version: 0.0.1
> Project release [0.0.1]:

The file name suffix for source files. Commonly, this is either ".txt"
or ".rst".  Only files with this suffix are considered documents.
> Source file suffix [.rst]:

One document is special in that it is considered the top node of the
"contents tree", that is, it is the root of the hierarchical structure
of the documents. Normally, this is "index", but if your "index"
document is a custom template, you can also set this to another filename.
> Name of your master document (without suffix) [index]:

Sphinx can also add configuration for epub output:
> Do you want to use the epub builder (y/n) [n]: y

Please indicate if you want to use one of the following Sphinx extensions:
> autodoc: automatically insert docstrings from modules (y/n) [n]: y
> doctest: automatically test code snippets in doctest blocks (y/n) [n]: y
> intersphinx: link between Sphinx documentation of different projects (y/n) [n]: y
> todo: write "todo" entries that can be shown or hidden on build (y/n) [n]: y
> coverage: checks for documentation coverage (y/n) [n]: y
> pngmath: include math, rendered as PNG images (y/n) [n]: y
> mathjax: include math, rendered in the browser by MathJax (y/n) [n]: y
Note: pngmath and mathjax cannot be enabled at the same time.
pngmath has been deselected.
> ifconfig: conditional inclusion of content based on config values (y/n) [n]: y
> viewcode: include links to the source code of documented Python objects (y/n) [n]: y

A Makefile and a Windows command file can be generated for you so that you
only have to run e.g. `make html' instead of invoking sphinx-build
directly.
> Create Makefile? (y/n) [y]: y
> Create Windows command file? (y/n) [y]: y

Creating file Sphinx/conf.py.
Creating file Sphinx/index.rst.
Creating file Sphinx/Makefile.
Creating file Sphinx/make.bat.

Finished: An initial directory structure has been created.

You should now populate your master file Sphinx/index.rst and create other documentation
source files. Use the Makefile to build the docs, like so:
   make builder
where "builder" is one of the supported builders, e.g. html, latex or linkcheck.

make 参数

$ make
Please use `make <target>' where <target> is one of
  html       to make standalone HTML files
  dirhtml    to make HTML files named index.html in directories
  singlehtml to make a single large HTML file
  pickle     to make pickle files
  json       to make JSON files
  htmlhelp   to make HTML files and a HTML help project
  qthelp     to make HTML files and a qthelp project
  devhelp    to make HTML files and a Devhelp project
  epub       to make an epub
  latex      to make LaTeX files, you can set PAPER=a4 or PAPER=letter
  latexpdf   to make LaTeX files and run them through pdflatex
  latexpdfja to make LaTeX files and run them through platex/dvipdfmx
  text       to make text files
  man        to make manual pages
  texinfo    to make Texinfo files
  info       to make Texinfo files and run them through makeinfo
  gettext    to make PO message catalogs
  changes    to make an overview of all changed/added/deprecated items
  xml        to make Docutils-native XML files
  pseudoxml  to make pseudoxml-XML files for display purposes
  linkcheck  to check all external links for integrity
  doctest    to run all doctests embedded in the documentation (if enabled)

第 28 章 pandoc - general markup converter

http://johnmacfarlane.net/pandoc/

1. Docbook to Markdown

pandoc -f docbook -t markdown -s howto.xml -o example.text

2. Markdown to HTML

pandoc -f markdown -t html5 -s example.md -o example.html

例 28.1. Makefile

PANDOC = pandoc
PANDOCOPTS = -f markdown -t html5
PREFIX=..
HTML := $(patsubst %.md,%.html,$(wildcard *.md))

all: $(HTML)

%.html: %.md
	$(PANDOC) $(PANDOCOPTS) -s $< -o $(PREFIX)/$@

clean:
	@rm -rf $(PREFIX)/*.html

rebuild : clean all

第 29 章 Hugo

https://gohugo.io/

第 30 章 写作团队的运作

前提条件： subversion 服务器一台,或者使用sf.net, github.com, code.google.com 等等提供的服务，团队人员需要懂得docbook以及配置docbook环境

1. Docbook 环境初始化

1.1. FreeBSD

# pkg_add -r vim
# pkg_add -r git
# pkg_add -r libxml2 libxslt
# pkg_add -r docbook-xsl

创建 book.xml

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE subject SYSTEM "/usr/local/share/xml/docbook/5.0/dtd/docbook.dtd">
<book>
    <bookinfo>
        <title>An Example Book</title>

        <author>
            <firstname>Your first name</firstname>
            <surname>Your surname</surname>
            <affiliation>
                <address>
                    <email>foo@example.com</email>
                </address>
            </affiliation>
        </author>

        <copyright>
            <year>2000</year>
            <holder>Copyright string here</holder>
        </copyright>

        <abstract>
            <para>If your book has an abstract then it should go here.</para>
        </abstract>
    </bookinfo>

    <preface>
        <title>Preface</title>

        <para>Your book may have a preface, in which case it should be placed
            here.</para>
    </preface>

    <chapter>
        <title>My first chapter</title>

        <para>This is the first chapter in my book.</para>

        <section>
            <title>My first section</title>

            <para>This is the first section in my book.</para>
        </section>

    </chapter>
</book>

生成文档

$ xsltproc /usr/local/share/xsl/docbook/xhtml/docbook.xsl book.xml > book.html

1.2. Ubuntu/Debian

$ sudo apt-get install docbook-xsl
$ sudo apt-get install xsltproc xmlto
$ sudo apt-get install make
$ sudo apt-get install git

创建 book.xml

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE subject SYSTEM "/usr/share/xml/docbook/schema/dtd/4.5/docbookx.dtd">
<book>
    <bookinfo>
        <title>An Example Book</title>

        <author>
            <firstname>Your first name</firstname>
            <surname>Your surname</surname>
            <affiliation>
                <address>
                    <email>foo@example.com</email>
                </address>
            </affiliation>
        </author>

        <copyright>
            <year>2000</year>
            <holder>Copyright string here</holder>
        </copyright>

        <abstract>
            <para>If your book has an abstract then it should go here.</para>
        </abstract>
    </bookinfo>

    <preface>
        <title>Preface</title>

        <para>Your book may have a preface, in which case it should be placed
            here.</para>
    </preface>

    <chapter>
        <title>My first chapter</title>

        <para>This is the first chapter in my book.</para>

        <section>
            <title>My first section</title>

            <para>This is the first section in my book.</para>
        </section>

    </chapter>
</book>

生成文档

$ xsltproc /usr/share/xml/docbook/stylesheet/docbook-xsl/xhtml/docbook.xsl book.xml > book.html

2. Subversion 版本控制

subversion 初始化

trunk

branches

releases

tags

svn co svn://127.0.0.1/document
cd project
mkdir trunk
mkdir tags
mkdir branches
mkdir releases
svn ci -m "Initialized empty subversion repository in your_project"

创建docbook文档，安排章节

将章节拆分成独立文件，并在主文档头部声明

	<!ENTITY chapter.system SYSTEM "chapter.system.xml">
	<!ENTITY chapter.system.harddisk SYSTEM "chapter.system.harddisk.xml">
	<!ENTITY chapter.network SYSTEM "chapter.network.xml">

完成后导入subversion的trunk中

创建版本分支

$ svn copy svn://netkiller.8800.org/document/trunk svn://netkiller.8800.org/document/branches/system
$ svn copy svn://netkiller.8800.org/document/trunk svn://netkiller.8800.org/document/branches/network

开始写作

我们假设jam负责system章节

checkout

$ svn checkout svn://netkiller.8800.org/document/branches/system

编辑文件

vim chapter.system.xml

校验XML

$ export DSSSL=/usr/share/xml/docbook/stylesheet/nwalsh/xhtml/chunk.xsl
$ xsltproc --stringparam html.stylesheet docbook.css ${DSSSL} book.xml

提交文件

$ svn ci -m "I have finished this chapter."

其他编辑人员操作类似checkout自己branche上的network章节等等

tags运作

当jam完成了指派的任务的第一个阶段后，可以创建一个tags

svn copy svn://netkiller.8800.org/document/branches/system svn://netkiller.8800.org/document/tags/system_phase_I

tags 一旦建立，以后不会在更改

然后jam可以在/document/branches/system继续写作

合并tags到主干

当tags完成后主编将其合并到trunk

svn merge svn://netkiller.8800.org/document/tags/system_phase_I

然后发行unstable版本，你也可以每天产生一个快照。等待用户反馈。

反馈结果由负责人在/document/branches/system上修改，等待下一次发布在下一个阶段。

发行文档

当一切OK时,我就可以把trunk 复制到 releases 中，随你怎命名。

$ svn copy svn://netkiller.8800.org/document/trunk svn://netkiller.8800.org/document/release/document_v1.0

这个版本/document/release/document_v1.0就可以提供给读者了。

3. GIT

配置GIT环境

git config --global user.name "Neo Chan"
git config --global user.email netkiller@msn.com

克隆仓库
git clone https://github.com/freebook/PHP.git

...
编辑文件
...

提交文件
git add *
git commit -a

推送文件
git push origin master

第 31 章 Asciidoctor - A fast text processor & publishing toolchain for converting AsciiDoc to HTML5, DocBook & more.

http://asciidoctor.org/

1. 安装环境

brew install asciidoctor

第 32 章 Calibre

1. ebook-convert

https://manual.calibre-ebook.com/generated/en/ebook-convert.html

PATH=$PATH:/Applications/calibre.app/Contents/MacOS
ebook-convert netkiller.epub netkiller.mobi