免费注册 查看新帖 |

Chinaunix

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

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

论坛徽章:
0
11 [报告]
发表于 2008-05-29 16:49 |只看该作者
9  The UMBC footline

The Beamer outer theme umbcfootline puts footer information along the bottom edges of slides. The default footline looks like this:




where n is the sequence number of this frame and N is the total number of frames.

The fields Author, Institute, Title and Subtitle are filled with the data supplied by the \author, \institute, \title and \subtitle commands. Short versions of these entries are used, if provided, otherwise long versions are used. See Titlepage elements for the meanings of "long" and "short" fields.

You invoke the umbcfootline theme by putting the following in your document's preamble:

\useoutertheme{umbcfootline}


In the following example, I have added a umbcfootline to Beamer's default theme:

\documentclass{beamer}
\usetheme{default}
\useoutertheme{umbcfootline}
\author{Rouben Rostamian}
\title{Beamer tutorial}
\institute{UMBC}








UMBC themes umbc1, umbc2 and umbc4 include umbcfootline by default, therefore there is no need to invoke umbcfootline explicitly with these themes.

Redefining the footline

You may override the default contents of a umbcfootline with the \setfootline command. For instance, to change the footline to:




put the following in the preamble:

\useoutertheme{umbcfootline}
\setfootline{\insertshortinstitute, \insertshortdate
    \hfill slide \insertframenumber/\inserttotalframenumber}


Items that you can \insert... in a footline, are:


\insertshortauthor

\insertshortinstitute

\insertshorttitle

\insertshortsubtitle

\insertshortdate

\insertframenumber

\inserttotalframenumber


If you use \insertshortauthor and if "short author" is not provided, then "long author" is substituted for it. Same applies to the other \insertshort... fields. See Titlepage elements for the meanings of "long" and "short" fields.

If you really want to insert the long versions of the requested field, use \insertauthor, \inserttitle, etc.

Dynamic footlines

To change the footline of an individual slide, put a \setfootline{...} command just before the slide's \begin{frame}. This will change the footline of this and all subsequent slides.

To limit the change only to one slide, limit the scope of the \setfootline by enclosing it in braces, as in:

{ % brace limits \setfootline's scope
\setfootline{...}
\begin{frame}
...
\end{frame}
} % brace limits \setfootline's scope

论坛徽章:
0
12 [报告]
发表于 2008-05-29 16:50 |只看该作者
10  The UMBC tribullet markers

The umbctribullets package provides attractive triangular markers for itemized lists. To set itemization bullets to UMBC tribullets, put the command \useinnertheme{umbctribullets} in the preamble.

This works with not only with UMBC themes but all other Beamer themes as well. In the following example we use umbctribullets with Beamer's default theme:

% umbctribullets-demo.tex
\documentclass{beamer}
\usetheme{default}
\useinnertheme{umbctribullets}
\begin{document}

\begin{frame}
  \frametitle{UMBC tribullet markers}

\begin{itemize}
\item item 1
  \begin{itemize}
    \item item 1
      \begin{itemize}
        \item item 1
        \item item 2
        \item item 3
      \end{itemize}
    \item item 2
    \item item 3
    \item item 4
  \end{itemize}
\item item 2
\item item 3
\item item 4
\end{itemize}

\end{frame}
\end{document}









The default colors may be changed using the command \umbctribulletscolors command which takes three arguments, corresponding to nesting level of the markers. (Tribullet markers are not available beyond three nesting levels.) As an example:
\umbctribulletscolors{purple}{violet}{brown}


The default tribullet colors are defined as:

\umbctribulletscolors{red}{blue}{orange!40!yellow}


For the meaning of orange!40!yellow see Blending Colors.

论坛徽章:
0
13 [报告]
发表于 2008-05-29 16:51 |只看该作者
11  UMBC boxes

The package umbcboxes helps you display text and equations in fancy boxes with rounded corners and shadows like those shown in the following samples.












The package umbcboxes defines two environments: displaybox and onlinebox.

The displaybox environments is meant to be used with displayed math, however anything else can be boxed with it as well, as the examples below illustrate.

The onlinebox is meant to be used within the running text.

These environment don't attempt to guess the widths of the desired boxes -- you are expected to specify their widths, typically after some trial and error. This is not such a bad thing; finding an aesthetically pleasing box size is not a job for a computer.

You can get a flavor of the usage of these environments from these fragments.

Displayed math:
\begin{displaybox}{5cm}     % width of the box is 5cm
\[
     \cos^2 x + \sin^2 x = 1
\]
\end{displaybox}


Online material:
The important formula, \begin{inlinebox}{3cm} $\cos^2 x
+ \sin^2 x = 1$ \end{inlinebox} occurs very frequently
in mathematics.


In specifying box widths, it is useful to have in mind that the overall size of a Beamer slide is 128mm x 96mm.

The background color of the boxes is set to structure!15!bg by default. (See The structure color and All about colors for the meaning of this.) The default color may not be particularly exciting in general, therefore it is likely that you will want to change it to something more interesting. The \setbeamercolor command in the illustration below shows how.

Here is the complete code that produced the two slides shown at the top of this page.

% umbcboxes-demos.tex
\documentclass{beamer}
\usetheme{umbc4}
\useinnertheme{umbcboxes}
\setbeamercolor{umbcboxes}{bg=violet!15,fg=black}  % redefine box color!
\begin{document}

\begin{frame}
  \frametitle{Fancy boxes}

The \textsl{displaybox} environment is suitable for boxing
displayed mathematics:
\begin{displaybox}{4cm}
\[
    \sum_{n=1}^\infty \frac{1}{n^2} = \frac{\pi^2}{6}
\]
\end{displaybox}
\bigskip

The body of the environment can be anything.  For example:
\begin{displaybox}{5cm}
This is a test.
\end{displaybox}
\bigskip

Centered text may look better:
\begin{displaybox}{5cm}
\centerline{This is a test.}
\end{displaybox}

\end{frame}

\begin{frame}
  \frametitle{Fancy boxes (continued)}

The \textsl{onlinebox} environment is similar to \textsl{displaybox},
but it puts the boxed material within the current line
\begin{onlinebox}{2cm} like this.\end{onlinebox}
Box contents are automatically centered.
\bigskip

The body of an \textsl{onlinebox} may contain mathematics.  As in this
\begin{onlinebox}{3cm}
$\sum_{n=1}^\infty \frac{1}{n^2} = \frac{\pi^2}{6}$
\end{onlinebox} example.
\bigskip

To get display-style mathematics
\begin{onlinebox}{3cm}
$\displaystyle \sum_{n=1}^\infty \frac{1}{n^2} = \frac{\pi^2}{6}$
\end{onlinebox}
add the \textsl{$\backslash$displaystyle} command to your formula.

\end{frame}

\end{document}

论坛徽章:
0
14 [报告]
发表于 2008-05-29 16:52 |只看该作者
12  The title page

Beamer provides an easy way to make a title page for your presentation. The following source code defines a titlepage and a regular slide.

% titlepage-demo.tex
\documentclass{beamer}
\usetheme{umbc4}

% items enclosed in square brackets are optional; explanation below
\title[A short proof]{A short proof of Fermat's Last Theorem}
\subtitle[Errors]{Estimation of numerical errors}
\author[R. Rostamian]{Rouben Rostamian}
\institute[UMBC]{
  Department of Mathematics and Statistics\\
  University of Maryland, Baltimore County\\
  Baltimore, Maryland 21250\\[1ex]
  \texttt{rostamian@umbc.edu}
}
\date[November 2004]{November 26, 2004}

\begin{document}

%--- the titlepage frame -------------------------%
\begin{frame}[plain]
  \titlepage
\end{frame}

%--- the presentation begin here -----------------%
\begin{frame}
  \frametitle{Overview}

Overview of the material.
\end{frame}

\end{document}


Here are the results:







Observe that some of the information provided on titlepage, such title, author, etc., also appears in the footline of the subsequent slide.

Titlepage elements

Titlepage elements are specified through the commands \title, \subtitle, \author, \institute, \date.

The data given to these commands appears not only in the title page, but also in the footline section of the subsequent slides (see the image above.)

Each titlepage element can be specified using a single argument, as in:

\title{University of Maryland, Baltimore County}

or using two arguments, as in:
\title[UMBC]{University of Maryland, Baltimore County}.


The optional argument, UMBC (in square brackets) is the short form of the institute's name.

The long forms of titlepage elements are used on the title page. The short forms of titlepage elements are used in the footers of the subsequent slides.

Please note that if a short form is not provided, then the long form will be used in the footers. If long forms are too long, then footers may get garbled.

About the [plain] qualifier

In the sample source code shown above, note the [plain] qualifier in the line
\begin{frame}[plain]

that generates the titlepage.

Without that qualifier, the title page would have been drawn with header and footer decorations, like all other slides. The [plain] qualifier suppresses the drawing of these decorations. Compare the two images shown on top of this page.

Judge for yourself if showing such decorations is appropriate for a title page.

In general, the [plain] qualifier may be used on any frame to suppress the drawing of frame decorations on that frame.

论坛徽章:
0
15 [报告]
发表于 2008-05-29 16:53 |只看该作者
13  Including graphics

Beamer recognizes images in any of the pdf, png and jpg formats. (Note that PostScript is not among these.)

The following sample we include three pictures side-by-side in a slide.

% graphics.tex
\documentclass{beamer}
\usetheme{Copenhagen}
\begin{document}

\begin{frame}
  \frametitle{Graphics}

Here we include three images, one each of PDF, PNG, and JPG types.

\begin{center}
  \includegraphics[width=0.3\textwidth]{image1.pdf}
  \includegraphics[width=0.3\textwidth]{image2.png}
  \includegraphics[width=0.3\textwidth]{image3.jpg}
\end{center}

\end{frame}

\end{document}


Here is the result:




Converting graphics

When you create an image with the intention of including it in a Beamer document, it is best if you save it in one of the pdf, png or jpg formats that are recognizable by Beamer.4 This is sometimes not possible. For instance, you may have downloaded the image from somewhere and it is in the gif format.

The department's computer facilities provide a large number of utilities for converting and modifying graphical images.

eps to pdf

To convert an Encapsulated PostScript image to pdf, do:
epstopdf filename.eps


This will produce a file named filename.pdf.5

All other conversions

The general-purpose convert6 command converts from any graphics format to any other graphics format. For instance, to convert a gif file to the png format, do:
convert filename.gif filename.png


Similarly, to convert a tiff file to jpg, do:
convert filename.tiff filename.jpg


In fact, we can have convert take over the job of epstopdf as well, as in:
convert filename.eps filename.pdf

however in my experience epstopdf produces better results.






4 The png format works best for line drawings, such as graphs of functions in 2D. The jpg format works best with gradually varying shades, such as the photograph of a person's face.

5 The epstopdf utility is a perl script that calls ghostscript to do the actual conversion. In many Linux distributions it is bundled with the main TeX/LaTeX package.

6 The convert utility is a part of ImageMagick suite of graphics manipulation utilities.

论坛徽章:
0
16 [报告]
发表于 2008-05-29 16:54 |只看该作者
14  Overlays

Probably the most interesting effect achieved by Beamer is overlays, which gives the appearance of incremental exposure of a given slide.

Achieving the overlay effect in Beamer is quite simple -- just insert a \pause command anywhere you want to pause the display.

For instance, to expose an itemized list one-item-at-a-time, do:

\documentclass{beamer}
\usetheme{default}
\begin{document}

\begin{frame}
  \frametitle{Outline of the talk}

\begin{itemize}
  \item Introduction
  \pause
  \item Statement of the main theorem
  \pause
  \item Technical lemmata
  \pause
  \item Proof of the main theorem
  \pause
  \item Conclusions
\end{itemize}

\end{frame}

\end{document}


When this file is compiled into the pdf format and displayed with a pdf viewer, such as the Acrobat Reader, the items are exposed one-at-a-time as you page forward through the document in the usual way.

The use of the \pause command is not restricted to itemized lists; you may use it anywhere in a slide. For example:

\documentclass{beamer}
\usetheme{Malmoe}
\begin{document}

\begin{frame}
  \frametitle{Fermat's Last Theorem}

In this talk I will give a very elementary proof of the
theorem.  I am surprised that no one else has thought of
this before.
\medskip

\pause

Fermat's Last Theorem says that the equation
\[
  x^2 + y^2 = z^2
\]
has no solution in the set of natural numbers.
\medskip

\pause

This is not true.  After a lengthy calculation on the
department's Linux machines, I have verified that within
the numerical accuracy of the Pentium-4 processor, we have:
\[
  5000^2 + 12000^2 = 13000^2
\]

\end{frame}

\end{document}


A pdf viewer will expose the resulting file one paragraph at a time. The fully exposed slide looks like this:

论坛徽章:
0
17 [报告]
发表于 2008-05-29 16:55 |只看该作者
15  Navigating with hyperlinks

During a live slide presentation, it is sometimes necessary to jump several slides back to remind the audience of a formula or a picture. You don't want to page through 17 slides to go to that particular slide and back through 17 slides to return to where you were.

Hyperlinks in a pdf file enable you to jump from one slide to any other slide with one mouse click.

The following input file defines two slides. You should imagine that these are among a large number of slides which are not shown here to save space.

One slide is identified by the label=intro tag on its \begin{frame} command. This is our target slide.

The other slide contains the code \hyperlink{intro}{here}. The word "here" will appear in red in the pdf viewer. When you click on "here", the viewer will jump to the frame labeled intro.


Remark: Actually, what I wrote above is not exactly true. By default, hyperlinks are shown in the normal text color thus are not distinguishable from surrounding text. The red color of hyperlinks is prescribed in the hypersetup command as shown in the sample code below.

Alternatively, a hyperlink may be drawn as a "beamer button". For instance, to make a button with the text "here" on it, we do: \hyperlink{intro}{\beamerbutton{here}}. Four different button styles are available:




These buttons were made using:

\beamerbutton{here}
\beamergotobutton{here}
\beamerskipbutton{here}
\beamerreturnbutton{here}


They only look different; they all do the same thing. Use the one that fits your need.

OK, here a complete LaTeX file that illustrates these concepts:

% hyperlinks.tex
\documentclass{beamer}
\usetheme{default}
\hypersetup{colorlinks=true,linkcolor=red}
\begin{document}

%--- frame --------------------------------------------------%
\begin{frame}[label=intro]
  \frametitle{Introduction}

The contents of the slide here

\end{frame}

%--- frame --------------------------------------------------%
\begin{frame}
  \frametitle{Some other slide}

If you press \hyperlink{intro}{here}, you will jump to the frame
labeled "intro".

Similarly, pressing \hyperlink{intro}{\beamerbutton{here}} will
take you to that same frame.

\end{frame}

\end{document}


The second of the two frames defined above is shown in the figure below. If in the pdf browser you click on the red word "here" or on the blue button, the browser will jump to the first slide labeled intro.

It is difficult to illustrate the dynamic action of hyperlinks with words. I suggest that you cut and paste the code above into a file, compile, and try it yourself.




Returning to the calling page

Now you know how to jump from page N1 to page N2. But how to you return to page N1? Well, you can page through all the intervening pages to get there, but that's not very professional.

To jump to the page where you came from in a single step, do:

if using the Acrobat Reader:
press Control-Left Arrow (that is, hold down the Control key and press the Left Arrow key.)
if using Xpdf:
press the b key.



Remark: Yet another way to return to the calling page would be by adding another hyperlink that works in the opposite way. Thus you put a hyperlink in page N1 that takes you to page N2, and put a hyperlink in page N2 that takes you to page N1. This trick is somewhat difficult to use in practice. Suppose that you have an important formula on page N1. You want to put links in pages N2 and N3 and N4, each of which takes you to page N1. But once in page N1, it could be confusing as to which of the pages N2 or N3 or N4 you are supposed to return to. The pdf viewer methods described above do not have this problem.

论坛徽章:
0
18 [报告]
发表于 2008-05-29 16:56 |只看该作者
16  Theorems and such

In Beamer the following LaTeX environments are predefined:


theorem

corollary

definition

example

proof


The Beamer theme controls how this environments are rendered. Here is an example:

% theorems-demo-1.tex
\documentclass{beamer}
\usetheme{Singapore}
\begin{document}

\begin{frame}
  \frametitle{Theorems and such}

\begin{definition}
A triangle that has a right angle is called
a \emph{right triangle}.
\end{definition}

\begin{theorem}
  In a right triangle, the square of hypotenuse equals
  the sum of squares of two other sides.
\end{theorem}

\begin{proof}
  We leave the proof as an exercise to our astute reader.
  We also suggest that the reader generalize the proof to
  non-Euclidean geometries.
\end{proof}

\end{frame}
\end{document}









If we change the theme to \usetheme{Boadilla}, the slide changes to:










These environments are actually defined in the amsmath package which is loaded automatically into Beamer. Therefore the extensive amsmath facilities are available for customizing them. See the documentation in amsthdoc.dvi that comes with the AMS LaTeX extension packages.7

The standard LaTeX \newtheorem command may be used to extend the available theorem-like environments. For instance, if you put:

\newtheorem{proposition}{Proposition}


in the preamble, then you can say:

\begin{proposition}
...
\end{proposition}




7 On the department's machine, this file is located in the directory:

    /usr/share/texmf/doc/latex/amscls/

You can view the file using the command:

    xdvi  /usr/share/texmf/doc/latex/amscls/amsthdoc.dvi &

论坛徽章:
0
19 [报告]
发表于 2008-05-29 16:58 |只看该作者
17  Splitting a slide into columns

Beamer's columns environment provides an easy way to split a slide vertically into columns. This is particularly useful in positioning figures in a slide or creating multi-column itemized lists.

The following example shows how.

% columns-demo1.tex
\documentclass{beamer}
\usetheme{Singapore}
\begin{document}

\begin{frame}
  \frametitle{Splitting a slide into columns}

The line you are reading goes all the way across the slide.
From the left margin to the right margin.  Now we are going
the split the slide into two columns.
\bigskip

\begin{columns}
  \begin{column}{0.5\textwidth}
    Here is the first column.  We put an itemized list in it.
    \begin{itemize}
      \item This is an item
      \item This is another item
      \item Yet another item
    \end{itemize}
  \end{column}

  \begin{column}{0.3\textwidth}
    Here is the second column.  We will put a picture in it.
    \centerline{\includegraphics[width=0.7\textwidth]{image2.png}}
  \end{column}
\end{columns}
\bigskip

The line you are reading goes all the way across the slide.
From the left margin to the right margin.

\end{frame}

\end{document}


The input file above produces the following slide:








Remark: To split a slide into three or more columns, add any number of \begin{column}...\end{column} as needed. Just make sure that the sum of their widths does not exceed the slide width, that is \textwidth.


Remark: Within each column, the variable \textwidth is redefined to refer to that column's width. For instance, in the sample shown above, the width of image is set to 0.7\textwidth which means 0.7 times the width of the column containing the image.


Remark: I find it easier giving widths of columns in terms of fractions of \textwidth. If you wish, however, you may specify absolute widths, such as: \begin{column}{30mm}. For this, you should know that the overall size of a Beamer slide is 128mm x 96mm.

Vertical alignment

Observe that in the sample slide shown above, the vertical mid-points of the two columns are horizontally aligned. We say the columns are center-aligned, for short.

The option [t] to the columns environment, as in to the \begin{columns}[t], causes the columns to be top-aligned.

Other options are for bottom-alignment and [c] for center-alignment (which is the default).

In the following example the columns are top-aligned:

% columns-demo2.tex
\documentclass{beamer}
\usetheme{Singapore}
\begin{document}

\begin{frame}
  \frametitle{Splitting a slide into columns}

The line you are reading goes all the way across the slide.
From the left margin to the right margin.  Now we are going
the split the slide into two columns.
\bigskip

\begin{columns}[t]
  \begin{column}{0.5\textwidth}
    Here is the first column.  We put an itemized list in it.
    \begin{itemize}
      \item This is an item
      \item This is another item
      \item Yet another item
    \end{itemize}
  \end{column}

  \begin{column}{0.3\textwidth}
    Here is the second column.  We will put a picture in it.
    \centerline{\includegraphics[width=0.7\textwidth]{image2.png}}
  \end{column}
\end{columns}
\bigskip

The line you are reading goes all the way across the slide.
From the left margin to the right margin.

\end{frame}

\end{document}





Vertical alignment with images

Sometimes you may find out that the option [t] for top-alignment gives unexpected results. The following example shows one such case. The only difference between this and the previous example is that I have interchanged the image and text in the second column.

% columns-demo3.tex
\documentclass{beamer}
\usetheme{Singapore}
\begin{document}

\begin{frame}
  \frametitle{Splitting a slide into columns}

The line you are reading goes all the way across the slide.
From the left margin to the right margin.  Now we are going
the split the slide into two columns.
\bigskip

\begin{columns}[t]
  \begin{column}{0.5\textwidth}
    Here is the first column.  We put an itemized list in it.
    \begin{itemize}
      \item This is an item
      \item This is another item
      \item Yet another item
    \end{itemize}
  \end{column}

  \begin{column}{0.3\textwidth}
    \centerline{\includegraphics[width=0.7\textwidth]{image2.png}}
    Here is the second column.  We will put a picture in it.
  \end{column}
\end{columns}
\bigskip

The line you are reading goes all the way across the slide.
From the left margin to the right margin.

\end{frame}

\end{document}





As you see, the columns are not top-aligned at all!

What is happening here is that the bottom of the image is being taken as the image's reference point. Therefore the bottom of the image is being aligned with the top of the first column. This is not what we want!

We want the top of the image to be taken as the reference point, so that the top of the image is aligned with the top of the first column. To achieve this, Beamer provides the [T] alignment option. The following example shows the result.

% columns-demo4.tex
\documentclass{beamer}
\usetheme{Singapore}
\begin{document}

\begin{frame}
  \frametitle{Splitting a slide into columns}

The line you are reading goes all the way across the slide.
From the left margin to the right margin.  Now we are going
the split the slide into two columns.
\bigskip

\begin{columns}[T]
  \begin{column}{0.5\textwidth}
    Here is the first column.  We put an itemized list in it.
    \begin{itemize}
      \item This is an item
      \item This is another item
      \item Yet another item
    \end{itemize}
  \end{column}

  \begin{column}{0.3\textwidth}
    \centerline{\includegraphics[width=0.7\textwidth]{image2.png}}
    Here is the second column.  We will put a picture in it.
  \end{column}
\end{columns}
\bigskip

The line you are reading goes all the way across the slide.
From the left margin to the right margin.

\end{frame}

\end{document}



论坛徽章:
0
20 [报告]
发表于 2008-05-29 17:00 |只看该作者
18  Vertical alignment within slides

Vertical alignment in individual slides

The contents of Beamer slides are vertically centered within slides. This is particularly noticeable if there is very little material in the slide.

The options t, c or b to \begin{frame} cause the contents of the slide to be aligned with the top, center or bottom of the slide, respectively. The default option is c.

The following example illustrate this:

\documentclass{beamer}
\usetheme{Singapore}
\begin{document}

\begin{frame}[t]
  \frametitle{Top alignment}

This is the contents of the slide.

\end{frame}
\end{document}






\documentclass{beamer}
\usetheme{Singapore}
\begin{document}

\begin{frame}[c]    % [c] is the default
  \frametitle{Center alignment (default)}

This is the contents of the slide.

\end{frame}
\end{document}






\documentclass{beamer}
\usetheme{Singapore}
\begin{document}

\begin{frame}
  \frametitle{Bottom alignment}

This is the contents of the slide.

\end{frame}
\end{document}







Vertical alignment for the entire document

You may set the vertical alignment policy for the entire document by giving one of the options t or b to the \documentclass. For instance:

\documentclass[t]{beamer}


will cause the contents of all slides to be top-aligned. You can override this for individual slides by using the c or b options with \begin{frame}.
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

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

清除 Cookies - ChinaUnix - Archiver - WAP - TOP