选择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}
例 1.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}
例 1.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}
目录
例 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>
<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>
<revhistory> <!-- 出版紀錄,可以有很多版本。 -->
<revision> <!-- 某一版本 -->
<revnumber>1.0.0</revnumber> <!-- 版本編號 -->
<date>2006-11-14</date> <!-- 發佈出版日期 -->
<authorinitials></authorinitials> <!-- 作者簡稱識別 -->
<revremark></revremark> <!-- 版本發佈簡述 -->
</revision>
</revhistory>
<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…
strong
<para><emphasis role="strong">Note</emphasis></para>
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
例 2.3. 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 |
procedure
<procedure>
<step>
<para>Do this.</para>
</step>
<step>
<para>Then do this.</para>
</step>
<step>
<para>And now do this.</para>
</step>
</procedure>
<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>
<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>
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
例 3.1. example.latex
\documentclass{article}
\usepackage{CJK}
\begin{document}
\begin{CJK*}{UTF8}{simsun}
中文
\end{CJK*}
\end{document}
生成html文件
latex2html -split 0 example.latex
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