目录
表格清单
范例清单
目录
Docbook SGML,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
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.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>
例 2.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>
<?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>
<affiliation>
<shortaffil>IBM</shortaffil>
<jobtitle>Senior LAMP Engineer</jobtitle>
<orgname>ArborText, Inc.</orgname>
<orgdiv>Application Developement</orgdiv>
</affiliation>
<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>
<reference>
<title>Reference</title>
<refentry>
(The content here is shown in the Reference Entries appendix.)
</refentry>
</reference>
<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>
<revhistory> <!-- 出版紀錄,可以有很多版本。 -->
<revision> <!-- 某一版本 -->
<revnumber>1.0.0</revnumber> <!-- 版本編號 -->
<date>2006-11-14</date> <!-- 發佈出版日期 -->
<authorinitials></authorinitials> <!-- 作者簡稱識別 -->
<revremark></revremark> <!-- 版本發佈簡述 -->
</revision>
</revhistory>
<publisher> <!-- 出版者 -->
<publishername>广州市一方信息咨询有限公司</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>
<part> <title>Part</title> <chapter> <title>Chapter</title> </chapter> <chapter> <title>Chapter</title> </chapter> </part> <part> <title>Part</title> <chapter> <title>Chapter</title> </chapter> <chapter> <title>Chapter</title> </chapter> </part>
<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…
<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 <para> 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.
<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>
You can use the Bridgehead element to create a heading between paragraphs, without creating a new section or sub-section.
<para><literal>literal</literal></para>
literal
Code
<literal role="code">< ! [ CDATA [ code ] ] ></literal>
code
calloutlist, glosslist, itemizedlist, listitem, orderedlist, segmentedlist, simplelist, variablelist
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
orderedlist
<orderedlist> <listitem><para>列表内容 1</para></listitem> <listitem><para>列表内容 2</para></listitem> <listitem><para>列表内容 3</para></listitem> </orderedlist>
列表内容 1
列表内容 2
列表内容 3
例 10.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 |
<variablelist>
<title>A variable list</title>
<varlistentry>
<term>First term</term>
<listitem>
<para>Definition or explanation.</para>
</listitem>
</varlistentry>
<varlistentry>
<term>Second term</term>
<listitem>
<para>Definition or explanation.</para>
</listitem>
</varlistentry>
</variablelist>
A variable list
Definition or explanation.
Definition or explanation.
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>
Do this.
Then do this.
And now do this.
<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>
<figure> <title>My Image</title> <screenshot> <screeninfo>Sample GNOME Display</screeninfo> <graphic format="png" fileref="myfile" srccredit="me"> </graphic> </screenshot> </figure>
caution, important, note, tip, warning
<programlisting role="c">
#include <stdio.h>
int
main(void)
{
printf("hello, world\n");
}
</programlisting>
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>
<blockquote>
<para>
This text should be indented.
</para>
</blockquote>
This text should be indented.
目录
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
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
http://scripts.sil.org/xetex
$ sudo apt-get install texlive-xetex lmodern
test.tex
\documentclass[12pt,a4paper]{article}
\usepackage{fontspec}
\usepackage{xunicode}
\usepackage{xltxtra}
\setromanfont{AR PL ShanHeiSun Uni}
\begin{document}
\XeTeX 可以使用系统自带的字体,而不需要再另外生成。
\end{document}
xelatex a.tex
gb2312转utf-8
for f in `find .`; do [ -f $f ] && perl -MEncode -pi -e '$_=encode_utf8(decode(gb2312=>$_))' $f; done;
选择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}
标题
\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}
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}.
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.
项目符号
\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}
使用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来实现的。如果你不想要这些线,你可以把它们去掉。
\documentclass[12pt]{article} 下面加入
\usepackage{graphicx}
插入图片
\includegraphics[width=0.8\textwidth]{fig1.eps}