[Tex/LaTex] Produce a “margin” note and align rows of columns in beamer

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):

googledocs

and here is what I got with beamer so far 🙁

beamer

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.

Best Answer

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}

beamer slide with TikZ grid