As you know, I do basically everything with LaTeX. But, I have colleagues who work with other tools and sometimes we exchange slides. Fortunately by now people have realized that I don’t like to get weird formats, so they send me pdfs. Yay!

It is actually really easy to include pages from a presentation in pdf format into a LaTeX beamer presentation. You will need the package pdfpages and then just write:

The first line is necessary, because it seems like otherwise the pdf slides end up being inserted behind the background of the slides, which doesn’t make so much sense to me, but anyway.

You can also include one pdf page into a beamer-slide (“frame”). This is useful if you want to edit the slide a bit, for example to hack your own footer back into the slide to get consistent page numbering:

This is specific to my plot, Xcoord1 is one of my symbolic x-coordinates in the plot. Other than that, the code is completely independent from the used coordinates and the number of them, which makes it more flexible than my old stuff.

Usage (this will let seagreen bars at the given coordinates appear on slide 2):

In one slide of a presentation I wanted to have a background picture and overlay it with several text blocks one after the other to have the effect of the text “coming out of” the background. It is tricky to align things in LaTeX beamer, especially if you want to have them on top of each other, so this is my solution: Two minipages that cover the whole slide on top of each other.

A slide is more or less 7cm high (depending a bit on your template). There probably is a length defined for that, but I was too lazy to look for it so I took the actual value. The width of the slide is of course \textwidth. I use vertically centered alignment for the minipage, but that is up to you (see the post Set height of a minipage for the options you can give to minipage).

The way it now works is the following. Create one minipage of full width and height. Use this to display the background image. Then jump back the full height and create a second minipage of full width and height to display the text inside of that. This is the code for my slide:

There is a package for drawing dependency trees in LaTeX called tikz-dependency:

\usepackage{tikz-dependency} % draw example with dependency tree

First the sentence is defined inside a deptext environment. You could add more rows to the sentence, e.g., for lemmas or parts-of-speech.
The edges between words are given with depedge commands (outside the deptext environment). Edges can in theory go both ways, but it looks better if they go from the head to the child. Here is an example dependency tree for a sentence:

Besides drawing dependency trees, the package is also useful to create nice mark-up for words and phrases. The command is wordgroup which is inserted at the same place as the dependency edges and works upon the elements of the deptext The following draws a red box around words 7 and 8 in the sentence above (the 1 stands for the row):

\wordgroup[group style={fill=red!30, draw=red}]{1}{7}{8}{a}

There are lots of styling options for nodes, edges and word groups. I use the following in my thesis (this defines a style that combines options for both the dependency and the deptext environment, I just use the same in both):

I want all mark-up of all word groups to be styled the same way, so I don’t want to write the part with fill and draw all the time with different colors. And if I want to change the percentage of white, I would like to do it at one place for all nodes. So I have written a macro that only expects the color to be given:

\tikzset{
coloring of/.style={fill=#1!30, draw=#1},
}

And finally, for presentations with dependency trees I want to be able to use overlays, i.e., to show a word group at a specific time. For edges you can use the normal \visible command from beamer, but for word groups it does not work for some reason. So this is a macro that does work and shows word groups only on specific slides (I got this from LaTeX Stack Exchange):

Creating handouts from slides created with LaTeX beamer is simple. Just specify the option “handout” in the documentclass:

\documentclass[handout]{beamer}

In your slides, you can use the marker presentation and handout to give specific instructions that apply only when the pdf is created in presentation mode or in handout mode. So for example you can have different templates for your slides [there are spaces around the < because otherwise they are not displayed in this blog... delete them when you write real LaTeX]:

\visible<1->{This is the same for handout and slides.}
\visible<1-|handout:0>{This won't be in the handout.}
\visible<1|handout:2>{This is on the same slide for the presentation,
but on a different slide for the handout.}
\visible<2|handout:1>{This is on a different slide for the presentation,
but on the same slide for the handout.}

Another weird LaTeX problem. I have a piece of code on my slide and the result it gives. I want to change the code slightly and visualize the change in the result. Normally in LaTeX beamer slides, I would use overlays like this:

Query:
\begin{verbatim}
some code
\alt<2>{slightly changed code on slide 2}{original code on slide 1}
some more code
\end{verbatim}
Result:
this item is the same in both
\visible<1>{this one is only there for the original code}
\visible<2>{this one is only there for the changed code}

So far, so good. The code is in a verbatim environment, so I have cannot put the overlay around the line I want to change, but that’s fine, let’s make it an alternative around the whole verbatim part. But, unfortunately, the problem is that you cannot put a verbatim environment inside of overlays (learn why). So you have to hack it. This is the code I want, the line with FILTER is the one I only want to have on the second slide:

More strange problems, still teaching LaTeX. So I wanted to teach people how to get text or code formatted exactly as they type it with the verbatim environment. This is the part of code I wanted to use as an example:

What I usually do is I have a block that shows the code they have to write and then the result. And of course for showing the code they need to write, I use verbatim. So can you include verbatim inside verbatim?

Well, yes you can, but of course you cannot include \end{verbatim}, as this would be interpreted as ending the verbatim environment. So I had to add this separately afterwards, using \verb (inline verbatim). Voila:

Now there’s only a small problem, namely that there is some spacing after the environment, so it seems like there is an empty line between the end of the verbatim text and the \end{verbatim}. For this example it doesn’t matter, I use it to show them that empty lines are also printed exactly as they are given.

But next example is how to include verbatim inside a beamer frame. The example code I wanted to show inside the usual verbatim environment: