Netkiller Docbook 手札

Docbook, EPUB and Latex

Mr. Neo Chan, 陈景峯(BG7NYT)

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

<netkiller@msn.com>

MMDVM Hotspot:

YSF80337 - CN China 1 - W24166/TG46001
 BM_China_46001 - DMR Radio ID 4600441

文档始创于2008-5-24

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

版权声明

转载请与作者联系，转载时请务必标明文章原始出处和作者信息及本声明。
http://www.netkiller.cn
http://netkiller.github.io
http://netkiller.sourceforge.net
微信订阅号 netkiller-ebook (微信扫描二维码）
QQ：13721218 请注明“读者”
QQ群：128659835 请注明“读者”

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

目录

自述
1. 系列文档
2. 作者简介
3. 写给读者
4. 文档下载
4.1. Netkiller 手札 (epub,kindle,chm,pdf) 下载
5. 打赏（Donations）
5.1. 微信（Wechat）
5.2. 支付宝（Alipay）
5.3. PayPal Donations
5.4. 银行(Bank)
I. Docbook
1. Open Document Licenses
2. Document Tools
2.1. SGML
2.2. XML 转换
2.2.1. xsltproc - XSLT command line processor
2.2.2. docbook-ebnf - EBNF module for the XML version of the DocBook DTD
2.2.3. docbook-xsl-saxon
2.3. XML 校验
2.4. PDF
2.5. CHM
2.6. docbook2odf - Convert docbook document to Oasis Open Document
2.7. docbook-website - XML Website DTD and XSL Stylesheets
2.8. EPUB
2.8.1. 创建.epub文件
2.8.2. Reader
2.9. Apple Mac
3. docbook-xsl
3.1. example
3.2. Docbook参数
3.3. 生成目录深度
3.4. 字符集
3.5. Filename prefix
4. DOCTYPE
4.1. SYSTEM
4.2. DTD 引用
4.2.1. 引用本地DTD
4.2.2. oasis-open.org
4.3. article
4.4. book
4.5. include
4.6. Docbook HTML 输出选项
4.6.1. 指定多页输出时html文档名
4.6.2. 指定输出路径
4.6.3. 包含HTML文件
4.6.4. 包含HTML节点
4.6.5. 图标
4.6.6. dbhtml-include
5. book / article
5.1. info
5.1.1. affiliation
5.1.2. address
5.1.3. reference
5.1.4. author
5.1.5. 出版信息
5.1.6. copyright
5.1.7. keyword
5.1.8. dedication
5.1.9. abstract
5.1.10. legalnotice
6. toc
7. topic
8. preface
9. Part / Chapter / Section
9.1. part
9.2. chapter
9.2.1. chapterinfo
9.2.2. epigraph
9.3. section
9.4. title
9.4.1. subtitle
9.4.2. titleabbrev
10. appendix
11. Paragraphs
11.1. para
11.2. simpara
11.3. formalpara
11.4. bridgehead
11.5. blockquote
11.6. sidebar
11.7. TM 商标
11.8. epigraph 题词
11.9. Font Formatting Codes
11.9.1. strong
11.9.2. bold
11.9.3. italic
11.9.4. literal
11.9.5. remark
12. Lists 项目符号与编号
12.1. itemizedlist
12.2. orderedlist
12.3. simplelist
12.4. variablelist
12.5. segmentedlist
12.6. procedure 过程
12.7. question/answer 问答
12.8. glosslist 注解
12.9. glossary 术语表
13. Table 表格
13.1. informaltable
14. Images 图片
14.1. figure
14.2. mediaobject
14.3. screenshot
15. Admonition 警告与提示
15.1. caution
15.2. important
15.3. note
15.4. tip
15.5. warning
15.6. footnote 脚注
16. Computer terminal
16.1. literallayout
16.2. programlisting
16.2.1. Callouts
16.3. userinput
16.4. Keyboard Input
17. Cross references
17.1. link
17.2. ulink
17.3. xreflabel / xref
18. Cross references
19. The DocBook HTML Forms Document Type
II. Tex
20. Document Tools
20.1. texlive - TeX Live: A decent selection of the TeX Live packages
20.1.1. 安装 XeTeX
20.1.2. XeLaTeX
20.1.3. 安装字体
20.1.4. LuaTeX
20.1.5. FAQ
20.2. latex2html
20.3. texi2html
20.4. tex2page
20.5. CJK
20.6. TeXstudio(LaTeX 编辑器)
21. 编码转换
22. 排版
23. 文章的组成元素
24. Fonts
24.1. Sizes
24.2. Styles
25. 项目符号和编号
26. 表格
27. 图片
28. 分割章节
29. 参考文献
30. Markdown
30.1. 章节
30.2. 项目符号与编号
30.3. 引用
30.4. Code
30.4.1. JSON
30.5. 分割线
30.6. 连接
30.7. 图片
30.8. 字体格式
30.9. 范例
31. Jekyll
31.1. 安装 Jekyll
31.1.1. Ubuntu
31.2. 创建 Jekyll 项目
31.3. permalink
31.4. _post
31.5. category / categories
32. Sphinx
32.1. 安装 Sphinx
32.1.1. Ubuntu
32.2. 建立sphinx工程
33. pandoc - general markup converter
33.1. Docbook to Markdown
33.2. Markdown to HTML
34. Hugo
35. 写作团队的运作
35.1. Docbook 环境初始化
35.1.1. FreeBSD
35.1.2. Ubuntu/Debian
35.2. Subversion 版本控制
35.3. GIT
36. Asciidoctor - A fast text processor & publishing toolchain for converting AsciiDoc to HTML5, DocBook & more.

表格清单

13.1. 表格标题

范例清单

4.1. article
4.2. book
12.1. SimpleList
20.1. example.latex
23.1. article.latex
23.2. book.latex
33.1. Makefile


自述

目录

1. 系列文档
2. 作者简介
3. 写给读者
4. 文档下载
4.1. Netkiller 手札 (epub,kindle,chm,pdf) 下载
5. 打赏（Donations）
5.1. 微信（Wechat）
5.2. 支付宝（Alipay）
5.3. PayPal Donations
5.4. 银行(Bank)

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

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

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

为什么写这篇文章

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

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

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

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

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

写作动力:

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

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

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

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

没有内容的章节:

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

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

我想到哪写到哪,你会发现文章没一个中心,今天这里写点,明天跳过本章写其它的.
文中例子绝对多,对喜欢复制然后粘贴朋友很有用,不用动手写,也省时间.
理论的东西,网上大把,我这里就不写了,需要可以去网上查.
我爱写错别字,还有一些是打错的,如果发现请指正.
文中大部分试验是在Debian/Ubuntu/Redhat AS上完成.

1. 系列文档

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

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），给女儿做了几首钢琴伴奏曲，并计划将小汤，大汤，巴斯蒂安，拜厄，车尔尼...制谱然后生成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中继板，树莓派，覆盖深圳湾，散步骑车通联两不误。

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

联系作者

http://netkiller.github.io/

http://netkiller.sourceforge.net/

Mobile: +86 13113668890

Callsign: BG7NYT QTH: Shenzhen, China, MMDVM：YSF China 1，TG4601

Email: netkiller@msn.com

MSN: netkiller@msn.com

ICQ: 101888222

QQ: 291379, 13721218

Yahoo/AIM/GTalk: bg7nyt

IRC: irc://irc.freenode.net /nickname netkiller or neo

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

Xbox club

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

CQ CQ CQ DE BG7NYT

写给火腿:

欢迎无线电爱好者和我QSO,我的QTH在深圳宝安区龙华镇溪山美地,设备YAESU FT-50R,FT-60R,FT-7800 144-430双段机, 拉杆天线/GP天线 Nagoya MAG-79EL-3W/Yagi

如果这篇文章对你有所帮助,请寄给我一张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 -10 Slot 1 Color 12

Blogger

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

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

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

ITEYE: http://netkiller-github-com.iteye.com

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

Twitter: http://twitter.com/bg7nyt

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

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

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

51CTO: http://bg7nyt.blog.51cto.com/|http://g.51cto.com/netkiller

pengyou: http://www.pengyou.com/netkiller

weibo: http://weibo.com/bg7nyt

163 Blog: http://t.163.com/netkiller


3. 写给读者

写给读者

欢迎提出宝贵的建议,如有问题请到 邮件列表 讨论

至读者：
我不知道什么时候，我不再更新文档或者退出IT行业去从事其他工作，我必须给这些文档找一个归宿，让他能持续更新下去。
我想捐赠给某些基金会继续运转，或者建立一个团队维护它。
我用了10年时间坚持不停地写作，持续更新，才有今天你看到的《Netkiller 手扎》系列文档，在中国能坚持10年，同时没有任何收益的技术类文档，是非常不容易的。
有很多时候想放弃，看到外国读者的支持与国内社区的影响，我坚持了下来。
中国开源事业需要各位参与，不要成为局外人，不要让外国人说：中国对开源索取无度，贡献却微乎其微。
我们参与内核的开发还比较遥远，但是进个人能力，写一些文档还是可能的。


4. 文档下载

HTML 格式

http://netkiller.github.com/home/technology.html

http://netkiller.sourceforge.net/home/technology.html

你可以使用镜像下载获得HTML文档，例如使用wget软件下载整个网站

                $ wget -m http://netkiller.github.io/index.html

指定下载

                $ wget -m http://netkiller.github.io/centos/index.html

CHM 格式电子文档下载

https://sourceforge.net/projects/netkiller/files/htmlhelp.chm/

PDF 格式

Download PDF Document 下载PDF文档1

Download PDF Document 下载PDF文档2

EPUB 格式

http://netkiller.sourceforge.net/technology.html

通过 GIT 镜像整个网站

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

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

其他方式

获得光盘介质，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.1. Netkiller 手札 (epub,kindle,chm,pdf) 下载

Netkiller 手札 2018版
Netkiller 手札 2017版
Netkiller 手札 2017版


5. 打赏（Donations）

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

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

5.1. 微信（Wechat）

5.2. 支付宝（Alipay）

5.3. PayPal Donations

https://www.paypal.me/netkiller

5.4. 银行(Bank)

招商银行(China Merchants Bank) 陈景峰 9555500000007459


部分 I. Docbook

目录

1. Open Document Licenses
2. Document Tools
2.1. SGML
2.2. XML 转换
2.2.1. xsltproc - XSLT command line processor
2.2.2. docbook-ebnf - EBNF module for the XML version of the DocBook DTD
2.2.3. docbook-xsl-saxon
2.3. XML 校验
2.4. PDF
2.5. CHM
2.6. docbook2odf - Convert docbook document to Oasis Open Document
2.7. docbook-website - XML Website DTD and XSL Stylesheets
2.8. EPUB
2.8.1. 创建.epub文件
2.8.2. Reader
2.9. Apple Mac
3. docbook-xsl
3.1. example
3.2. Docbook参数
3.3. 生成目录深度
3.4. 字符集
3.5. Filename prefix
4. DOCTYPE
4.1. SYSTEM
4.2. DTD 引用
4.2.1. 引用本地DTD
4.2.2. oasis-open.org
4.3. article
4.4. book
4.5. include
4.6. Docbook HTML 输出选项
4.6.1. 指定多页输出时html文档名
4.6.2. 指定输出路径
4.6.3. 包含HTML文件
4.6.4. 包含HTML节点
4.6.5. 图标
4.6.5.1. Admonition graphics
4.6.5.2. 导航图标
4.6.5.3. Callout icons
4.6.6. dbhtml-include
5. book / article
5.1. info
5.1.1. affiliation
5.1.2. address
5.1.3. reference
5.1.4. author
5.1.4.1. contrib
5.1.4.2. affiliation
5.1.4.3. editor
5.1.4.4. othercredit
5.1.5. 出版信息
5.1.5.1. publisher
5.1.5.2. printhistory
5.1.5.3. 出版紀錄
5.1.6. copyright
5.1.7. keyword
5.1.8. dedication
5.1.9. abstract
5.1.10. legalnotice
6. toc
7. topic
8. preface
9. Part / Chapter / Section
9.1. part
9.2. chapter
9.2.1. chapterinfo
9.2.2. epigraph
9.3. section
9.4. title
9.4.1. subtitle
9.4.2. titleabbrev
10. appendix
11. Paragraphs
11.1. para
11.2. simpara
11.3. formalpara
11.4. bridgehead
11.5. blockquote
11.6. sidebar
11.7. TM 商标
11.8. epigraph 题词
11.9. Font Formatting Codes
11.9.1. strong
11.9.2. bold
11.9.3. italic
11.9.4. literal
11.9.5. remark
12. Lists 项目符号与编号
12.1. itemizedlist
12.2. orderedlist
12.3. simplelist
12.4. variablelist
12.5. segmentedlist
12.6. procedure 过程
12.7. question/answer 问答
12.8. glosslist 注解
12.9. glossary 术语表
13. Table 表格
13.1. informaltable
14. Images 图片
14.1. figure
14.2. mediaobject
14.3. screenshot
15. Admonition 警告与提示
15.1. caution
15.2. important
15.3. note
15.4. tip
15.5. warning
15.6. footnote 脚注
16. Computer terminal
16.1. literallayout
16.2. programlisting
16.2.1. Callouts
16.3. userinput
16.4. Keyboard Input
17. Cross references
17.1. link
17.2. ulink
17.3. xreflabel / xref
18. Cross references
19. The DocBook HTML Forms Document Type

http://www.docbook.org/

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


第 1 章 Open Document Licenses

Creative Commons Attribution 3.0

GNU Free Documentation License

Open Publication License

The FreeBSD Documentation License


第 2 章 Document Tools

目录

2.1. SGML
2.2. XML 转换
2.2.1. xsltproc - XSLT command line processor
2.2.2. docbook-ebnf - EBNF module for the XML version of the DocBook DTD
2.2.3. docbook-xsl-saxon
2.3. XML 校验
2.4. PDF
2.5. CHM
2.6. docbook2odf - Convert docbook document to Oasis Open Document
2.7. docbook-website - XML Website DTD and XSL Stylesheets
2.8. EPUB
2.8.1. 创建.epub文件
2.8.2. Reader
2.9. Apple Mac

Docbook SGML,XML 转换程序

2.1. SGML

                sudo apt-get install docbook-utils

CentOS

                # yum install docbook*


2.2. XML 转换

docbook-xsl-1.73.2.tar.gz

docbook-dsssl-1.79.tar.gz

rxp - A validating XML parser

rxp -s file.xml

To validate file.xml, use the command:

$ rxp -s -V file.xml

2.2.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.2.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

2.2.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


2.3. XML 校验

                $ xmllint book.xml


2.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


2.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


2.6. docbook2odf - Convert docbook document to Oasis Open Document

                sudo apt-get install docbook2odf

                docbook2odf book.xml


2.7. 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


2.8. EPUB

2.8.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 *

2.8.2. Reader

http://calibre-ebook.com/


2.9. 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


第 3 章 docbook-xsl

目录

3.1. example
3.2. Docbook参数
3.3. 生成目录深度
3.4. 字符集
3.5. Filename prefix

3.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&amp;repo=netkiller.github.io&amp;type=watch&amp;count=true&amp;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&amp;repo=netkiller.github.io&amp;type=fork&amp;count=true&amp;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&amp;type=follow&amp;count=true&amp;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&amp;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>


3.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


3.3. 生成目录深度

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

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


3.4. 字符集

                --stringparam chunker.output.encoding UTF-8


3.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


第 4 章 DOCTYPE

目录

4.1. SYSTEM
4.2. DTD 引用
4.2.1. 引用本地DTD
4.2.2. oasis-open.org
4.3. article
4.4. book
4.5. include
4.6. Docbook HTML 输出选项
4.6.1. 指定多页输出时html文档名
4.6.2. 指定输出路径
4.6.3. 包含HTML文件
4.6.4. 包含HTML节点
4.6.5. 图标
4.6.5.1. Admonition graphics
4.6.5.2. 导航图标
4.6.5.3. Callout icons
4.6.6. dbhtml-include

4.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">


4.2. DTD 引用

4.2.1. 引用本地DTD

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

4.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" [
...
]>


4.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.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>


4.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>


4.6. Docbook HTML 输出选项

HTML output options

4.6.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

4.6.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

4.6.3. 包含HTML文件

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

4.6.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>

4.6.5. 图标

Docbook icon graphics

4.6.5.1. Admonition graphics

admon.graphics 1

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

4.6.5.2. 导航图标

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

4.6.5.3. 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).

4.6.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"/>


第 5 章 book / article

目录

5.1. info
5.1.1. affiliation
5.1.2. address
5.1.3. reference
5.1.4. author
5.1.4.1. contrib
5.1.4.2. affiliation
5.1.4.3. editor
5.1.4.4. othercredit
5.1.5. 出版信息
5.1.5.1. publisher
5.1.5.2. printhistory
5.1.5.3. 出版紀錄
5.1.6. copyright
5.1.7. keyword
5.1.8. dedication
5.1.9. abstract
5.1.10. legalnotice

5.1. info

bookinfo / articleinfo

5.1.1. affiliation

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

5.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>

5.1.3. reference

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

5.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>

5.1.4.1. contrib

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

5.1.4.2. 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>

5.1.4.3. 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>

5.1.4.4. 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>

5.1.5. 出版信息

5.1.5.1. publisher

<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>

5.1.5.2. printhistory

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

5.1.5.3. 出版紀錄

    <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>

5.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>

5.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>

5.1.8. dedication

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

5.1.9. abstract

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

5.1.10. legalnotice

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


第 6 章 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>


第 7 章 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>


第 8 章 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>


第 9 章 Part / Chapter / Section

目录

9.1. part
9.2. chapter
9.2.1. chapterinfo
9.2.2. epigraph
9.3. section
9.4. title
9.4.1. subtitle
9.4.2. titleabbrev

9.1. 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>


9.2. chapter

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

9.2.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>

9.2.2. 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>


9.3. section

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


9.4. title

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

9.4.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>

9.4.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>


第 10 章 appendix

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


第 11 章 Paragraphs

目录

11.1. para
11.2. simpara
11.3. formalpara
11.4. bridgehead
11.5. blockquote
11.6. sidebar
11.7. TM 商标
11.8. epigraph 题词
11.9. Font Formatting Codes
11.9.1. strong
11.9.2. bold
11.9.3. italic
11.9.4. literal
11.9.5. remark

11.1. para

<para>helloworld</para>


11.2. simpara

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

Just the text, ma'am.


11.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.


11.4. 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.


11.5. blockquote

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

This text should be indented.


11.6. sidebar

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

A Sidebar

Sidebar content.


11.7. TM 商标

<trademark>Microsoft</trademark>

Microsoft™


11.8. 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>

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

—William Safire


11.9. Font Formatting Codes

11.9.1. strong

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

Note

11.9.2. bold

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

11.9.3. italic

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

11.9.4. literal

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

literal

Code

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

11.9.5. remark

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

Some details are still a bit shaky


第 12 章 Lists 项目符号与编号

目录

12.1. itemizedlist
12.2. orderedlist
12.3. simplelist
12.4. variablelist
12.5. segmentedlist
12.6. procedure 过程
12.7. question/answer 问答
12.8. glosslist 注解
12.9. glossary 术语表

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

12.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


12.2. orderedlist

orderedlist

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

  1. 列表内容 1

  2. 列表内容 2

  3. 列表内容 3


12.3. simplelist

例 12.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 |


12.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>

<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>

A variable list

First term

Definition or explanation.

Second term

Definition or explanation.


12.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


12.6. procedure 过程

procedure

<procedure>
    <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>

  1. Do this.

  2. Then do this.

  3. And now do this.

过程 12.1. A procedure

  1. Step 1.

  2. Step 2.

    1. Substep a.

    2. Substep b.

  3. Step 3.


12.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>
12.7.1. What are little boys made of?
12.7.2. What are little girls made of?
12.7.1. | What are little boys made of?
 | Snips and snails and puppy dog tails.
12.7.2. | What are little girls made of?
 | Sugar and spice and everything nice.


12.8. glosslist 注解

<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.


12.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…


第 13 章 Table 表格

目录

13.1. informaltable

<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>

表 13.1. 表格标题

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

13.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


第 14 章 Images 图片

目录

14.1. figure
14.2. mediaobject
14.3. screenshot

14.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>


14.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>


14.3. 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>


第 15 章 Admonition 警告与提示

目录

15.1. caution
15.2. important
15.3. note
15.4. tip
15.5. warning
15.6. footnote 脚注

caution, important, note, tip, warning

15.1. caution

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

小心

Text goes here.


15.2. important

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

重要

Text goes here.


15.3. note

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

注意

Text goes here.


15.4. tip

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

提示

Text goes here.


15.5. warning

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

警告

Text goes here.


15.6. footnote 脚注

<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%.


第 16 章 Computer terminal

目录

16.1. literallayout
16.2. programlisting
16.2.1. Callouts
16.3. userinput
16.4. Keyboard Input

16.1. literallayout

<literallayout>
1
2
3
</literallayout>


16.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';
        }
    }
}

16.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>


16.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>


16.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>


第 17 章 Cross references

目录

17.1. link
17.2. ulink
17.3. xreflabel / xref

17.1. link

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

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


17.2. ulink

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


17.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>


第 18 章 Cross references

    <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>


第 19 章 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;


部分 II. Tex

目录

20. Document Tools
20.1. texlive - TeX Live: A decent selection of the TeX Live packages
20.1.1. 安装 XeTeX
20.1.1.1. install usage apt-get
20.1.2. XeLaTeX
20.1.3. 安装字体
20.1.4. LuaTeX
20.1.5. FAQ
20.1.5.1. ! LaTeX Error: File `fontspec.sty' not found.
20.2. latex2html
20.3. texi2html
20.4. tex2page
20.5. CJK
20.6. TeXstudio(LaTeX 编辑器)
21. 编码转换
22. 排版
23. 文章的组成元素
24. Fonts
24.1. Sizes
24.2. Styles
25. 项目符号和编号
26. 表格
27. 图片
28. 分割章节
29. 参考文献


第 20 章 Document Tools

目录

20.1. texlive - TeX Live: A decent selection of the TeX Live packages
20.1.1. 安装 XeTeX
20.1.1.1. install usage apt-get
20.1.2. XeLaTeX
20.1.3. 安装字体
20.1.4. LuaTeX
20.1.5. FAQ
20.1.5.1. ! LaTeX Error: File `fontspec.sty' not found.
20.2. latex2html
20.3. texi2html
20.4. tex2page
20.5. CJK
20.6. TeXstudio(LaTeX 编辑器)

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

sudo apt-get install texlive

20.1.1. 安装 XeTeX

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

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

XeLaTeX是使用LaTeX的排版引擎

20.1.1.1. 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

20.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

20.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

20.1.4. LuaTeX

http://www.luatex.org/

sudo apt-get install texlive-luatex

20.1.5. FAQ

20.1.5.1. ! 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.


20.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


20.3. texi2html

$ sudo apt-get install texi2html


20.4. tex2page

install tex2page

sudo apt-get install mzscheme

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


20.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

例 20.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


20.6. TeXstudio(LaTeX 编辑器)

http://texstudio.sourceforge.net/


第 21 章 编码转换

gb2312转utf-8

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


第 22 章 排版

选择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}


第 23 章 文章的组成元素

标题

\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}

例 23.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}

例 23.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}


第 24 章 Fonts

目录

24.1. Sizes
24.2. Styles

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}.

24.1. Sizes

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


24.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.


第 25 章 项目符号和编号

项目符号

\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}


第 26 章 表格

使用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来实现的。如果你不想要这些线，你可以把它们去掉。


第 27 章 图片

\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}


第 28 章 分割章节

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{第一节}
贾生名谊，洛阳人也。年十八，以能诵诗属书闻于郡中。


第 29 章 参考文献

\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}


第 30 章 Markdown

目录

30.1. 章节
30.2. 项目符号与编号
30.3. 引用
30.4. Code
30.4.1. JSON
30.5. 分割线
30.6. 连接
30.7. 图片
30.8. 字体格式
30.9. 范例

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

30.1. 章节

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

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

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

            # 这是 H1

            ## 这是 H2

            ###### 这是 H6

            # 这是 H1 #

            ## 这是 H2 ##

            ### 这是 H3 ###


30.2. 项目符号与编号

项目符号

            * Candy.
            * Gum.
            * Booze.

            + Candy.
            + Gum.
            + Booze.

            - Candy.
            - Gum.
            - Booze.

编号

            1. Bird
            2. McHale
            3. Parish


30.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.


30.4. Code

30.4.1. JSON

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


30.5. 分割线

            * * *

            ***

            *****

            - - -

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


30.6. 连接

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

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


30.7. 图片

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

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


30.8. 字体格式

强调

            *single asterisks*

            _single underscores_

            **double asterisks**

            __double underscores__


30.9. 范例


第 31 章 Jekyll

目录

31.1. 安装 Jekyll
31.1.1. Ubuntu
31.2. 创建 Jekyll 项目
31.3. permalink
31.4. _post
31.5. category / categories

http://jekyllrb.com/

31.1. 安装 Jekyll

31.1.1. Ubuntu

sudo apt-get install ruby jekyll


31.2. 创建 Jekyll 项目

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

http://192.168.4.7:4000/


31.3. permalink

_config.yml：配置permalink格式

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


31.4. _post

样式

layout: post

标题

title:  "FreeBSD"

文章分类

categories: ebook


31.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 %}


第 32 章 Sphinx

目录

32.1. 安装 Sphinx
32.1.1. Ubuntu
32.2. 建立sphinx工程

http://sphinx-doc.org/

32.1. 安装 Sphinx

32.1.1. Ubuntu

$ sudo apt-get install python3-sphinx


32.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)


第 33 章 pandoc - general markup converter

目录

33.1. Docbook to Markdown
33.2. Markdown to HTML

http://johnmacfarlane.net/pandoc/

33.1. Docbook to Markdown

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


33.2. Markdown to HTML

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

例 33.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


第 34 章 Hugo

https://gohugo.io/


第 35 章 写作团队的运作

目录

35.1. Docbook 环境初始化
35.1.1. FreeBSD
35.1.2. Ubuntu/Debian
35.2. Subversion 版本控制
35.3. GIT

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

35.1. Docbook 环境初始化

35.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

35.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


35.2. Subversion 版本控制

  1. subversion 初始化

    1. trunk

    2. branches

    3. releases

    4. 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"

  2. 创建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中

  3. 创建版本分支

    $ 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

  4. 开始写作

    我们假设jam负责system章节

    1. checkout

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

    2. 编辑文件

      vim chapter.system.xml

    3. 校验XML

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

    4. 提交文件

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

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

  5. 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继续写作

  6. 合并tags到主干

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

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

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

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

  7. 发行文档

    当一切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就可以提供给读者了。


35.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


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

http://asciidoctor.org/