Beamer学习笔记

sunxphere posted @ 2010年3月11日 16:39 , 101 阅读
<p>这次的演讲全部用<a href="http://latex-beamer.sf.net">Beamer</a>重做,除主文件,样式文件外,根据演讲的主题的不同,分成了好几个文件,编译成PDF后,一共128页,没有什么炫的技术,但是相比以前花了N多心思做的PPT,看上去要专业很多。现在基本上能用<a href="http://mlsx.xplore.cn/tag/beamer" rel="tag nofollow" title="标签 beamer 下的日志">Beamer</a>做出我需要的简报了,也有一些学习的记录,贴出来和大家共享。</p> <p>使用<a href="http://mlsx.xplore.cn/tag/beamer" rel="tag nofollow" title="标签 beamer 下的日志">Beamer</a>,首先需要申明文档类型为<a href="http://mlsx.xplore.cn/tag/beamer" rel="tag nofollow" title="标签 beamer 下的日志">beamer</a>,最简单的当然是<br> documentclass{<a href="http://mlsx.xplore.cn/tag/beamer" rel="tag nofollow" title="标签 beamer 下的日志">beamer</a>}</p> <p>不过这样子的话,基本你编译不出PDF,即便能编译出来,那查看PDF时,也会报错。<br> <span></span><br> 它带来大量的可选参数,有些其实是必须的,特别是在中文环境下,我这里不再使用LaTeX-CJK宏,而是直接采取<a href="http://mlsx.xplore.cn/tag/xetex" rel="tag nofollow" title="标签 xetex 下的日志">XeTeX</a>方式编译,因此下面所讲,均是针对<a href="http://mlsx.xplore.cn/tag/xetex" rel="tag nofollow" title="标签 xetex 下的日志">XeTeX</a>-LaTeX环境编译的。</p> <p>我目前学到的参数有下面这些<br> documentclass[dvipdfm,dvipsnames,xcolor=pdflatex,table,handout,draft,red,compress]{<a href="http://mlsx.xplore.cn/tag/beamer" rel="tag nofollow" title="标签 beamer 下的日志">beamer</a>}<br> %dvipdfm是关键,否则要么编译通不过,要不生成的pdf无法打开<br> %xcolor=pdflatex选项使得xcolor宏包可以使用,表示xcolor的颜色驱动选择<br> %dvipsnames表示可以使用预定义的颜色名字,比如RoyaBlue<br> %table是告诉xcolor宏包colortbl宏包需要加载<br> %xcolor会自动加载,不需要手工显式调用<br> %handout 处理传单形式,加上这个参数后,overlay,也就是动画效果会去掉,比如你逐项显式的内容,会在一个PDF页面上显示。<br> %draft 草稿模式,在撰写的过程中,可以加入这个参数,主要加快编译速度,不过在我使用的过程,也发现了一些问题。因为draft模式会省去头,尾和侧边栏,所以 填写的地方显得大一些,当你按照这个宽度和高度撰写内容后,再去掉draft编译,就会发现很多内容看不到了,因为显示内容的面积变小了。<br> %red显示指定页面头,尾或侧边栏的颜色<br> %compress尽量压缩侧边栏</p> <p>接下来设定简报的风格,我用到了三个命令<br> usepackage{beamerthemesplit}<br> usetheme{Berkeley}<br> usecolortheme{dolphin}</p> <p>这些主题和颜色,你可以从$TEXMF/tex/latex/<a href="http://mlsx.xplore.cn/tag/beamer" rel="tag nofollow" title="标签 beamer 下的日志">beamer</a>/下找到,自带的主题还是比较多,不过我没有一一查看到底每一个主题是什么样子。</p> <p>接着调用fontspec包,这是<a href="http://mlsx.xplore.cn/tag/xetex" rel="tag nofollow" title="标签 xetex 下的日志">XeTeX</a>所必须的,用来设定你需要的字体<br> usepackage{fontspec}</p> <p>下载你可以设置字体了,<a href="http://mlsx.xplore.cn/tag/beamer" rel="tag nofollow" title="标签 beamer 下的日志">Beamer</a>默认使用Sans family字体,因此你至少需要设定Sans family字体,我一般使用下面的命令:<br> setsansfont{SimSun}<br> 当然你还可以设定一些其他字体,比如罗马字体<br> setromanfont{Times New Roman}</p> <p>从别的地方还看到有下面的字体设置方法,不过我很少使用<br> %设置字体时也可以直接用字体名,以下三种方式等同:<br> %setromanfont[BoldFont={黑体}]{宋体}<br> %setromanfont[BoldFont={SimHei}]{SimSun}<br> % setromanfont[BoldFont={&quot;[simhei.ttf]“}]{”[simsun.ttc]“}</p> <p>如果是撰写中文简报,还需要下面两行命令:<br> XeTeXlinebreaklocale “zh”  % 表示用中文的断行<br> XeTeXlinebreakskip = 0pt plus 1pt % 多一点调整的空间</p> <p>如果没有这两行,编译出来的PDF会很丑,当然这其实和<a href="http://mlsx.xplore.cn/tag/beamer" rel="tag nofollow" title="标签 beamer 下的日志">Beamer</a>无关,是<a href="http://mlsx.xplore.cn/tag/xetex" rel="tag nofollow" title="标签 xetex 下的日志">XeTeX</a>的问题,只要使用<a href="http://mlsx.xplore.cn/tag/xetex" rel="tag nofollow" title="标签 xetex 下的日志">XeTeX</a>,不管是用哪种文档样式,只要涉及到中文,均需要使用上面两行命令。</p> <p>现在可以开始撰写简报,首先使用我们熟悉的 itle,author,date定义必要的信息。然后针对每一个幻灯片,<a href="http://mlsx.xplore.cn/tag/beamer" rel="tag nofollow" title="标签 beamer 下的日志">Beamer</a>使用<br> egin{frame}<br> end{frame}<br> 来定义,几种绝大部分LaTeX的命令都可以使用。</p> <p>当然egin{frame}也可以带一些参数,我仅列出我使用到的</p> <p>egin{frame}[shrink=5]</p> <p>当frame的内容不能在单个frame下存放时,就会把文字大小缩至少指定数的百分比,不建议使用这个参数。</p> <p>egin{frame}[&lt; -&gt;]</p> <p>[&lt; -&gt;]会自动逐条显示内容,而不需要使用&lt;1-&gt;,&lt;2-&gt;这样的流水</p> <p>egin{frame}[fragile] / egin[containsverbatim]{frame}<br> 在<a href="http://mlsx.xplore.cn/tag/beamer" rel="tag nofollow" title="标签 beamer 下的日志">Beamer</a>文档样式下,verbatim环境不能直接使用,需要用到上面两个参数之间的一个,为了找到这个参数,花了不少时间。</p> <p>上面的情况,虽然可以使用verbatim环境了,但是如果在verbatim里使用中文还是看不到,需要使用到下面的命令:<br> makeatletter<br> defverbatim@font{sffamily} %如果使用roman字体族,将sffamily改成rmfamily<br> makeatother</p> <p>egin{frame}[allowframebreaks,allowdisplaybreaks]<br> 当一个frame过长时,会自动打破为成为多个frame,这个参数绝对有用,这个参数也花了我不少时间找到它。</p> <p>上面这些是不太容易从<a href="http://mlsx.xplore.cn/tag/beamer" rel="tag nofollow" title="标签 beamer 下的日志">Beamer</a>的手册中找到,所以列了出来,其他的一些功能,比如怎么设置动态效果呀,怎么插入图片呀,都从手册上能找到,而且也和LaTeX基本相同。</p> <p>另外,我在使用<a href="http://mlsx.xplore.cn/tag/beamer" rel="tag nofollow" title="标签 beamer 下的日志">Beamer</a>的过程中,还简单学会了用<a href="http://sourceforge.net/projects/pgf/">TiKZ</a>画图,比如我要解释Linux文件系统布局图,类似下面这样:</p> <p><img style="width:0px;height:12px" src="http://www.google.com/base_media?hl=en&amp;fact=12e&amp;size=3&amp;q=http://mlsx.xplore.cn/wp-content/uploads/200803/1206793358_4738f742.png&amp;dhm=d990db37" alt=""><br> 就可以使用下面的命令:</p> <div><div><pre style="font-family:monospace">egin<span>{</span><span style="color:rgb(34, 34, 208);font-weight:normal">tikzpicture</span><span>}</span><span>[</span><span style="color:rgb(34, 34, 208);font-weight:normal">auto,thick</span><span>]</span> ikzstyle<span>{</span><span style="color:rgb(34, 34, 208);font-weight:normal">node</span><span>}</span>=<span style="color:rgb(128, 128, 128);font-style:italic">%</span> <span>[</span><span style="color:rgb(128, 128, 128);font-style:italic">%</span> minimum size=10pt,<span style="color:rgb(128, 128, 128);font-style:italic">%</span> inner sep=0pt,<span style="color:rgb(128, 128, 128);font-style:italic">%</span> outer sep=0pt,<span style="color:rgb(128, 128, 128);font-style:italic">%</span> <span style="color:rgb(128, 128, 128);font-style:italic">
  • 无匹配
  • 无匹配

登录 *


loading captcha image...
(输入验证码)