# Produce a “margin” note and align rows of columns in beamer

I want to convert my google doc presentation into beamer.

But I am not sure how to:

1. make it show the little "boxes" on the left margin that indicate book chapters.
2. How to space apart the rows (I know I can do multiple columns declarations, one after another, but they are all mushed together)

Here is my example slide (made in google docs) (Note: this is the complete slide - with chapter indicators flush left of the page):

and here is what I got with beamer so far :-(

My code for the relevant part is as follows:

\section{Introduction}
\begin{frame}
\frametitle{Cybernetics}

1/1.
\begin{columns}[t]
\begin{column}{0.5\textwidth}

science of control and communication in animal and the machine''
\end{column}
\begin{column}{0.5\textwidth}
coordination, regulation and control
\end{column}

\end{columns}

\begin{columns}[t]
\begin{column}{0.5\textwidth}
theory of a machine''
\end{column}
\begin{column}{0.5\textwidth}
not congs and levers'' but ways of behaving
\end{column}

\end{columns}

\end{frame}


Any tips appreciated.

• Your question is not clear. Nevertheless, you can use tcolorbox or mdframed to get fancy boxes in beamer and use multicol to have columns in the slide. – cacamailg Aug 7 '13 at 18:15
• What is it exactly, that you want to typeset in this slide? Some Contents Overview? What exactly does belong into the boxes? This is imporant because LaTeX is a system in which data and form are seperated from each other (in the best case); e.g. typing "1/1" directly into the input is not the best solution as far as it has to do with the sectioning, like you mentioned. With more information you should get way better help. – Ruben Aug 7 '13 at 18:41
• Well, I would like that chapter indicators to be on the margin simply for reference to the reader, not for sectioning of the slides. It's more like a "note". Hence in my presentation they are on the left margin, and not in line with the title of the slide (which is also the section title in this case....) – Andriy Drozdyuk Aug 7 '13 at 20:51

One way to accomplish this is to use the tabular environment in combination with TikZ to achieve the coloration for the chapter boxes.

Moreover, see this answer for an explanation of the necessity of the baseline option. Basically, it ensures that the text in all of the cells and the tikzpictures in all of the cells will have the desired vertical alignment. (If you wish to play around with the vertical alignment of the chapter boxes relative to the text in the other cells, the explanation in the linked answer will be particularly helpful.)

Also, I've added the 2em option to the end of each of the rows in the table, as I think this spacing looks better than the default spacing in this particular instance. Of course, you can adjust this option as you see fit.

You can also adjust the width of each of columns (i.e., p{..}) as you see fit.

UPDATE #1:

Manipulating the way that the \frametitle is typeset allows you to shift the title of the frame. You can manipulate the vertical and horizontal space as you wish by changing the arguments of \vspace and \hspace.

Additionally, the table can be moved left to make it appear as if they are margin notes by also using \hspace immediately before the table. (Note that there cannot be a blank line between \hspace... and begin{tabular}..., or else the \hspace will be applied to a different 'paragraph'.

Finally: it's quite possible there's a better way to do this. I'm not at all familiar with Beamer, but this does seem to produce your desired result. The immediate downside to this solution that I see is that this changes the alignment of the title on all of the slides. If you don't mind the 'margin notes' being horizontally aligned with the title, you can eliminate the \setbeamertemplate{...} command from the preamble, and they will be flush left and flush with the title, which will then retain the normal alignment of frame titles on all slides.

UPDATE #2:

Changing the argument of the \hspace immediately before the tabular environment to -1.2cm and changing the first p{...} to p{.06\textwidth}, will give you the alignment that you want. The included picture has made use of \usetikzlibrary{calc} to overlay a grid onto the beamer slide to ensure that the alignment is correct. In the code, I've commented out this grid, though you can uncomment it and manipulate the arguments to facilitate anymore alignment you may have to do.

\documentclass{beamer}

\usepackage{tikz}

%\usetikzlibrary{calc}                                      % uncomment
%\setbeamertemplate{background}{%                           % this section
%\begin{tikzpicture}[overlay,remember picture]              % to overlay a grid
%  \draw [line width=0.1mm,xshift=1.2cm]                    % onto the
%    ($(current page.north west) + (0.5cm,-0.5cm)$)       % beamer slide
%    grid                                                   % in order to
%    ($(current page.south east) + (-0.5cm,0.5cm)$);      % verify that you
%\end{tikzpicture}%                                         % have the alignment
%}                                                          % that you want

\setbeamertemplate{frametitle}{         % eliminating these four
\vspace{.2cm}\hspace{0cm}           % lines of code will align
\insertframetitle                   % the \frametitle with the chapter boxes
}                                       % NOTE: this changes ALL frametitles

\begin{document}
\section{Introduction}
\begin{frame}

\frametitle{Cybernetics}

\hspace{-1.2cm} % this line can be adjusted as needed to specify where the left edge of the table begins
\begin{tabular}{p{.06\textwidth}p{.35\textwidth}p{.35\textwidth}}

\begin{tikzpicture}[baseline]\node [draw,fill,text=white] (1){\tiny 1/1};\end{tikzpicture} & science of control and communication in animal and the machine'' & coordination, regulation and control\\[2em]
\begin{tikzpicture}[baseline]\node [draw,fill,text=white] (2){\tiny 1/2};\end{tikzpicture} & theory of a machine'' &  not cogs and levers'' but ways of behaving \\[2em]
& not what is this''? & but what does it do''? \\[2em]

\end{tabular}

\end{frame}

\end{document}


• Is it possible to make the chapter indicators flush left (like in my example?) – Andriy Drozdyuk Aug 7 '13 at 20:48
• I.e. they should not be part of the main content, but rather be sidenotes, for the convinience of the reader. They are not there for sectioning (if that makes any sense). – Andriy Drozdyuk Aug 7 '13 at 20:53
• @drozzy Just to be clear: do you just want them to be aligned flush left on the slide, or do you want them to be to the left of the title of the slide? If you want the latter, it might require playing with the definition of \frametitle. I'll have to think about it a bit, but first this clarification is in order. – Adam Liter Aug 7 '13 at 20:57
• @drozzy See my updated answer. – Adam Liter Aug 7 '13 at 21:54
• Oh, no just flush left with the slide. The title should be aligned with the content (in this case, left column -- just like in my example). Thank you! This looks already much better. – Andriy Drozdyuk Aug 7 '13 at 23:31