Beamer - typesetting presentations

    LaTeX is suitable not only for compiling all kinds of documentation, but also for making high-quality presentations. Using the beamer package, you can create presentations that are in no way inferior to PowerPoint or Impress presentations.



    Presentation Topics

    So, in order to start our presentation, we must indicate the class of the document:
    \documentclass[10pt,pdf,hyperref={unicode}]{beamer}
    
    Next, we indicate all the usual options for a latex document (encoding, transfers, additional packages, etc.).

    The standard proportions of the beamer slide are 4: 3, so if you want to make a presentation for the projector with other proportions (for example, 16: 9), you should specify aspectratio = 169 in the optional argument of the \ documentclass command.

    Next, we should choose some topic of the document. There are a lot of these topics (you can see the list in the themes / theme directory of the beamer, I have the directory / usr / share / texmf-dist / tex / latex / beamer / themes / theme /). This is done with the \ usetheme {topic} command. As an example, I looked at several topics:
    Antibes

    Berlin

    Boadilla

    Darmstadt

    Dresden

    Frankfurt

    Goettingen

    Hannover

    Montpellier

    Pittsburgh

    Singapore


    I generated the images from the stub file using a simple function:

    function runit(){ sed -e "s/%theme%/$1/" a.tex > b.tex && pdflatex b.tex && pdftoppm -r 100 b.pdf >
    b.ppm && convert b.ppm $1.png; }
    

    There are a lot of proposed topics (but in which case you can create your own - more on that later). If you don’t like the color scheme of a specific theme, but like the theme itself, you can change the color scheme using the \ usecolortheme {dove} command. The color schemes available in your beamer installation can be viewed in the themes / color directory. For example, if you want to print slides on a printer, you can use the dove color scheme:


    In addition to color themes, the beamer allows you to select “internal” and “external” themes. The \ useinnertheme {theme} command makes it possible to change the appearance of some internal elements (for example, list markers), and the \ useoutertheme {theme} command allows the appearance of external presentation elements (headers and footers).

    If our presentation uses sequential highlighting of elements, it is worth saying: \ setbeamercovered {transparent} so that inactive elements are at least a little visible.

    An even deeper color setting of the beamer can be realized by forcefully specifying the colors of individual elements with the command \ setbeamercolor {element} {bg = color1, fg = color2}. Here “element” is the name of the element whose color we want to change (for example, “normal text” is plain text), “bg” is the background color, “fg” is the color of the text.

    After we have adjusted color schemes, it is possible to “conjure” a little more over headers and footers. Using the contents of the beamer / themes / outer directory as an example, you can understand what needs to be done to give the header or footer the desired look. If we want to put the full name of the author and the short name of the organization in quotation marks in the footer, the second field is the full name of the presentation (if it is not too long), and the third is the date and slide number / number of slides, we need to add to the preamble The document is as follows:

    \makeatletter
    \defbeamertemplate*{footline}{my theme}{
    	\leavevmode%
    	\hbox{%
    	\begin{beamercolorbox}[wd=.3\paperwidth,ht=2.25ex,dp=1ex,center]{author in head/foot}%
    		\usebeamerfont{author in head/foot}%
    		\insertauthor~~\beamer@ifempty{\insertshortinstitute}{}{(\insertshortinstitute)}
    	\end{beamercolorbox}%
    	\begin{beamercolorbox}[wd=.5\paperwidth,ht=2.25ex,dp=1ex,center]{title in head/foot}%
    		\usebeamerfont{title in head/foot}\inserttitle
    	\end{beamercolorbox}%
    	\begin{beamercolorbox}[wd=.2\paperwidth,ht=2.25ex,dp=1ex,right]{date in head/foot}%
    		\usebeamerfont{date in head/foot}\insertshortdate{}\hspace*{2em}
    		\insertframenumber{} / \inserttotalframenumber\hspace*{2ex}
    	\end{beamercolorbox}}%
    }
    \makeatother
    

    Similarly, we can change the footer and the field with the name of the slide. For example, to place our logo in the upper left corner of the field with the name, and then the name of the slide, redefine the frametitle template:

    \defbeamertemplate*{frametitle}{shadow theme}{%
    	\vskip-2pt\leavevmode%
    	\hbox to \paperwidth{%
    	\hbox to 1.5em{\hskip -1.6ex\vbox to 0pt{\vskip
    		-1.8ex\includegraphics[width=1.5em]{penguin.jpg}}}%
    	\begin{beamercolorbox}[wd=\paperwidth,ht=2ex,dp=3pt,left]{title in head/foot}%
    		\ \insertframetitle
    	\end{beamercolorbox}}
    }
    

    As a result, we get:


    If necessary, you can select a block that has the color we set:

    \begin{colormixin}{цвет}
    	блок с цветом "цвет"
    \end{colormixin}
    

    The “color” parameter can be either already defined (by analogy with the color boxes above), or specified by the user (including how to mix several colors). In order to take some color with transparency N (N - in percent), we write: “N! color". A record of the form “color1! N! color2 ”mixes (100-N) parts of color“ color1 ”with N parts of color“ color2 ”. The \ averagebackgroundcolor command returns the current background color.

    In addition to color, you can also change the font. The themes / font / directory contains “font themes” that can be used in presentations. You can change the “font theme” using the \ usefonttheme {font} command. For example, if we want to use the default font (without serifs), but in serifs with serifs, we will give the command:

    \usefonttheme[onlymath]{serif}
    

    If you want to change the background of the slide, use the \ usebackgroundtemplate command, inside which there may be any lateh instructions (including image placement). For example, we can put a picture in the background of the entire frame:

    \usebackgroundtemplate{\includegraphics[width=\paperwidth,height=\paperheight]{penguin.jpg}}
    



    Main fields


    Now we turn to filling in the general fields of the presentation. This can also be done in the preamble of the document. Most of the commands for setting field values ​​have optional arguments - a short designation of the same field (this short designation is usually placed in the footers, so it makes sense to fill it out). Some of the fields are standard latex: \ title (presentation title), \ author - author, \ date - date; and some are specific: \ institute - organization, \ subtitle - subheading, \ logo - organization logo (some presentation styles place the logo on their own, but some do not have it - this should be borne in mind).

    In addition, in the preamble, you can specify the \ AtBeginSection command, which allows you to display additional information at the beginning of each section of the presentation. For example, to display the content with highlighting of the current section, write:

    \AtBeginSection{
    	\begin{frame}
    		\frametitle{Содержание}
    		\tableofcontents[currentsection]
    	\end{frame}
    }
    

    Similarly, the code that executes at the beginning of each subsection is determined by the \ AtBeginSubsection command. Both teams have an optional argument - its contents will be placed before the section / subsection defined by the command with an asterisk (i.e. not falling into the table of contents and not numbered).

    Slides


    Further, in the body of the document, we begin to frame presentation frames. Each frame is surrounded by a frame. If we want to put the title and content at the beginning of the presentation, we can format the standard commands \ maketitle and \ tableofcontents as separate frames.

    To select logical blocks within each frame, you can use the block environment with the required parameter - the name of the block (since the theorem, lemma and example environments have English names by default, you can use the block environment instead, or redefine the names of these blocks). The exampleblock environment is highlighted in a separate color, which also has the required name of the block. If you want to pay special attention to some text, you can put it inside the \ alert or \ color {color} command.

    If your frame contains the verbatim environment or the \ verb command, you must add the optional containsverbatim parameter to the frame environment.

    In addition to the containsverbatim parameter, the frame environment has the following optional options:
    • label = label - slide label (for the \ ref command and hyperlinks);
    • b, c, t - vertical alignment (on the top edge, in the center - default, on the bottom edge;
    • plain - slide without layout;
    • shrink = number - if the contents of the frame do not fit on the screen, the beamer will try to scale it by at least a “number” of percent;
    • squeeze is another way to “squeeze” a lot of objects onto a slide: vertical gaps will be minimized,
    • fragile - tells the beamer that “fragile” text is placed inside the frame (for example, the same verbatim environment.

    By default, the slide is placed in one column, however, using the columns environment, you can split the slide into several columns. Each column within this environment is specified by the \ column {width} command. For example, to split a slide into two columns, let's do this:

    \begin{frame}\frametitle{Название кадра}
     	\begin{columns}
     		\column{0.5\textwidth}
     			Содержимое левого столбца
     		\column{0.5\textwidth}
     			Содержимое правого столбца
     	\end{columns}
    \end{frame}
    


    Overlay


    Often, the information on the frame you want to submit gradually - line by line, as the narration. That is, the contents of one frame is divided into several consecutive slides. Overlays are used for this - various types of transitions to a new piece of information within the same frame. I’ll note right away: in reality, each slide requires the layout of a new page of a pdf file, however, when using a “competent” pdf viewer that draws attention to meta-information, these transitions are invisible (and you can even insert animated overlays into the presentation).

    To control the visibility of blocks on different slides within the same frame, the following commands are used (I’ll immediately pay attention: the numbering of slides starts with 1):
    • \ onslide{text} - the text is visible on slide number N, on the rest it is marked with the color of inactive text;
    • \ only{text} - the text is visible only on slide N, not taking up space on others;
    • \ visible{text} - the text is present only on slide N, but is not visible on others, but takes up space;
    • \ invisible{text} - on slide N, the text is not visible, but takes up space, on the rest it is present;
    • \ alt{text 1} {text 2} - on the slide N appears "text 1", on the rest - "text 2";
    • \ temporal{before} {text} {after} - “text” appears on slide N, “before” on previous slides, and “after” on subsequent slides;
    • \ uncover{text} - the inverse of the \ onslide command;

    All these commands act only on sentences containing one paragraph. If we need to select a block of several paragraphs in this way, we must enclose them inside the environment of the same name: onlyenv, altenv, visibleenv, uncoverenv, invisibleenv.

    In addition to these blocks, we can divide the itemize and enumerate environment points into several slides: for this, immediately after the \ item command, you need to insert a specification indicating the numbers of the slides on which this information should appear. On the other slides it will not be visible, but it will take up space, however, if we want these hidden items to be displayed in the color of inactive text, it is necessary to indicate in the preamble:

    \setbeamercovered{transparent}
    

    The slide number specifications themselves are enclosed in angle brackets and have the form : ranges of slide numbers are listed with a hyphen, and separated numbers are separated with a comma. These specifications can also be specified with highlighting commands, such as \ alert.

    Another option to display blocks alternately is to specify the \ pause command after each block. This command also works at the end of table rows and even inside plain text. In a word, this command gives an instruction to divide the frame into slides: leave everything that is before it on the previous slide, and transfer everything that is after it to the next.

    Animation and Sound


    If you will show your presentation using Adobe Reader or another program that can play files that contain hyperlinks to the document, you can include a video or sound file in your presentation.

    To enable the video you need to use the command

    \includemovie[poster,mouse=true]{width}{height}{file}
    

    You can enable sound like this:

    \sound[options]{poster}{file}
    

    Options options: loop, repeat, palindrome, borderwidth, showcontrols, externalviewer, inlinesound (their essence is clear from the name).

    The “poster” parameter determines what will be displayed on the slide to start the audio or video file. If left empty, the file will play automatically.

    Please note that for the introduction of media files into the presentation, it may be necessary to manually connect the multimedia package (if the beamer does not connect it "by itself").

    You can also connect the media9 package and embed media files using it.

    The beamer itself allows you to animate overlays using pdf: for this, the frame is divided into N slides with a change in the value of a user-defined variable (it can be a counter or a length). The \ animate command applies this animation to range slides. Changing a variable is done using the command \ animatevalue {variable} {initial value} {final value}. Those. the user-defined variable on the range of slide numbers “range” changes uniformly from the value “initial value” to “final value”.

    To set the type of animation for overlays, use the \ transOVR <slides> [options] command, where OVR:
    • blindshorizontal - the slide is "cut" by vertical stripes;
    • blindsvertical - the slide is "cut" by horizontal stripes;
    • boxin - the old slide is “pulled” to a point in the center of the screen;
    • boxout - a new slide is “stretched” from a point in the center;
    • dissolve - the slide is replaced by a mosaic;
    • glitter - a mixture of dissolve with wipe;
    • splitverticalin is “pulled together” from above and from below;
    • splitverticalout "stretches" above and below;
    • wipe - the next slide "leaves" on the left.
    “Slides” is an optional option that indicates which specific options from a given sequence within a slide apply transitions to. "Options" - optional options: duration = seconds - transition time; direction = degrees - the direction of the transition.

    When using the \ animate command, you need to set the duration of each slide, for this you need to use the \ transduration {duration} command.

    Here is an example of using animation using bimer tools:

    \newcount\ooo
    \newdimen\offset
    \begin{frame}
     	\animate<2-10>
     	\animatevalue<1-10>{\ooo}{100}{0}
     	\animatevalue<1-10>{\offset}{0cm}{5cm}
     	\begin{colormixin}{\the\ooo!averagebackgroundcolor}
     	\frametitle{Цветной слайд}
     	выцветаем
     	\hskip\offset\alert{и улетаем!}
     	\end{colormixin}
     	\transduration{0.1}
    \end{frame}
    

    Here, to create an animation, we use the “ooo” counter, which sets the opacity of the text, and the “offset” size, which sets the offset of the phrase “and fly away!” Relative to the word “fade”. Over nine out of ten slides, the values ​​of these variables change, as a result of which the opacity of the text changes from 0 to 100 in increments of 10, and the offset of the “flying away” phrase changes from 0 to 5 centimeters in increments of 5 mm.

    Other


    Because the beamer automatically connects the hyperref package; you can insert hyperlinks into the document. For example, at the end of the presentation, we can insert optional slides, and inside - make hyperlinks to them (“all of a sudden” they ask - and you immediately - once, and an ace from the sleeve). In addition, you can make a hyperlink to an object (formula, etc.) inside the slide. The general principle is this: the object we want to refer to is marked with a label (optional argument label = label surrounded by frame or the command \ label {label} inside the frame), and the hyperlink is executed with the command \ hyperlink {label} {link text}. In addition to text, you can insert a "button": \ beamerbutton {text}. If our frame contains several slides, you can refer to a specific frame slide: for this you need to indicate in the brackets between the \ label command and its argument the number [a] of the desired slide. Similarly if we need to refer to an element from a specific slide of a given frame, we can specify the specification of the slide number in the first parameter (“label”) immediately after the label. You can also designate a hyperlink with specific commands: \ beamergotobutton (there will be an arrow icon in front of the text), \ beamerskipbutton (double arrow), \ beamerreturnbutton (left arrow).

    At the end of a decent presentation, you might want to post a bibliography. This is also possible: just place it on a slide in the familiar environment of thebibliography, or use bibtex.

    When working with a projector and a screen, you can use the screen to display prompts on it. For this we write

    \setbeameroption{second mode text on second screen=[расположение]}
    

    Here, the optional “location” parameter tells the beamer where the screen is located relative to the projector (top, bottom, left, right; default is right). The “typeset second” option of the frame environment will tell the beamer that there will be slides inside the frame, the contents of which should be displayed on the second screen. What needs to be displayed there is declared by the specification "only: slide number". For instance,

    \setbeameroption{second mode text on second screen}
    \begin{frame}[typeset second]
     	Этот текст отобразится на обоих экранах.
    \only{Этот - только справа}
    \only{Этот - слева}
    \end{frame}
    

    Explanations and translations can also be displayed on two screens: one text on one side and the other on the other. We define the \ twoscreen command, the argument of which is separated by a vertical bar: everything on the left is displayed on the left monitor, and on the right - on the right.

    \setbeameroption{second mode text on second screen}
    \makeatletter
    \def\twoscreen#1{\tw@scr#1\relax}
    \long\def\tw@scr#1|#2\relax{\alt{#2}{#1}}
    \makeatother
    ...
    \begin{document}
    \begin{frame}[typeset second]
    \frametitle{\twoscreen{Заголовок кадра| а здесь - наша подсказка}}
    \begin{itemize}
    \item<1-> \twoscreen{Раз|Подсказка о пункте}.
    \item<2-> \twoscreen{Два|Подсказка о пункте}.
    \item<3-> \twoscreen{Три|Подсказка о пункте}.
    \end{itemize}
    \end{frame}
    

    Everything else that I did not talk about here can be found in the user guide . And download the latest version - from here .

    PS A small example for raising the spirit: after all, a beamer is not so complicated. And here is the result + video .

    Also popular now: