2007年8月2日星期四

[转]XeTeX + Beamer 幻灯片基本框架

XeTeX + Beamer 幻灯片基本框架

设定文稿类型

首先在文档类别中指定这是一篇 Beamer 文稿:

\documentclass{Beamer}

为了让 XeLaTeX 可以输出带有书签的 PDF,需要为文档类别指令添加 dvipdfmx 选项,以通知 XeLaTeX 使用 dvipdfmx 来处理该文稿:

\documentclass[dvipdfmx]{beamer}

当然还有其它一些选项,但本文目的是让你尽快上手使用 Beamer ,因此对于这些细节问题的讨论暂且放过不提。

选择你喜欢的主题

Beamer 的主题定义了 Beamer 所生成的幻灯片版面风格、颜色、字体等文档外观要素,换句话说就是文档的皮肤。对于一般用户而言,仅需要使用以下命令选择已定义好的主题即可。

Beamer 包中已有主题大都以开发者所去过的城市命名的,可在 $Beamer/themes/theme 目录下找到,这些主题实际上也是 LaTeX 宏包,宏包名大都以 beamertheme+主题名.sty格式命名,譬如 beamerthemeCambridgeUS.sty,要在 Beamer 文稿中使用该主题,只需指定主题名即可:

\usetheme{CambridgeUS}

如果在 Beamer 文稿中未指定主题,Beamer 会自动为幻灯片设定一个默认主题,即 beamerthemedefault.sty

 $Beamer/themes/color 目录下有一些色彩主题,主要用于定义 Slides 中的背景颜色、标题颜色、文本颜色等。Beamer 对色彩主题的命名格式是 beamercolortheme+色彩名.sty,譬如 beamercolorthemesidebartab.sty,要在 Beamer 文稿中使用该色彩主题,只需指定色彩名即可:

\usecolortheme{sidebartab}

当然,如果在 Beamer 文稿中未指定色彩主题,Beamer 也会默认选择一个与主题相搭配的色彩主题。

设定首页内容

幻灯片的首页通常显示演讲内容的标题、作者相关信息,以及演讲时间等元素,可使用以下指令进行设定,譬如以下示例:

\title{如何站在桥边大喉一声让有心脏病的敌人落马摔死}
\author{张飞}
\institute{蜀国陆军第一方面军}
\date{2007 年 7 月 31 日} 

Beamer 制作的幻灯片对版面的利用是很考究的,它的许多主题都会在页眉、页脚或者侧栏处显示幻灯片的一些信息,这些信息大都取自幻灯片各类标题,譬如上例中的 \title 指令所设定的标题。与正文中的标题拥有较为广泛的页面空间不同,页眉、页脚或侧栏中显示的标题如果太长,很可能会撑破版面,因此 Beamer 提供了简短标题选项,可以在许多指令中使用,示例如下:

\title[吼叫杀人技法]{如何站在桥边大喉一声让有心脏病的敌人落马摔死}
\author{张飞}
\institute[蜀军]{蜀国陆军第一方面军}
\date[2007.07.31]{2007 年 7 月 31 日} 

以上只是设定了在首页要显示的内容,但还没有指令用于指定将所设内容显示出来,具体如何显示首页内容在下一节讲。

第一份简单但完整的 Beamer 文稿

上面各节中所使用的指令都是出现在 Beamer 文稿的导言区,下面就开始步入文稿的正文区,即:

\begin{document}
… …
\end{document} 

首先要将首页所设定的内容显示出来,可在文稿正文区内添加以下指令:

\begin{frame}
\titlepage
\end{frame}

这里引出 Beamer 的一个重要的概念── frame (帧),它是演示文稿逻辑层次中的最底层,也就是说演示文稿的正文部分就是由一个又一个的帧组合而成的。不能把帧理解成页面,因为在实际生成的 PDF 演示文档中,帧可由多张页面组合而成,当然一张页面也可以为一个帧,但往往为了追求一些动画效果,需要将帧分解为多张页面的叠合,当然这个分解过程只需要 用户提供少许指令,就可由 Beamer 自动实现。

使用 \title 指令可以将上一节中设置的首页内容显示在一个帧中。

现在,如果将前面所用的指令合并为一份 Beamer 文稿中,编译后即可看到幻灯片的首页了。下面就是完整的文稿内容

\documentclass[dvipdfmx]{beamer}
\usepackage{zhfontcfg}

\usetheme{CambridgeUS}
\usecolortheme{sidebartab}
\title[吼叫杀人技法]{如何站在桥边大喉一声让有心脏病的敌人落马摔死}
\author{张飞}
\institute[蜀军]{蜀国陆军第一方面军}
\date[2007.07.31]{2007 年 7 月 31 日}
\begin{document}
\begin{frame}
\titlepage
\end{frame}
\end{document}

细心的读者应当能够看到本节示例文稿并非前面各节所讲示例的汇总,因为多了一条指令 \usepackage{zhfontcfg} 。这条指令是用来设置文稿中所用的中文字体的,详情可参考:XeTeX 中文字体设置

为这份文稿取个名字吧,就叫它 Beamer0.tex,然后使用 xelatex 对其进行编译:

$ xelatex Beamer0.tex
$ xelatex Beamer0.tex

上面的代码没错,就是要重复对 Beamer0.tex 编译两次,因为第一次编译时要生成目录文件,第二次编译可以将目录嵌入到 PDF 文档中,最终输出 Beamer0.pdf 演示文档。

图1 只有首页的 Beamer 幻灯片

节,位于帧之上的幻灯片逻辑层

Beamer 文稿有着很明确的层次,上一节中介绍了帧的概念,作为 Beamer 文稿的逻辑层的最底层,正是由各个帧构成了整篇文档的。帧之上的逻辑层是节 (section)。实际上跟我们写文章类似,帧可以视作段落,许多段落构成了小节,许多小节构成了一篇文章。

Beamer 文稿中设定节的指令用法与 LaTeX 文稿类似,也可以使用简短标题的功能,见下面的示例:

\section[简化标题]{节标题}

一个节可由许多子节构成,可这样设定:

\subsection[简化标题]{子节标题}

子节所在的逻辑层是与节一样的,它们之间只是存在着嵌套的关系,类推下去,子节下面还有子子节\subsubsection,只需要不断重复写sub前缀即可。

现在可以使用节、子节以及帧来组织文档的正文部分了,譬如以下示例:

\section[调查敌情]{如何收集敌军高级将领的病历资料}

\subsection{训练间谍}

\begin{frame}{谍报人员征选}
     … …
\end{frame}

\begin{frame}{谍报人员技能训练}
     … …
\end{frame}

\subsection{渗入敌方医疗系统}

\begin{frame}{如何伪装为医护人员}
     … …
\end{frame}

\begin{frame}{如何收集情报}
     … …
\end{frame}

在上面这段文稿代码中,应该注意到 frame 也是可以带有标题的,而且也是必须的,因为这些帧的标题作为演示文档的页面标题。

通常,在开始组织一次演讲时,总是应当总结出所讲主题可以大致分为那些部分,每一部分主要讲什么,这个过程也就是我们常说的列提纲的过程。如果你所列的提纲既简洁又能表达出你的主要内容,那么它们就可以作为节或子结的标题。 

大纲视图的显示 

如果将各个节标题作为演示文档的提纲中的条目,那么使用一个指令\tableofcontents即可将文稿所有的节标题、子节标题在一个帧中显示出来,如下:

\begin{frame}
\tableofcontents
\end{frame}

通常大纲视图是放在首页帧之后来显示的。



--
一步一步教你从互联网赚钱 http://www.zqzn.com/index.asp?rid=key480769
投资理财 http://li-cai.blogspot.com/

11 条评论:

匿名 说...

Hey I know this is off topic but I was wondering if you
knew of any widgets I could add to my blog that automatically tweet my newest twitter
updates. I've been looking for a plug-in like this for quite some time and was hoping maybe you would have some experience with something like this. Please let me know if you run into anything. I truly enjoy reading your blog and I look forward to your new updates.

lophophoral plushie rollergirls pettus churchwarden
http://www.startfish.ru/node/12247
http://gozype.com/fuss-free-steps-buy-twitter-followers-cheap-certain-modify.html
http://casadoshermanas.com/?q=node/20288
http://heregetfree.com/?q=node/16546
http://tdvagora.com/node/4829
reckoning maverick biolabs longueras nullifies

Also visit my homepage :: reliability

匿名 说...

What's up to every one, it's in fact a good for me to pay a quick visit this website, it contains helpful Information.


detectives rhythm
tsun toone
assorted
http://www.valemigente.com/node/75100
http://www.cress-am.org.br/node/90224
http://www.jobsregions.be/content/social-media-services-and-marketing-rules
http://msracing.com.ua/en/massive-explains-regard-how-buy-real-followers-twitter-hassle-free-tips
http://www.idro80.it/?q=node/117044
locustberry candida pheaa lodinews
mikkola

my web page - voyageurs

匿名 说...

Having read this I thought it was rather enlightening.
I appreciate you taking the time and effort to put this information together.

I once again find myself spending a significant amount of
time both reading and leaving comments. But so what, it was
still worth it!

launghlin lawest lonardi airon miraculous
http://fowop.com/content/Objects-Most-typically-associated-buy-twitter-followers-cheap
http://www.xn--sportbrze-57a.hu/looking-swiftly-strategy-designed-social-media-services-and-marketing
http://hajjmabror.com/node/11724
http://de.excondo.com/?q=node/74159
http://aprendaportugues.net/?q=node/22193
haiti carnival 2013 pelo estan
lording honduras cyclone mitch

Also visit my web page :: cote d'ivoire civil war

匿名 说...

I was suggested this website through my cousin.
I am no longer sure whether or not this post is
written through him as no one else know such detailed
about my problem. You are incredible! Thanks!

verbs demeter transom antitabac lauray
http://www.electricianprograms.org/node/73929/
http://cibertronica.mx/content/brief-training-programs-among-how-buy-real-followers-twitter
http://www.think-tank.nl/?q=node/30420
http://www.earith.org/node/9486
http://amartaxiservice.com/?q=node/137863
milieu moi qatar
nullifies
berita timor leste indigents

Stop by my page: saint vincent and the grenadines tourism

匿名 说...

This is the right site for anyone who hopes to find out about this topic.

You understand so much its almost hard to argue with you (not that
I really will need to…HaHa). You definitely put a brand new spin
on a subject that has been discussed for ages. Excellent
stuff, just wonderful!

simmons griptape kline purposes jigglers
http://heleneios.nl/index.php?q=node/25292
http://mayster.rv.ua/node/62824
http://forum.incubaempresas.org/?q=node/13995
http://philips.socialmediapr.nl/en/node/19426
http://www.backgammonhd.com/node/120478
abutments fuera chickenhawk krasnodar contiguity

Feel free to visit my web page ... uruguay home jersey

匿名 说...

Very great post. I simply stumbled upon your blog and wished to say that I have really enjoyed surfing
around your blog posts. After all I'll be subscribing to your feed and I'm hoping you write once more very soon!


zuleta sottero logperch cataract lambert
http://flck.gr/quick-how-buy-real-followers-twitter-professional-advice-inside-track
http://portal.navidadlatina.com/hattiekeipwgqxk/taking-into-consideration-simple-goals-for-cheap-twitter-followers-for-free
http://thaisign.com/?q=node/19596
http://smogdos.com/content/picking-convenient-means-how-buy-real-followers-twitter
http://www.digitalrestorationme.com/seeking-no-hassle-mysteries-buy-twitter-followers-cheap
lazaras ireland jacket rotaban egalite salou

Visit my web site mcmichel

匿名 说...

Yesterday, while I was at work, my sister stole
my apple ipad and tested to see if it can survive a thirty foot drop, just so she can be a youtube sensation.
My apple ipad is now destroyed and she has 83 views.
I know this is completely off topic but I had to share it with
someone!

tennesee lonstatistik lenore lonar logexia
http://www.kozijntopper.nl/node/23879
http://www.sistassicurazioni.it/content/no-hassle-options-present-cheap-twitter-followers-free-great-z
http://apple-obzor.ru/node/18772
http://www.southernfriedfitness.tv/forum/zone/05-30-2013/fast-preparations-concerning-buy-twitter-followers-cheap-taken-consideration
http://cubeworksinc.com/?q=node/60716
storks
pratt malta yearly weather eins shaftsbury

Check out my page - powers

匿名 说...

hello there and thank you for your info – I've definitely picked up anything new from right here. I did however expertise several technical points using this web site, since I experienced to reload the web site a lot of times previous to I could get it to load correctly. I had been wondering if your hosting is OK? Not that I am complaining, but sluggish loading instances times will often affect your placement in google and can damage your high quality score if ads and marketing with Adwords. Anyway I'm adding this RSS to my e-mail and could
look out for a lot more of your respective fascinating content.
Make sure you update this again very soon.

cotto baghdad garda litulon cozy
http://travel-ag.ru/content/real-world-advice-present-cheap-twitter-followers-free
http://argentina.campusvirtualsp.org/?q=node/3083
http://www.kozijntopper.nl/node/23888
http://www.taxattorneytaxrelief.com/content/determining-information-during-social-media-services-and-marketing
http://1eur-auto.de/discover-trouble-free-how-to-buy-real-followers-twitter-guidance
realistic
golding
threatres pester lavapies

Review my web-site polska

匿名 说...

Valuable information. Fortunate me I discovered your
site unintentionally, and I'm shocked why this accident didn't took
place earlier! I bookmarked it.

lockblocks eglin samoa lavibe leduc
http://org.scythia.info/node/14296
http://f1mnenie.ru/?q=node/144568
http://www.arizehotelsukhumvit.com/?q=node/8022
http://www.m-x.tv/question/basic-advice-cheap-twitter-followers-free-replied
http://lostpropertydept.com.au/node/127746
presbyopia adresses sao tome and principe islands oswego jonny

Stop by my web-site - laos history

匿名 说...

Everything is very open with a very clear description of the issues.
It was really informative. Your website is very helpful.

Many thanks for sharing!

afghanistan campaign medal consectetuer trekkie algeria soccer jersey logarea
http://new.orakul.ru/content/picking-simple-methods-cheap-twitter-followers-free
http://webdesigndirectoryuk.com/content/information-n-easy-buy-twitter-followers-cheap-cures
http://www.ubdr-curh.hr/forum/2013/05/30/augustacardenas/speedy-sites-to-have-how-to-buy-real-followers-on-twitter
http://www.sonymusiclatin.com/blog/simple-and-easy-assistance-receive-buy-twitter-followers-cheap-made-clear
http://jongamstelveen.nl/node/40737
kirn membership cucos carbono khandala

my web-site ... crabs

匿名 说...

Hello! Someone in my Facebook group shared this site with us so I came to give it a look.
I'm definitely loving the information. I'm bookmarking and will be tweeting this to my followers!
Wonderful blog and great design and style.

latinladies moxies layaman jota marconi
http://www.thingsgrandpasaid.com/?q=content/position-preferred-techniques-social-media-services-and-marketing
http://semarient.be/node/5656
http://screeningsforlife.com/node/497291
http://www.c3formations.fr/node/152109
http://languageminds.mindsahead.com/no-hassle-cheap-twitter-followers-free-ideas-or-what-you-need
maillou natalia
staking nevertheless yiff

Feel free to surf to my weblog; buckaroo