Latex: stretchable curly braces outside math

18,491

Solution 1

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]

Solution 2

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

Solution 3

Here is Geoffs code with some small adaptions (just for other beamer users)

\begin{frame}{Example}

\begin{itemize}
\item The long Issue 1
\tikz[remember picture] \node[coordinate,yshift=0.7em] (n1) {}; \\
spanning 2 lines


\item Issue 2
  \tikz[remember picture] \node[coordinate, xshift=1.597cm] (n2) {};
\item Issue 3

\end{itemize}

\visible<2->{
\begin{tikzpicture}[overlay,remember picture]
  \draw[thick,decorate,decoration={brace,amplitude=5pt}]
        (n1) -- (n2) node[midway, right=4pt] {One and two are cool};
\end{tikzpicture}
 } % end visible

\end{frame}

Ressult (2nd slide of that frame):

beamer result

The adaptions are:

  • added the visible command (because I think it is useful to blend in the brace later)
  • made the items more complex so the use of xshift became necessary (I figured out the xshift value simply by try and error so thats a drop of bitterness) Edit 2018-12-23: manual try-and-error shifting can be overcome by using this method: (n1 -| n2) -- (n2) instead of (n1) -- (n2).

Solution 4

One way to get around this would be to use a math environment like align, put the bullet points by hand (with \bullet ), and then use the resources of the math environment for big braces and such.

Share:
18,491
cknoll
Author by

cknoll

Updated on June 14, 2022

Comments

  • cknoll
    cknoll about 2 years

    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.

  • Bart Kiers
    Bart Kiers about 14 years
    @Mark, thanks, although when spawning } over 3 (or more) rows, it might become too wide. But that will be something basweber should/would try and see for him/her self.
  • cknoll
    cknoll about 14 years
    Yes, spawning 3 or more items is on my wish list. ;) And there is another Problem: $\bullet$ looks different from the default bullet of the itemize environment (in a beamer document).
  • cknoll
    cknoll about 14 years
    I thought about that (but without knowing $\bullet$ in particular). Is there a way to produce a symbol looking like the default bullet of the itemize environment in a beamer document? If so, this solution seems quite applicable.
  • aioobe
    aioobe about 14 years
    @aioobe, that's just as ugly as the other solutions.
  • Bart Kiers
    Bart Kiers about 14 years
    are you now talking to yourself? :)
  • aioobe
    aioobe about 14 years
    Wanted to put. the comment there before someone else ;)
  • Geoff
    Geoff about 14 years
    Use \textbullet instead of $\bullet$
  • cknoll
    cknoll about 14 years
    Thats it! Realy cool! I post an adapted example below. Thanks a lot.
  • Geoff
    Geoff about 14 years
    I've never used this before, it may not be so pretty when the items don't have the same length. In that case you'll probably need to set some hard x value for the \node s or maybe use some rubber width like \hspace{2in}. I'm sure there is some smart tikz way to compute the max x value for two nodes also.
  • Geoff
    Geoff about 14 years
    Yeah, the xshift, this upsets me also. I know there's a way to compute the maximum x value for two nodes, I just don't know tikz well enough.
  • cknoll
    cknoll about 14 years
    I opened a new question: stackoverflow.com/questions/2777179/… Lets see if anyone comes up with a nice solution.
  • Geoff
    Geoff about 14 years
    Good. I was thinking of doing that. I've been wasting loads of time trying to figure it out on my own. There are so many nice Tikz examples, but it's so flexible that it's hard to find exactly what you need (or think you need).
  • Geoff
    Geoff about 14 years
    Updated to deal with items that have different widths, using ESultanik's answer.
  • Verena Haunschmid
    Verena Haunschmid over 11 years
    First suggestion that works for me! Nice! is n3 the "point in the middle" of the curly bracket?
  • Geoff
    Geoff over 11 years
    I believe N3 is the point to the right of the second bullet that is directly below the point to the right of the first bullet.