1

I have the following table in Beamer:

Table

I would like to add a large curly brace "{" on the left of the table (outside) spanning the first three rows and add some information concerning these rows next to the brace. How do I achieve this?

Here is a MWE:

\documentclass{beamer}
\usetheme{metropolis}
\setbeamertemplate{footline}{}
\makeatletter
\def\beamer@framenotesbegin{% at beginning of slide
\usebeamercolor[fg]{normal text}
\gdef\beamer@noteitems{}%
\gdef\beamer@notes{}%
}
\makeatother
\usepackage{lmodern}
\usepackage{tcolorbox}
\usepackage[USenglish]{babel}
\usepackage[latin1]{inputenc}
\setbeamersize{text margin left=10mm,text margin right=10mm} 
\setbeamerfont{frametitle}{size=\small}
\begin{document}
\maketitle
\begin{frame}{Text}
\resizebox{\textwidth}{!}{%
\begin{tabular}{|c|c|}
\hline
Column A & Column B\\
\hline \hline
Some text & Some text\\
Some text  & Some text\\
Some text &Some text \\
Some text & Some text\\
Some text & Some text\\
Some text & Some text\\
\hline
\end{tabular}
}
\end{frame}
\end{document}

2 Answers2

4

You can do that very simply with the bigdelim package, which comes with multirow: it is enough to add a column on the left and use the \ldelimiter command in tne leftmost cell of the relevant row:

\documentclass{beamer}
\usetheme{metropolis}
\setbeamertemplate{footline}{}
\makeatletter
\def\beamer@framenotesbegin{% at beginning of slide
\usebeamercolor[fg]{normal text}
\gdef\beamer@noteitems{}%
\gdef\beamer@notes{}%
}
\makeatother
\usepackage{lmodern}
\usepackage{tcolorbox}
\usepackage[USenglish]{babel}
\usepackage[utf8]{inputenc}
\usepackage{bigdelim}
\setbeamersize{text margin left=10mm,text margin right=10mm}
\setbeamerfont{frametitle}{size=\small}

\begin{document}

\maketitle
\begin{frame}{Text}
\resizebox{\textwidth}{!}{%
\begin{tabular}{r@{\,}|c|c|}
\cline{2-3}
 & Column A & Column B\\
\cline{2-3} \cline{2-3}
\color{red}\ldelim\{{3}{*}[\color{blue} Some info]& Some text & Some text\\
 & Some text & Some text\\
 & Some text &Some text \\
 & Some text & Some text\\
 & Some text & Some text\\
 & Some text & Some text\\
\cline{2-3}
\end{tabular}
}
\end{frame}

\end{document} 

enter image description here

Bernard
  • 271,350
  • This is exactly what I wanted. Thank you! Any way to change the color of the brace? – Sahiba Arora Feb 26 '20 at 18:02
  • 2
    Yes, it is very simple: add the color command at the beginning of the cell containing \ldelimiter. You even can choose another colour for the text (or use the default black). Please see the code in my updated answer. – Bernard Feb 26 '20 at 18:38
  • @Bernard Hello, how can I write the "Some Info" in two lines instead of one? – Wallflower Sep 19 '22 at 08:04
  • @Wallflower: the simplest for me would be to use one of the stackengine commands, say Shortunderstack[l]{Some \\ Info} – Bernard Sep 19 '22 at 08:14
  • @Bernard Thank you for your reponse. I get the error Misplaced \cr. V – Wallflower Sep 19 '22 at 08:20
  • Did you load stackengine with the [usestackEOL] option? – Bernard Sep 19 '22 at 08:22
0

Proof of concept for adding braces and explanation on right side -- you have to delete or amend the line expressing textwidth for the table else table will occupy the entire frame

\resizebox{\textwidth}{!}{}%<----------remember to delete both braces at the end if 
                                       %using this solution

enter image description here

MWE

\documentclass{beamer}
\usetheme{metropolis}
\setbeamertemplate{footline}{}
\makeatletter
\def\beamer@framenotesbegin{% at beginning of slide
\usebeamercolor[fg]{normal text}
\gdef\beamer@noteitems{}%
\gdef\beamer@notes{}%
}
\makeatother
\usepackage{lmodern}
\usepackage{tcolorbox}
\usepackage[USenglish]{babel}
\usepackage[latin1]{inputenc}
\setbeamersize{text margin left=10mm,text margin right=10mm} 
\setbeamerfont{frametitle}{size=\small}

\newcommand\MyLBrace[2]{%
  \left.\rule{0pt}{#1}\right\}\text{#2}}

\begin{document}
\maketitle
\begin{frame}{Text}

\noindent\begin{tabular}{c@{}l}
\begin{tabular}{c}
\hline
Column A \\
\hline \hline
Some text\\
Some text\\
Some text\\
Some text\\
Some textt\\
Some text\\
\hline
\end{tabular}
&
  $\begin{array}{l}
    \MyLBrace{3ex}{things beginning with vowels} \\ 
    \MyLBrace{3ex}{things beginning with consonants} \\
    \MyLBrace{4.4ex}{things beginning and ending with t} 
  \end{array}$
  \end{tabular}
\end{frame}
\end{document}

Solution given by @GonzaloMedina --- https://tex.stackexchange.com/a/15276/197451

js bibra
  • 21,280