2024年2月22日发(作者:)
LaTex辅谈 LaTeX命令速查手册3+--+
|一个英文文档的例子|
+--+
一个英文文档的例子,保存为:*.tex
documentstyle{article}%使用article格式
topmargin=0pt%以下页面设置
oddsidemargin=0ptevensidemargin=0pt%
textwidth=14cm%
textheight=21cm%
%
title{This is asample ofLaTeX}%文章题目
author{Bigeyes(tt{**************})%作者.多行用
Department of Mathematics%
USTC,Anhui,Hefei,230026%
%
and%如有多作者,用and A_A%
thanks{Supported by.}%致谢,在author里
%
BBS of USTC%
[202.38.64.3]}%
date{Mar.1,1999}%日期,如果没有此项,
%则以当前日期代替,若
%不要日期,则用空{}
%
begin{document}%document开始.
%以上定义标题各项内容,
maketitle%此句产生标题,不可缺少,
%一般都是正文第一句
begin{abstract}%套用abstract格式
This is mini-page defined for abstract,%自动形成小页
you only write your abstract in %
you want to shows keywords,maybe you%
should use:%
{bf Keywords:}LaTeX,example%LaTeX没有keywords环境
end{abstract}%自己手工来做吧
%
section{The very beginning}%一个节,节的使用后详
This is the first section of your%
may find every first%一节的第一段缺省情况
paragraph of your section,s section,%为段首不自动缩进
chapter has no%
``parindent''at the beginning.%
This is the second paragrph,you can%但是以后的段段首
find this has parindent at the%自动缩进
you want to show%
parindent at first paragraph too,%
do as the first paragraph Ishowed%
in the next section.%
%
section{The 2nd step}%第二节,使用自动标号
hskipparindent%横向空出parindent This is the second
this%从这里大家看到
first paragraph,I use`hskip'to%parindent其实是
get the first you%一个长度单位,长
can get this effect by another way.%度单位后详
%
s section{S-sect of 2}%小节
this%
%
s section*{S 2.2 Another sof 2}%节,小节可以不使用
this%自动标号,这时有关
%的计数器不增加
section{Conclusion}%
I think you have knowTeX well now.%又是一节
I want to show you how to use%
the article,you%参考文献的
can use as``seecite{texbook}''.%引用方法cite{标识}
%
begin{thebibliography}{0}%参考文献列在这里
%{0}表示最长文献序号
%为一位数
%bibitem{标识}
%参考文献使用后详
bibitem{texbook}Donald~E.~Knouth,``TheTeX book'',
Add ison-Wesley,1984
bibitem{lamport}t,``LaTeX:
A Document Preparation System'',
Addison-Wesley,1994
bibitem{companion}M.~Goossens,F.~Millelbach,
and A.~Samarin,``TheLaTeXCompanion'',
Addison--Wesley,1994
end{thebibliography}
end{document}%document结束
+---+
|如何编辑、编译TeX文件|
+---+
我们已经讲过,TeX源文件是文本文件,就象一个C语言的源
文件一样,那么我们也象编译C语言程序得到可执行程序一样,我
们编译TeX源文件,以得到能在计算机上浏览或打印的格式文件,
那就是后缀为.DVI的文件(我们就称它为DVI文件).TeX源文件我
们通常把其后缀取为.TEX.当然,如果你在中文TeX的环境中编排
你的中文文章,那么你的源文件后缀可能就是那个中文TeX给你约
定的了,我们现在常用的CCT EMTEX,所用的后缀是.CTX,系统的
操作是将.CTX源文件中的中文经过预处理,产生标准的TeX文件,
然后再照平常的TeX文档一样操作,得到DVI文件.
今后,我们均以DOS下的CCT EMTEX环境为例,来讲述TeX文章
的编排.因为TeX的标准,所以在不同的TeX环境,其实文章编排
的内容格式是一样的,只是可能它得到DVI的途径不同而已.而我
们就以现在比较流行的LaTeX为准来讲述TeX的使用,其它如amstex,
amslatex等,仅是文档的最外层框架以及少数扩展的命令不大一
样之外,其它命令都是相同的.
一个最最简单的TeX文档可能是:(比如我们用EDIT,当然也
可以用写字板或UltraEdit等甚至是UNIX下的vi编辑器等编辑一个
文本文件如下四行,取名为'')
documentstyle{article}
begin{document}
my example content
end{document}
现在流行的TeX格式似乎已经不是documentstyle而是documentclass
了,但是它们除了一开始的写法不大一样之外,正文的命令排版
等等都没有任何区别.以CCT EMTEX环境为例,我们用'latex '
来编译TeX文件来得到DVI文件,然后用'view '来浏览,用
'dvi24p '(24针打)或'dviljp '(激打)来打印文章.
(以上三条命令的后缀均可以省去,仅用'latex 1','view 1'和
'dviljp 1'等.)
如果你的TeX文件不符合TeX语法,那编译将可能出错,这时
可以让系统忽略错误产生DVI文件(这时可能就不能达到你所期望
的排版效果了),或者你应该修改源文件中的错误,重新编译,直
到全部通过.在LaTeX编译出错时,会在屏幕上显示出错信息,并
显示"?"以接受用户进一步的指示.在"?"后,输入:
1.回车:LaTeX尽量忽略此错误,继续运行;
2.s:LaTeX继续运行,并之后还有错误,也不停止运行;
3.r:类似s,比上者更强硬,甚至连打不开文件这样的严重错误
也不停止;
4.q:同r,但错误及提示均不在屏幕显示,直接写入.LOG文件;
5.I:之后跟一个字符串,用来插入替代出错的字符串.比如在
正文需要纵向空出1cm空白,用"vskip 1cm",但是输入错误
成为"vship 1cm",则编译出错:
!Undefined control seq nce.
l.102vship 1cm
表示在第102行,vship是未定义的命令,这时在?后输入
"Ivskip",则用vskip替代出错的vship,继续执行.这里
需要注意的是,这条指令只是编译中临时修改错误,并没有
真正地修改源文件;
6.小于10的数:表示删出从当前位置开始的那么多个字符;
7.?:显示提示
8.h:显示帮助,对当前错误提出进一步动作的建议;
9.x:中断编译,将已编译的结果写入.DVI中,出错及提示写入
.LOG中.
+--+
|制作幻灯片|
+--+
xcolor宏包
usepackage[选项]{xcolor}
选项:
彩色驱动程序名:dvips,dvipdfm,pdftex
彩色模式:natural,rgb,cmyk,.
预定义色彩集合:dvipsnames,dvipsnames*,.
red,green,bl,yellow,cyan,magenta,black,white,orange,violet,purple,brown,pink,.
使用彩色
color{色彩名}--声明
textcolor{色彩名}{文本}--命令
pagecolor{色彩名}--声明,指定背景色(ps,pdf有效)
色彩名必须是已经有定义的
可以使用不同色彩的混合,如
color{green!40!yellow}--40%的绿色与60%的黄色混合
color{-green!40!yellow}上述颜色的补色
色彩混合公式:
C0!P1!C1!P2!.!PN!CN=?
另一种方法
color[色彩模式]{数据}
textcolor{色彩名}{数据}{文本}
pagecolor{色彩名}{数据}
例:
textcolor[rgb]{0.3,0.8,0.1}
textcolor[cmyk]{0.0,0.5,0.1,0.5}
definecolor{色彩名}{色彩模式}{数据}
providecolor{色彩名}{色彩模式}{数据}
色彩模式:rgb,cmyk,gray等
逗号分隔的十进制小数,表示每个分量的力度
如:definecolor{red}{rgb}{1,0,0}
definecolor{yellow}{cmyk}{0,0,1,0}
如色彩名已有定义,providecolor不起作用,definecolor覆盖原来的定义
彩色盒子
colorbox{色彩名}{文本}
fcolorbox{色彩一}{色彩二}{文本}
colorbox{色彩模式}{数据}{文本}
fcolorbox{色彩模式}{数据一}{数据二}{文本}
normalcolor:恢复正常色
使用pdfTeX dvipdfm--div转pdf dvipdfmx--dvipdfm的扩展
pdfTeX处理Plain TeX and AMS-TeX文件
pdfLaTeX处理LaTeX文件
直接生成pdf文件,可以增加一些LaTeX中没有的pdf功能
支持图片格式:pdf,png,jpg,tif,但不支持eps
建立书签:hyperref宏包
usepackage[选项]{hyperref}
usepackage[选项]{hyperref}
hypersetup{.}
例子:
usepackage[dvipdfmx,CJKbookmarks]{hyperref}
usepackage[dvipdfmx]{hyperref}
hypersetup{CJKbookmarks=tr}
hyperref宏包常用选项
驱动选项:dvipdfmx,dvips,pdftex,.
pdf属性:pdftitle,pdfauthor,pdfs iect,.
pdf打开方式:pdfstartview,pdfpagemode,.
书签:bookmarks,CJKbookmarks,bookmarksnumbered,bookmarksopen,.
链接属性:colorlinks,l inkcolor,citecolor,.
slides文档类:制作透明胶片
documentclass[选项]{slides}
字体较大,normalsize--20pt
缺省字体为sffamily
三种环境:slide,overlay,note pdfscreen宏包
usepackage[选项]{pdfscreen}
常用选项
screen:产生适合屏幕输出的pdf文件
print:输出打印版
panelleft,panelright,nopanel:设置导航面板
paneltoc:将目录放在导航面板上
sectionbreak:每节分页
导航面板配色方案:bl,gray,orange,.
pdfscreen宏包自动输入graphicx和color宏包
pdfscreen定制幻灯片命令(导言区)
screensize{高度}{宽度}:屏幕大小(必须)
margins{左}{右}{上}{下}:定义页边空白,overlay{pdf图形文件}:幻灯片背景
paneloverlay{pdf图形文件}导航面板背景
urlid{CRL地址}:设置主页链接地址
emblema{图形文件}:在导航面板加入图片
导航按钮:
bottombuttons,nobottombuttons
topbuttons
notopbuttons
按钮中文化
panelhomepagename:主页
paneltitlepagename:标题页
panelabstractname:摘要页
放在screensize前) (
panelcontentsname:目录页
panelgobackname:返回
panelfullscreename:全屏显示
panelclosename:关闭
panelquitname:退出
panelpagename,panelofname,panelofnamep slide环境
begin{slide}
.
end{slide}
一个slide环境生成一张幻灯片
页面过渡命令(需使用宏包texpower)
usepackage[display]{texpower}
pageTransitionBlindsH
pageTransitionBlindsV
pageTransitionSplitVI
pageTransitionDissolv e
pageTransitionSplitVO
pageTransitionSplitHI
pageTransitionSplitHO
pageTransitionGlitter{270}
+--+
|beamer宏包(最佳)|
+--+
是latex制作slide的一个文档类
用pdflatex编译,不需要其它后处理程序
同票latex结合度高
直观而方便的创建遮挡(overlays)
及其它各种漂亮的演示效果
利用theme实现内容和风格的独立,可以轻松的改变风格
在latex中使用beamer的一般步骤
将latex的文档类型从article改为beamer
用section和s section组织latex的文档结构
用frame环境制作独立的帧
执行pdflatex编译tex文件
beamer文档类
documentclass[11pt,CJK,compress]{beamer}
usetheme{Warsaw}
usecolortheme{lily}
.
幻灯片主体结构
section{.}%用于书签和导航条
s section{.}%用于书签和导航条
begin{brame}[选项]
frametitle{.}--帧的标题
s frametitle{.}--%帧的副标题
end{brame}
一个帧中可以包含覆盖,逐段显示内容
一个有用的选项:plain
标题页
begin{brame}[选项]
titlepage--生成标题页
end{brame}
标题,副标题,报告人,。
title{.}
s title{.}
author{.}
date{.}
institute{.}
titlegraphic{.}
目录页
begin{brame}[选项]
frametitle{Outline}
tableofcontents[选项]--生成目录
end{brame}
tableofcontents--逐段显示目录
hidealls sections,hideothers sections currentsection currents
section
若不想使用自动生成的目录,可以手工输入
中文支持-CJK宏包
中文模板
documentclass[CJK]{beamer}
.
usepackage{CJK}
.
begin{document}
begin{CJK}{GBK}{song}
.
end{CJK}
end{document}
beamer中的一些预定义环境
theorem,lemma,corollary,definition,.
Theorem(费马)
block环境--类似定理环境,可自选标题
begin{block}{标题}
.
end{block}
colums环境
begin{colums}{选项}
column{宽度}
.
column{宽度}
.
end{colums}
beamer中的罗列环境
应多使用罗列环境
可以嵌套使用,但通常不要超过2层
罗列条目的自动逐段显示
beamerdefaultoverlayspecification{+-}
手工指定逐段显示的内容:数字范围
如:3,-3,2-4,2-
抄录环境semiverbatim
begin{semiverbatim}
.
end{semiverbatim}
使用该环境,需在frame后加[fragile]或[containsverbatim]选项
,{,}仍然保持特殊含义
verbatim仍然可以使用
条目不同性质内容用newblock分隔
插入图片
incl?graphics[scale=0.5]{*.png}
插入多媒体:multimedia宏包
插入电影
movie[autostart]{}{*.wmv}
插入声音
sound[autostart]{}{*.wav}
插入logo
pgfdeclareimage[height=.8cm]{logo}{math}
logo{pgfuseimage{logo}}
在幻灯片右下角插入logo
幻灯片的切换
transblindshorizontal
transblindsvertical
transboxin
transboxout
transdissolve
transglitter
transsplithorizontalin
transsplitverticalin
transsplithorizontalout
transsplittverticalout
transwipe
导航图标
setbeamertemplate{navigation symbols}%{insert*navigationsymbol}
其中*可以为
slide,frame,s section,section,doc,backfindforward
多个导航图标,用逗号分隔
取消
setbeamertemplate{navigation symbols}{}
+--+
|beamer中动态时间和倒计时的最终解决办法|
+--+
摘自 pdflatex通过。不可以用web宏包,否则和beamer冲突。
颜色字体,时间格式等参数自己设。
有些要参考javascript,如时间格式。
documentclass[pdftex,8pt]{beamer}
mode{
usetheme{CambridgeUS}
useinnertheme{default}
usecolortheme{orchid}
usecolortheme{whale}
usefonttheme{default}
}
usepackage{pgf,pgfrcs,pgfarrows,pgfnodes,pgfautomata,pgfheaps,pgfshade}
usepackage{xcolor}
usepackage{amsmath,amssymb}
usepackage[latin1]{inputenc}
usepackage{colortbl}
usepackage[english]{babel}
usepackage{times}
usepackage{hyperref}
usepackage{graphicx}
usepackage[final]{pdfpages}
usepackage{textcomp}
usepackage{multicol}
%*
usepackage{eforms}
begin{insDLJS}{showtime}{Show time}
function tClock()
{ld("datetime").val=("hh:MM:ss tt
dd/mm/yyyy",new Date());
%参数可以自己改
}
var timeout=erval("tClock()",1000);
end{insDLJS}
%*
letoldfootnotefootnote
renewcommandfootnote[1]{oldfootnote{%
renewcommandbaselinestretch{1}%
largescriptsizeignorespaces#1}}
addtolength{footnotesep}{1pt}
setlength{abovecaptionskip}{2pt}
setlength{belowcaptionskip}{1pt}
makeatletter
newcommandfigcaption{def@captype{figure}caption}
newcommandtabcaption{def@captype{table}caption}
makeatother
setbeamertemplate{caption}[numbered]
usepackage[absolute,overlay]{textpos}
usepackage{tikz}
title[Title short]{Title long}
s title{S title stitle}%
author[authorshort]{large{authorlong}}%
institute[Schoolshort]{large{School of.}}%
%*
newcommand{timemark}%
{textField[BC{0.2 0.2 0.7}BG{0.2 0.2 0.7}%
textFont{TiRo}textSize{5}textColor{1 11
rg}]{datetime}{2cm}{4bp}}
%参数可以自己改
date[timemark]{today}%时间标签
%*
begin{document}
begin{frame}[plain]
titlepagepdfbookmark[1]{Title}{Titlepage}
end{frame}
setbeamercolor{frametitle}{fg=red}
section*{Outline}%
begin{frame}frametitle{Outline}
tableofcontents
end{frame}
section[Backgro]{Backgro}
s section{backgroundA}
begin{frame}
frametitle{backgroundA1}
backgroundA1text
end{frame}
begin{frame}
frametitle{backgroundA2}
backgroundA2 text
end{frame}
s section{backgroundB}
begin{frame}
frametitle{backgroundB1}
background1text
end{frame}
begin{frame}
frametitle{backgroundB2}
background2 text
end{frame}
section[Experimental]{Experimental}
s section{Experimental}
begin{frame}
frametitle{Experimental 1}
Experimental 1text
end{frame}
begin{frame}
frametitle{Experimental 2}
Experimental 2text
end{frame}
end{document}
倒计时
begin{insDLJS}{showtime}{Show time}
ttotal=120;%总时间自己设定
stotal=ttotal*60 function tClock()
{%ld("datetime").val=("hh:MM:ss tt
dd/mm/yyyy",new Date());
stotal=stotal-1 hleft=(stotal/3600)
mleft=((stotal-hleft*3600)/60)
sleft=stotal-hleft*3600-mleft*60
if(hleft=1){ld("datetime").val=hleft+':'+mleft+':'+sleft;}
else{ld("datetime").val=mleft+':'+sleft;}
}
var timeout=erval("tClock()",1000);
end{insDLJS}
特别声明:
1:资料来源于互联网,版权归属原作者
2:资料内容属于网络意见,与本账号立场无关
3:如有侵权,请告知,立即删除。


发布评论