This question is related to this question: Adding large brace next to body text, but is not a duplicate.
I have an itemize
in a beamer presentation. I want to put a brace over some of these items. So here's what I have so far:
\documentclass{beamer}
\usepackage{tikz}
\usetikzlibrary{decorations.pathreplacing,calc}
\newcommand{\tikzmark}[1]{\tikz[overlay,remember picture] \node (#1) {};}
\begin{document}
\begin{frame}
\frametitle{Here is text}
\begin{itemize}[<+->]
\item A first item \tikzmark{topbrace}
\item Another item, also inside the brace \tikzmark{bottombrace}\tikzmark{right}
\item Outside the brace
\end{itemize}
\onslide<+->{
\begin{tikzpicture}[overlay, remember picture]
\draw [decoration={brace,amplitude=0.5em},decorate,ultra thick,black]
($(right)!(topbrace.north)!($(right)-(0,1)$)$) -- ($(right)!(bottombrace.south)!($(right)-(0,1)$)$);
\end{tikzpicture}
}
\end{frame}
\end{document}
(needs compiling twice to get the right result). Incidentally, why is this? Is it something to do with the remember picture
thing?
I have two issues with this excellent solution: the spacing doesn't look right (I'd like the top of the brace to be higher), and I'd like to add text to the right of the brace (see picture).
I can't quite fathom the complicated positioning commands used to add an extra node with text, or modify the spacing...
What I'd really like from an answer to this question is an explanation of what the !
and $
are doing...
node[pos=0.5,anchor=left] {I'd like some text here}
before the semicolon in your\draw
statement?s/left/west/
yes. That works, although the spacing needs some work.remember picture
needs two compiles. On the first compile TikZ has to gather the positions on the second compile it uses them. Same problem as with references.