If you need to insert cross-references to numbered elements in the document, (like equations, sections and figures) there are commands to automate it in LaTeX. This article explains how.
Below you can see a simple example of images cross referenced:
The command is used to set an identifier that is later used in the command to set the reference.
Open an example in ShareLaTeX
Referencing sections and chapters
Below an example on how to reference a section
Again, the commands and are used for references. The label can be set either right before or after the statement. This also works on chapters, subsections and subsubsections. See Sections and chapters.
Open an example in ShareLaTeX
Referencing equations, figures and tables
At the introduction an example of a image referenced was shown, below cross referencing equations is presented.
For further and more flexible examples with labels and references see
Open an example in ShareLaTeX
Referencing the page of an element
Elements usually are referenced by a number assigned to them, but if you need to, you can insert the page where they appear.
The command will insert the page where the element whose label is used appears. In the example above the equation 1. This command can be used with all other numbered elements mentioned in this article.
Open an example in ShareLaTeX
Compiling documents with cross references
In Share LaTeX cross references work immediately, but for cross references to work properly in your local LaTeX distribution you must compile your document twice. There's also a command that can automatically do the job for all the references to work. For instance, if your document is saved as main.tex
generates the file main.pdf with all cross-references working. To change the output format use or .
Open an example in ShareLaTeX
For more information see:
LaTeX can be used for creating presentations. There are several packages for the task, including the package.
The Beamer package
The beamer package is provided with most LaTeX distributions, but is also available from CTAN. If you use MikTeX, all you have to do is to include the beamer package and let LaTeX download all wanted packages automatically. The documentation explains the features in great detail. You can also have a look at the PracTex article Beamer by Example.
The package also loads many useful packages including .
The beamer package is loaded by calling the class:
The usual header information may then be specified. Note that if you are compiling with XeTeX then you should use
Inside the environment, multiple environments specify the content to be put on each slide. The command specifies the title for each slide (see image):
The usual environments (, , , etc.) may be used.
Inside frames, you can use environments like , , , ... Also, is possible to create the frontpage, if and are set.
Trick: Instead of using , you can also use .
For the actual talk, if you can compile it with then you could use a pdf reader with a fullscreen mode, such as Okular, Evince or Adobe Reader. If you want to navigate in your presentation, you can use the almost invisible links in the bottom right corner without leaving the fullscreen mode.
Title page and information
First, you give information about authors, titles and dates in the preamble.
Then, in the document, you add the title page :
Table of Contents
The table of contents, with the current section highlighted, is displayed by:
This can be done automatically at the beginning of each section using the following code in the preamble:
Or for subsections:
Sections and subsections
As in all other LaTeX files, it is possible to structure the document using
Those commands have to be put before and between frames. They will modify the Table of contents with the optional argument. The argument in brackets will be written on the slide, depending on the theme used.
Beamer does not officially support BibTeX. Instead bibliography items will need to be partly set "by hand" (see beameruserguide.pdf 3.12). The following example shows a references slide containing two entries:
As the reference list grows, the reference slide will divide into two slides and so on, through use of the option. Individual items can be cited after adding an 'optional' label to the relevant stanza. The citation call is simply . Beamer also supports limited customization of the way references are presented (see the manual). Those who wish to use natbib, for example, with Beamer may need to troubleshoot both their document setup and the relevant BibTeX style file.
The different types of referenced work are indicated with a little symbol (e.g. a book, an article, etc.). The Symbol is set with the commands and . It is also possible to use directly, like so
Other possible types of bibliography items, besides and , include e.g. , and . It is also possible to have user defined bibliography items by including a graphic.
If one wants to have full references appear as foot notes, use the . For example, it is possible to use
The first solution is to use a built-in theme such as Warsaw, Berlin, etc. The second solution is to specify colors, inner themes and outer themes.
The Built-in solution
To the preamble you can add the following line:
to use the "Warsaw" theme. has several themes, many of which are named after cities (e.g. Frankfurt, Madrid, Berlin, etc.).
This Theme Matrix contains the various theme and color combinations included with . For more customizing options, have a look to the official documentation included in your distribution of , particularly the part Change the way it looks.
The full list of themes is:
Color themes, typically with animal names, can be specified with
The full list of color themes is:
The do it yourself solution
First you can specify the outertheme. The outertheme defines the head and the footline of each slide.
Here is a list of all available outer themes:
Then you can add the innertheme:
Here is a list of all available inner themes:
You can define the color of every element:
Colors can be defined as usual:
Block styles can also be defined:
You can also suppress the navigation bar:
You may also change the fonts for particular elements. If you wanted the title of the presentation as rendered by to occur in a serif font instead of the default sanserif, you would use:
You could take this a step further if you are using OpenType fonts with Xe(La)TeX and specify a serif font with increased size and oldstyle proportional alternate number glyphs:
The default settings for use a different set of math fonts than one would expect from creating a simple math article. One quick fix for this is to use at the beginning of the file the option
Others have proposed to use the command
but it is not clear if this works for absolutely every math character.
The plain option. Sometimes you need to include a large figure or a large table and you don't want to have the bottom and the top off the slides. In that case, use the plain option:
If you want to include lots of text on a slide, use the shrink option.
The allowframebreaks option will auto-create new frames if there is too much content to be displayed on one.
Before using any verbatim environment (like ), you should pass the option to the environment, as verbatim environments need to be typeset differently. Usually, the form is usable (for details see the manual). Note that the option may not be used with commands since it expects to encounter a , which should be alone on a single line.
Internal and external hyperlinks can be used in beamer to assist navigation. Clean looking buttons can also be added.
By default the beamer class adds navigation buttons in the bottom right corner. To remove them one can place
in the preamble.
The following is merely an introduction to the possibilities in beamer. Chapter 8 of the beamer manual provides much more detail, on many more features.
Making items appear on a slide is possible by simply using the statement:
Text or figures after will display after one of the following events (which may vary between PDF viewers): pressing space, return or page down on the keyboard, or using the mouse to scroll down or click the next slide button. Pause can be used within etc.
For text animations, for example in the itemize environment, it is possible to specify appearance and disappearance of text by using where a and b are the numbers of the events the item is to be displayed for (inclusive). For example:
A simpler approach for revealing one item per click is to use .
In all these cases, pressing page up, scrolling up, or clicking the previous slide button in the navigation bar will backtrack through the sequence.
In beamer class, the default mode is presentation which makes the slides. However, you can work in a different mode that is called handout by setting this option when calling the class:
This mode is useful to see each slide only one time with all its stuff on it, making any environments visible all at once (for instance, printable version). Nevertheless, this makes an issue when working with the command, because its purpose is to have only some text or figures at a time and not all of them together.
If you want to solve this, you can add a statement to specify precisely the behavior when dealing with commands in handout mode. Suppose you have a code like this
These pictures being completely different, you want them both in the handout, but they cannot be both on the same slide since they are large. The solution is to add the handout statement to have the following:
This will ensure the handout will make a slide for each picture.
Now imagine you still have your two pictures with the only statements, but the second one show the first one plus some other graphs and you don't need the first one to appear in the handout. You can thus precise the handout mode not to include some only commands by:
The command can also be used to hide frames, e.g.
or even, if you have written a frame that you don't want anymore but maybe you will need it later, you can write
and this will hide your slide in both modes. (The order matters. Don't put handout:0|beamer:0 or it won't work.)
A last word about the handout mode is about the notes. Actually, the full syntax for a frame is
and you can write your notes about a frame in the field note (many of them if needed). Using this, you can add an option to the class calling, either
The first one is useful when you make a presentation to have only the notes you need, while the second one could be given to those who have followed your presentation or those who missed it, for them to have both the slides with what you said.
Note that the 'handout' option in the \documentclass line suppress all the animations.
Important: the notes=only mode is literally doing only the notes. This means there will be no output file but the DVI. Thus it requires you to have run the compilation in another mode before. If you use separate files for a better distinction between the modes, you may need to copy the .aux file from the handout compilation with the slides (w/o the notes).
Columns and Blocks
There are two handy environments for structuring a slide: "blocks", which divide the slide (horizontally) into headed sections, and "columns" which divides a slide (vertically) into columns. Blocks and columns can be used inside each other.
Enclosing text in the block environment creates a distinct, headed block of text (a blank heading can be used). This allows to visually distinguish parts of a slide easily. There are three basic types of block. Their formatting depends on the theme being used.
You can specify the default options of your PDF.
It is possible to number slides using this snippet:
However, this poses two problems for some presentation authors: the title slide is numbered as the first one, and the appendix or so-called "backup" (aka appendix, reserve) slides are included in the total count despite them not being intended to be public until a "hard" question is asked. This is where two features come in:
- Ability to reset the frames counter at any slide. For instance, this may be inserted at the title slide to avoid counting it:
Or alternatively this:
- The first of the above applies to section slides to avoid counting them.
- This stuff works around the problem of counting the backup slides:
The powerdot package
The powerdot package is an alternative to beamer. It is available from CTAN. The documentation explains the features in great detail.
The powerdot package is loaded by calling the class:
The usual header information may then be specified.
Inside the usual environment, multiple environments specify the content to be put on each slide.
The class is very powerful and provides lots of features. For a very simple presentation, a class based on can be used.