免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
楼主: haoji
打印 上一主题 下一主题

beamer制作幻灯片 [复制链接]

论坛徽章:
0
21 [报告]
发表于 2008-05-29 17:01 |只看该作者
19  The default font size

Beamer's default font size is 11 points. It is possible to set the default font size to any of 8, 9, 10, 11, 12, 14, 17, 20 on the \documentclass line. For instance, to set the default font to 14 points, do:

\documentclass[14pt]{beamer}

论坛徽章:
0
22 [报告]
发表于 2008-05-29 17:02 |只看该作者
20  The default text color

Beamer's normal text is black on white background. The following command in the preamble changes all normal text to purple:

\setbeamercolor{normal text}{fg=purple}


The fg in command above sets normal text's foreground color. It is also possible to set the normal text's background color. The background color of a slide is inherited from the normal text's background, therefore changing the normal text's background color amounts to changing the slide's background color. See  Setting the background to a solid color for an illustration.


Remark: Normal text is the text in the main body of a slide. A slide's header and footer are not normal text. The colors of those elements are controlled by the structure color. For instance, the following command changes slide titles (and several other things) to purple:

\setbeamercolor{structure}{fg=purple}


See the sections An image for a background and The structure color for illustrations.

论坛徽章:
0
23 [报告]
发表于 2008-05-29 17:04 |只看该作者
21  The structure font and font themes

Beamer's structure font determines the font for rendering a presentation's structural elements such as headers and footers and some titlepage entries.

The default structure font for most themes is a medium-weight, upright, sans-serif font. Here is the theme umbc2 rendered with Beamer's default structure font:
\documentclass[14pt]{beamer}
\usetheme{umbc2}
       






Let's change the structure font to italics. Note the changes in the titlepage and headers and footers of the slides.
\documentclass[14pt]{beamer}
\setbeamerfont{structure}{family=\rmfamily,shape=\itshape}
\usetheme{umbc2}
       






Here are a few more examples.

Slanted structure font:
\documentclass[14pt]{beamer}
\setbeamerfont{structure}{shape=\itshape}
\usetheme{umbc2}







Bold structure font:
\documentclass[14pt]{beamer}
\setbeamerfont{structure}{series=\bfseries}
\usetheme{umbc2}







Bold and italic structure font:
\documentclass[14pt]{beamer}
\setbeamerfont{structure}{family=\rmfamily,series=\bfseries,shape=\itshape}
\usetheme{umbc2}




Font themes

Beamer offers a predefined set of font options which affect not only the structural elements, but the normal text and mathematics. I will give only a few illustrations here. For a complete description of Beamer font themes you should read Beamer's documentation.

The font theme serif changes all document fonts to serif. This includes structure elements as well as normal text and (most of) mathematics.
\documentclass[14pt]{beamer}
\usefonttheme{serif}
\usetheme{umbc2}



As you see, \sin and \cos are still set in sans-serif. This appears to be a Beamer bug.




The option stillsansseriftext exempts the normal text from changing to serif:
\documentclass[14pt]{beamer}
\usefonttheme[stillsansseriftext]{serif}
\usetheme{umbc2}







The option stillsansserifmath exempts mathematics from changing to serif:
\documentclass[14pt]{beamer}
\usefonttheme[stillsansseriftext,stillsansserifmath]{serif}
\usetheme{umbc2}







The font theme structuresmallcapsserif changes many document elements to the smallcap font:
\documentclass[14pt]{beamer}
\usefonttheme{structuresmallcapsserif}
\usetheme{umbc2}
       



论坛徽章:
0
24 [报告]
发表于 2008-05-29 17:05 |只看该作者
22  Shrinking to make things fit

To squeeze a little extra material into a Beamer slide, you may specify a shrink-factor for that slide, as in:

\begin{frame}[shrink=5]
...
\end{frame}


This will scale down the contents of the slide by at least 5 percent, and more if needed, so that the contents fit completely within the slide.

For best results, you should specify a shrink factor as close to the needed amount as possible. If your specified value is inadequate, Beamer will issue a warning to let you know. Adjust the shrink factor so that the warning goes away. Otherwise the slide's horizontal spacing will not be optimal.

You should not abuse this feature -- a small amount of shrinkage may go unnoticed, but too much shrinkage can be visually unpleasant.

Instead of shrinking a slide, consider rewriting its contents or perhaps splitting it into two slides.

论坛徽章:
0
25 [报告]
发表于 2008-05-29 17:06 |只看该作者
23  Changing margin widths

The size of a Beamer slide is 128mm by 96mm. These dimensions are fixed and should not be changed.

It is permissible, however, to change the widths of the left and right margins. These are set to 1cm by default.

In the example below, we change the widths of the left and right margins to 6mm and 2mm, respectively.

\setbeamersize{text margin left=6mm}
\setbeamersize{text margin right=2mm}


It is possible to combine the two command into one:

\setbeamersize{text margin left=6mm, text margin right=2mm}

论坛徽章:
0
26 [报告]
发表于 2008-05-29 17:07 |只看该作者
24  All about colors

Beamer handles colors with the help of an external facility called xcolor8. Beamer loads xcolor by default; you don't need to load it explicitly. This makes the following named colors available:




Named colors from the dvips package

Xcolor can read an extended set of color names from the file /usr/share/texmf/tex/latex/graphics/dvipsnam.def


To make this extended set available to Beamer, invoke Beamer as:
\documentclass[xcolor=dvipsnames]{beamer}


Here is what the extended color set looks like:




Named colors from the SVG package

Xcolor can read an even a larger set of color names from the file9 /usr/local/share/texmf/tex/latex/xcolor/svgnam.def


To make this extended set available to Beamer, invoke Beamer as:
\documentclass[xcolor=svgnames]{beamer}


Here is what the SVG color set looks like:




A few of the SVG names are duplicates: Aqua = Cyan, Fuchsia = Magenta, Gray = Grey, DarkGray = DarkGrey, LightGray = LightGrey, SlateGray = SlateGrey, DarkSlateGray = DarkSlateGrey, LightSlateGray = LightSlateGrey, DimGray = DimGrey.

Blending colors

The xcolor package provides a means to mix any set of colors in desired proportions, just as you would mix colors in a paint store.

We specify a mix consisting of n percent from color A and (100-n) percent from color B as A!n!B. The expression A!n!B may be used wherever a color name is expected in Beamer. The expression A!n is a shorthand for A!n!white. Here are a few samples. (Read each row from left to right.)




See the xcolor documentation for more details.10

Defining your own colors

In addition to the mechanisms described in the previous sections, you may define colors using the \definecolor command, as documented in the LaTeX manual and made available by loading the color package.11

You specify a color by giving its RGB (Red Green Blue) components as decimal fractions in the interval 0 to 1 to \definecolor, as in:

\definecolor{mygold}{rgb}{0.85, 0.60, 0.00}


Then "mygold" may be used as any other color in LaTeX or Beamer. For instance:

This sentence is printed in "mygold".

This sentence is printed in "green!15!mygold".


See Colored text, highlights and boxes on how to use colors in your Beamer documents.





8 Xcolor's author is Uwe Kern. See http://www.ukern.de/tex/xcolor.html.

9 The file svgnam.def is distributed with xcolor.

10 On the department's machine you may view the documentation by doing:

    gv  /usr/local/share/texmf/doc/latex/xcolor/xcolor.PS &

11 The color package is loaded by Beamer by default. You don't need to load it separately.

论坛徽章:
0
27 [报告]
发表于 2008-05-29 17:08 |只看该作者
25  Colored text, highlights and boxes

Colored text in Beamer is produced using the standard LaTeX \textcolor command, as in:
\textcolor{blue}{This text is in blue}





Remark: The command \structure{This is a colored text} may be used to draw the specified text in the presentation's structure color. See Direct use of the structure color for details.

Text background color is set using the \colorbox command:
\colorbox{yellow}{This text is highlighted in yellow}




You may combine various color and font elements to achieve interesting results. For example:

\colorbox{yellow}{
    \textcolor{red}{
        \textbf{
            Bold text in red, highlighted in yellow
        }
    }
}




To enclose text in a bordered box:
    \fcolorbox{red}{yellow}{A yellow box with red border}




The border's thickness is controlled by the LaTeX variable \fboxrule. Let's set the border's thickness to 4 points:
\setlength{\fboxrule}{4pt}
\fcolorbox{red}{white}{A white box with a red border of thickness 4 points}




The separation between the border and the enclosed object is controlled by the LaTeX variable \fboxsep. Let's set the separation to zero:
\setlength{\fboxrule}{4pt}
\setlength{\fboxsep}{0pt}
\fcolorbox{red}{white}{A white box with a red border and separation of 0 points}







Also see UMBC boxes for fancier boxes that may contain text or math.

论坛徽章:
0
28 [报告]
发表于 2008-05-29 17:10 |只看该作者
26  Setting a slide's background

The background color of a Beamer slide is white by default. In the following example I will describe a few ways to change the default background.

Setting the background to a solid color

This example shows how to set the background to a light shade of pink:

% backgrounds-demo1.tex
\documentclass{beamer}
\usetheme{default}
\setbeamercolor{normal text}{bg=red!12}
\begin{document}

\begin{frame}
  \frametitle{Setting the background color}

\[
  \sum_{n=1}^\infty \frac{1}{n^2} = \frac{\pi^2}{6}
\]

\end{frame}

\end{document}





See the section Blending Colors for the meaning of the color specification red!12.




Gradient colors in the background

Gradually shaded backgrounds are possible as well. In the following example, the background varies from light red at the bottom to light yellow at the top.

% backgrounds-demo2.tex
\documentclass{beamer}
\usetheme{default}
\setbeamertemplate{background canvas}[vertical shading][bottom=red!20,top=yellow!30]
\begin{document}

\begin{frame}
  \frametitle{Setting the background color}

\[
  \sum_{n=1}^\infty \frac{1}{n^2} = \frac{\pi^2}{6}
\]

\end{frame}

\end{document}





Grid superimposed on background

An interesting effect may be achieved by superimposing a grid on the background:

% backgrounds-demo3.tex
\documentclass{beamer}
\usetheme{default}
\setbeamertemplate{background canvas}[vertical shading][bottom=red!20,top=yellow!30]
\setbeamertemplate{background}[grid][step=5mm,color=blue]
\begin{document}

\begin{frame}
  \frametitle{Setting the background color}

\[
  \sum_{n=1}^\infty \frac{1}{n^2} = \frac{\pi^2}{6}
\]

\end{frame}

\end{document}





An image for a background

The following example shows how to fill the background of a Beamer slide with the scaled version of an image using the command:12
\setbeamertemplate{background canvas}{...}


Note how I have changed the structure color and the default font color to achieve a reasonable contrast between text and background.

% backgrounds-demo4.tex
\documentclass[12pt]{beamer}
\usetheme{default}
\setbeamercolor{structure}{fg=green!30}
\setbeamercolor{normal text}{fg=green!30}
\setbeamertemplate{background canvas}{\includegraphics
        [width=\paperwidth,height=\paperheight]{alps.jpg}}
\begin{document}

\begin{frame}[t]
  \frametitle{Skiing in the Alps}

\begin{itemize}
  \item Check equipment
  \item Wear warm clothes
  \item Pack first-aid kit
  \item Good luck!
\end{itemize}

\end{frame}

\end{document}






Remark: The image file alps.jpg is not a part of Beamer; you need to supply an image of your own.


Remark: The aspect ratio of a Beamerslide is 4:3 therefore it's best if your background image has the same aspect ratio. Otherwise your image will be distorted when it's stretched to cover the slide from edge to edge.


Remark: To limit the background setting to a single slide, enclose the \setbeamertemplate{background canvas}{...} command in braces, as in:

{ % brace to limit the scope of \setbeamertemplate
\setbeamertemplate{navigation symbols}{}  % optionally hide naviation buttons
\setbeamertemplate{background canvas}{\includegraphics
        [width=\paperwidth,height=\paperheight]{alps.jpg}}
\begin{frame}[plain]
...
\end{frame}
} % closing brace

The [plain] option to \begin{frame} suppresses the drawing of any decorations that may be associated with the current theme.


Remark: Fancy background colors, shading and pictures may make your slides look pretty but they may also be distracting. Use your judgment to see if such devices are appropriate for your presentation.







12 I am indebted to Syed Irfan for correcting an earlier version of this document where I had "background" instead of "background canvas" in several places in this section.

论坛徽章:
0
29 [报告]
发表于 2008-05-29 17:11 |只看该作者
27  Acrobat Reader usage

Acrobat Reader usage under Linux

To use the Acrobat Reader to display the pdf file small.pdf on on your computer screen, do:

acroread small.pdf


On startup, the Acrobat Reader probably will display your slides in a small window for previewing.


To expand the slide to fill the entire screen, press Control-L.

To get out of the full-screen mode, press Control-L again.


Once in the full-screen mode, navigate among your slides using the following key bindings:
Next slide         Right Arrow
Previous slide         Left Arrow
Last slide         Control-Shift-PageDown
First slide         Control-Shift-PageUp
Previous viewed slide         Control-Left Arrow
Quit         Control-Q


The "Previous viewed slide" requires some explanation.

Suppose that you jump to the last slide by Control-Shift-PageDown. Then Control-Left Arrow will return you to the slide from which you jumped, because that is the "Previous viewed slide".

Additionally, in Navigating with hyperlinks we will see how to make out-of-sequence jumps from one slide to another, using hyperlinks. There, too, the Control-Left Arrow will be used to return to the "Previous viewed slide".


Remark: A very readable documentation of Acrobat Reader's features is available in its on-line help, accessible through the Help button on Acrobat Reader's menu bar.

Acrobat Reader usage on other systems

Acrobat Reader's key bindings may vary, depending on the operating systems.

I have not much experience with anything other than Linux therefore I cannot provide useful advice for other systems. Nevertheless, I have been told that under Windows the key for "Previous viewed slide" is Alt-Left Arrow. You may want to make note of that.

论坛徽章:
0
30 [报告]
发表于 2008-05-29 17:12 |只看该作者
28  Xpdf usage

Xpdf is a pretty good alternative to Adobe's Acrobat Reader. It has at least two advantages over Acrobat Reader:


It is particularly lightweight -- it starts up noticeably faster -- therefore repeated invocations are pretty painless.


It can re-load the current document. This is very useful during the development of Beamer slides. You can start up Xpdf on your document and put it in the background. Then as you edit your source file and update the resulting pdf file, you can update the display by typing "r" key in the Xpdf window. No need to exit and restart.


Xpdf's disadvantages are:

It is limited to platforms with the X Window System, It is does not run on Microsoft Windows. Therefore it is not as widely available as Adobe's Acrobat Reader. You just can't expect to walk up to a computer in a conference and expect to find Xpdf installed on it.

It is not possible to toggle between window mode and the full-screen mode in Xpdf. For full-screen mode, you need to start Xpdf with the -fullscreen option. See below for details.

There are some rough edges, literally, in certain elements displayed by Xpdf. Generally Adobe's Acrobat Reader produces a nicer looking output.


For these reasons, I use Xpdf while building a presentation and use the Acrobat Reader for presenting my slides to an audience.

Running Xpdf inside a window

To display the file small.pdf, do:

xpdf small.pdf


Navigate among your slides using the following key bindings:
Next slide         n or SpaceBar or PageDown
Previous slide         p or BackSpace or PageUp
Last slide         Control-End
First slide         Control-Home
Previous viewed slide         b
Re-load file         r
Quit         q




Remark: The "Previous viewed slide" was explained in the Acrobat Reader usage.


Remark: To get a complete list of Xpdf's key binding, click the question-mark button that appears along Xpdf window's bottom edge.

Running Xpdf in the full-screen mode

To display the file small.pdf in the full-screen mode, do:

xpdf  -fullscreen  small.pdf


Navigate among the slides with the same key binding that were described in the previous paragraph.

Advanced usage

Start up Xpdf with a command like "xpdf small.pdf" then resize the window using whatever hooks your window manager provides.

You will find out that the contents of the window remain at the original size -- they do not resize along with the window.

To tell Xpdf to resize the contents along with the window, invoke it as:

xpdf  -z page  small.pdf


This is pretty handy while you are developing your slides: you can use your window manager's "maximize" function to toggle between normal and maximized states to get a better view of the slides.

I see no reason for not using the -z page flag all of the time. Therefore I have aliased xpdf to "xpdf -z page" and I recommend that you do it too. How you define an alias depends on the unix shell that you use. At UMBC's Department of Mathematics and Statistics we use tcsh. Therefore edit the file .cshrc in your home directory and add the following line to it:

alias xpdf xpdf -z page


While you are editing your .cshrc, you might as well add the following lines:

alias xpdff xpdf -fullscreen
complete xpdff 'n/*/f:*.{pdf,PDF}/'


The first of these lines sets xpdff to be a an alias for "pdf -fullscreen", therefore you can now start a full-screen presentation by typing "xpdff small.pdf".

The second line tells tcsh that the newly created xpdff command expects files names ending in pdf or PDF. This is used when you hit the TAB key to complete a file name on the command line.

Where to get Xpdf

Xpdf is bundled with most Linux distributions. If for some reason you need to download, compile and install the package yourself, you can get the source from: http://www.foolabs.com/xpdf/.
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP