Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Latex: stretchable curly braces outside math

Tags:

latex

beamer

tikz

I am producing some latex beamer slides (but I think it is not a beamer specific question per se).

I have the following:

\begin{itemize}
\item Issue1
\item Issue2
\item Issue3
\end{itemize}

Now, I want to have a right curly brace (i.e. '}') behind the items spreading over issue1 and issue2. And of course I want to write something behind that curly brace.

In a perfect world I would write something like:

\begin{itemize}
\left .
\item Issue1
\item Issue2
\right \} One and Two are cool
\item Issue3
\end{itemize}

This does not work because I am not in a math environment and I can not put the whole snippet inside a math environment because itemize would not work in that case.

Is there a clean solution or a hack to produce my desired result?

Regards, Bastian.

like image 559
cknoll Avatar asked May 05 '10 12:05

cknoll


2 Answers

You could (ab)use a table instead:

\documentclass{article}
\usepackage{multirow}

\begin{document}

\begin{tabular}{ll}

\textbullet Issue 1 & \multirow{2}{*}{{\LARGE \}} One and Two are cool} \\
\textbullet Issue 2                                                     \\
\textbullet Issue 3                                                     \\

\end{tabular}

\end{document}

produces:

removed dead Imageshack link

like image 29
Bart Kiers Avatar answered Sep 24 '22 20:09

Bart Kiers


I'd use tikz and make an overlay.

First include the proper packages (you may not need to include tikz since this is a beamer question):

\usepackage{tikz}
\usetikzlibrary{decorations.pathreplacing}

Then when you make your list, give names to the places after each item:

\begin{itemize}
    \item Issue 1     
        \tikz[remember picture] \node[coordinate,yshift=0.5em] (n1) {}; 
    \item Issue 2
        \tikz[remember picture] \node[coordinate] (n2) {};
    \item Issue 3
\end{itemize}

(Note: I shifted the y value up by 1/2 of a line maybe more would be better.)

Because we used remember picture we can refer to these places in an overlay:

  \begin{tikzpicture}[overlay,remember picture]
      \path (n2) -| node[coordinate] (n3) {} (n1);
      \draw[thick,decorate,decoration={brace,amplitude=3pt}]
            (n1) -- (n3) node[midway, right=4pt] {One and two are cool};
  \end{tikzpicture}

The path is there to deal with items that do not have the same width. This edit comes from ESultanik's answer.

The result is:

alt text

Side note: You can remove all of the remember picture options and add the following to automatically add remember to all pictures:

\tikzstyle{every picture}+=[remember picture]
like image 123
Geoff Avatar answered Sep 24 '22 20:09

Geoff