3

I need to reproduce some stuff made in Power Point to Latex beamer. Some of the slides contain braces and text bubbles in various sizes and arrangements. Since I'm new to this whole Latex thing I probably just butchered it in somehow so far (sorry for that). I just would really like to get to know a way to arrange these braces and textbubbles in a better way than to position them with tikz manually, since this is something I have to do multiple times. Also, I can't find a way to get the vertical braces to work in a similar way than in the example. Would be very thankful for some help.

Edit: I really like the idea of putting a \tikzmark{} somewhere and use it as anchor points.

Desired outcome: Outcome

My approach so far which I mostly copied from some similar question (without colors and stuff to keep it slim):

so far

\documentclass[presentation, aspectratio=1610, 12pt, t]{beamer}
\usepackage{tikz} 
\usetikzlibrary{cd,arrows, decorations.markings, backgrounds, shapes.multipart,matrix,positioning, shapes, fit,decorations.pathreplacing,angles,quotes,decorations.pathreplacing,calc}

\usepackage{multirow} %adds the possibility to create columns spanning mulitple rows

\newcommand{\tikzmark}[1]{\tikz[overlay,remember picture] \node (#1) {};}
\newcommand*{\BraceAmplitude}{0.5em}%  Can be tweaked if
\newcommand*{\VerticalOffset}{1.2ex}%  necessary.
\newcommand*{\HorizontalOffset}{0.8ex}%  necessary.
\newcommand*{\InsertUnderBrace}[4][]{%
    \begin{tikzpicture}[overlay,remember picture]
\draw [decoration={brace,amplitude=\BraceAmplitude},decorate, thick,draw=black,text=black,#1]
        ($(#3)+(\HorizontalOffset,-\VerticalOffset)$) -- 
        ($(#2)+(-\HorizontalOffset,-\VerticalOffset)$)
        node [below=\VerticalOffset, midway] {#4};
    \end{tikzpicture}%
}%

\begin{document}
\begin{frame}
\begin{tabular}{l l l l l l | l}
    1 & 2 & 3 & 4 & 5 & 6 & 7 \\ \hline
    A & test & 2 & U & 14 & A & \\ 
    A & test & 2 & U & 14 & A & \multirow{ -2}{*}{L1} \\ 
    A & test & 2 & U & 14 & A & \\
    A & test & 2 & U & 14 & A &  \\
    A & test & 2 & U & 14 & A &  \\
    A & test & 2 & U & 14 & A &  \multirow{ -4}{*}{L2} \\
    \tikzmark{start1}...&...&...&...&...&...{ }\tikzmark{end1}&\tikzmark{start2}... \tikzmark{end2}\\
\end{tabular}
\normalsize

\InsertUnderBrace[draw=black,text=black]{start1}{end1}{Pretty loooong text here
}
\InsertUnderBrace[draw=black,text=black]{start2}{end2}{Explanation}

\tikz\draw [remember picture,overlay,thick, black,decorate,decoration={brace,amplitude=10pt,mirror},xshift=0pt,yshift=0pt](3,-1) -- (8,-1) node[black,midway,yshift=-0.6cm] {\footnotesize $Made with tikz$};
\end{frame}
\end{document}
2
  • Welcome to TeX.SX! You're in the good way to solve your issue! Could you please explicit what is not good with the example you're posting? It seems that the first two braces are almost ok? (You need to manage the font size, but I think it's not an issue for you, right?)
    – ebosi
    Commented Aug 29, 2017 at 12:47
  • Edit: Thanks for your reply! It's awesome to get a rsponse that quick :) I can't get the vertical brace to work in a similar style. Also I don't know how to do the line breaks within the node. But to be honest I was lazy and did not search for the line break solution so far ;)
    – wusah
    Commented Aug 29, 2017 at 13:12

2 Answers 2

4

a little bit more sophisticated, as tikz picture:

enter image description here

\documentclass[presentation, aspectratio=1610, 12pt, t]{beamer}
\usepackage{tikz}
\usetikzlibrary{arrows,
                calc,
                decorations.pathreplacing,
                calligraphy,% had to be after decorations.pathreplacing
                matrix,
                positioning
                }

\begin{document}
\begin{frame}[fragile]
\[
    \begin{tikzpicture}[
node distance = 0pt,
    BC/.style = {
        decorate,
        decoration={calligraphic brace, amplitude=1.2mm,
        pre =moveto, pre  length=0.75pt,
        post=moveto, post length=0.75pt,
        raise=1mm,
        #1},% for mirroring of brace
        very thick,
        pen colour={red}% black ...
                  },
  BC/.default = mirror,
    LN/.style = {inner xsep=4pt, outer sep=0pt},
                        ]
\matrix (m) [matrix of nodes, inner sep=0pt,
             nodes={text depth=0.8ex, text height=1em, %minimum width=5ex,
                    inner ysep=1pt, inner xsep=4pt, outer sep=0pt, anchor=west},
             nodes in empty cells,
             column sep=-\pgflinewidth,
             row sep= -\pgflinewidth,
             ]
{
    1   & 2     & 3     & 4     & 5     & 6     & 7     \\
    A   & test  & 2     & U     & 14    & A     &       \\
    A   & test  & 2     & U     & 14    & A     &       \\
    A   & test  & 2     & U     & 14    & A     &       \\
    A   & test  & 2     & U     & 14    & A     &       \\
    A   & test  & 2     & U     & 14    & A     &       \\
    A   & test  & 2     & U     & 14    & A     &       \\
\dots   & \dots & \dots & \dots & \dots & \dots & \dots \\
};
\node[LN,right=of m-2-6.south -| m-1-7.west] {L1};
\node[LN,right=of m-5-6.south -| m-1-7.west] {L2};
\draw           (m-1-1.south west) -- (m-1-7.south east);
\draw[BC={}]    (m-2-7.north -| m.east) --
                    node[right=3mm] {bla bla 1}
                (m-3-7.south -| m.east);
\draw[BC={}]    (m-4-7.north -| m.east) --
                    node[right=3mm] {bla bla 2}
                (m-7-7.south -| m.east);
%
\draw[BC]   let \p1 = ($(m-1-1.west)-(m-1-6.east)$),
                \n1 = {veclen(\x1,\y1)} in
            (m-8-1.south west) --
                node[text width=\n1, align=center,
                     below=3mm] {Pretty loooong loooong loooong loooong loooong loooong loooong loooong text here}
            (m-8-6.south east)
                    ;
\draw[BC]   (m-8-7.south west) --
                node[align=center, below=3mm] {Expla- \\
                                               nation}
            (m-8-7.south east);
    \end{tikzpicture}
\]
\end{frame}
\end{document}
2
  • I had to add this fix tex.stackexchange.com/a/429862/74942 due to some error with calligraphy
    – BadAtLaTeX
    Commented Jan 26, 2019 at 12:18
  • the best is to use spath package version, which is available on github, which consider recent changes in expl3 package. we can expect, that it will be after some more testing uploaded to ctan.
    – Zarko
    Commented Jan 26, 2019 at 12:26
0

A simple answer (quickly tested) : use a minipage !

\InsertUnderBrace[draw=black,text=black]{start1}{end1}{\begin{minipage}{3cm}Pretty loooong text here\end{minipage}}
\InsertUnderBrace[draw=black,text=black]{start2}{end2}{Explanation}
0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .