9

I need to put curly braces in front of even number of bullets. The following post works perfectly for odd number of bullets.

Bullet points and curly braces

how can we modify it to for even number of bullets?

Update:

  • Is is possible to have a general solution that adjusts automatically for the number of bullets that we have.

  • I am using a \documentclass{beamer}. But this should not matter. I ma putting this piece of information since all posted solutions had \documentclass{article}

Snapshot of my editor(left pannel) and PDF(right panel)

enter image description here

NAASI
  • 2,809
  • 1
    provided each one of the bullet points occupies only one line, i'd attach the brace construction to the item just above the middle, and move it lower by .5\baselineskip + .5\itemsep + .5\parsep. probably a bit more complicated, because it has to be put in a box, but that should give a starting point for experimentation. – barbara beeton Aug 06 '15 at 19:57

4 Answers4

9

One option that would work for any kind of elements (\item bullets (even or odd number) or whatever), would be to use TikZ and its tikzmark library. Place some marks at the desired locations and then use those marks to draw the brace with its accompanying text:

\documentclass{article}
\usepackage{amsmath}
\usepackage{tikz}
\usetikzlibrary{tikzmark,decorations.pathreplacing}

\begin{document}

\begin{itemize}
  \item Riemann Sum\tikzmark{start}
  \item
  Trapezoidal Rule
  \item
  Simpson's 1/3 Rule
  \item
  Simpson's 3/8 Rule\tikzmark{end}
\end{itemize}

\begin{tikzpicture}[remember picture,overlay]
\draw[decorate,decoration={brace,raise=12pt}]
  ([yshift=2ex]{{pic cs:end}|-{pic cs:start}}) --
    node[xshift=15pt,anchor=west] {some test text} 
  ([yshift=-0.5ex]pic cs:end);
\end{tikzpicture}

\end{document}

enter image description here

Gonzalo Medina
  • 505,128
  • I am getting a compiler error related to \usetikzlibrary{tikzmark,decorations.pathreplacing}. ! I can't find file tikzlibrarytikzmark.code.tex'.<argument> ...nput tikzlibrary\pgf@temp .code.tex\catcode@ =\csname tikz... ...ibrary{tikzmark,decorations.pathreplacing} – NAASI Aug 06 '15 at 21:01
  • I think your solution is more flexible but I dont understand why I am getting this error – NAASI Aug 06 '15 at 21:42
  • 1
    @NAASI The error message indicates that your LaTeX system is outdated. Update it and the problem will disappear. – Gonzalo Medina Aug 06 '15 at 22:30
  • @NAASI Or search the site for \tikzmark implementations; IIRC, it was conceived here. – Raphael Aug 07 '15 at 10:30
8

enter image description here

\documentclass{article}
\usepackage{amsmath}
\begin{document}

\begin{itemize}
  \item Riemann Sum
  \item Trapezoidal Rule 
  \item Simpson's 1/3 Rule
  \item Simpson's 3/8 Rule % 
  \smash{\raisebox{.5\dimexpr3\baselineskip+4\itemsep+2\parskip}{$\left.\rule{0pt}{.5\dimexpr4\baselineskip+3\itemsep+3\parskip}\right\}\text{Newton Cotes formulae of different degrees}$}}
\end{itemize}

\end{document}

For beamer class, \linewidth is much smaller and you need to put the text into a \parbox to allow text wrap. Note also that itemize environment in beamer is totally different from that in normal classes, so, you may need some manual adjustments:

enter image description here

\documentclass{beamer}
\usepackage{amsmath,lmodern}
\begin{document}

\newcommand{\insm}{%
\smash{\raisebox{.5\dimexpr3\baselineskip+4\itemsep+2\parskip}{$\left.\rule{0pt}{.5\dimexpr4\baselineskip+3\itemsep+3\parskip}\right\}$\ \parbox{5.5cm}{Newton Cotes formulae of different degrees}}}
}

\begin{frame}
\begin{itemize}
  \item Riemann Sum 
  \item Trapezoidal Rule 
  \item Simpson's 1/3 Rule
  \item Simpson's 3/8 Rule \insm
\end{itemize}
\end{frame}

\end{document}

Finally, a flexible tikz solution (since I'm personally fond of tikz, I decided to post an alternative beautiful solution with tikz):

enter image description here

\documentclass{beamer}
\usepackage{amsmath,lmodern,calc,tikz,textcomp}
\usetikzlibrary{tikzmark,calc}
\begin{document}

\newcommand\insm{%
$\left.\rule{0pt}{2.5\baselineskip}\right\}$\parbox{\textwidth-2ex}{%
\begin{itemize}
\item[\textbullet] Newton Cotes formulae ...
\item[\textbullet] Newton Cotes formulae ...
\end{itemize}}
}    
\begin{frame}
\begin{itemize}
  \item Riemann Sum 
  \item Trapezoidal Rule\tikzmark{S}
  \item Simpson's 1/3 Rule\tikzmark{E}
  \item Simpson's 3/8 Rule 
\end{itemize}    
\tikz[remember picture, overlay]{%
\node [shift={(1ex,.6ex)},text width=6.5cm,anchor=west] at ($(pic cs:S)!.5!(pic cs:E)$){\insm};}
\end{frame}

\end{document}
AboAmmar
  • 46,352
  • 4
  • 58
  • 127
  • I tried your solution but it is putting the bracket right next to bullets i-e before the text – NAASI Aug 06 '15 at 20:48
  • @NAASI Make sure you didn't insert an extra \item before \smash{.... Try first my solution as is, does that error appear? – AboAmmar Aug 06 '15 at 20:52
  • I am using a \documentclass{beamer}. Can this be the reason because I just copied your solution in my frame and am getting the same results – NAASI Aug 06 '15 at 20:57
  • @NAASI That is because the text is longer than the \textwidth in beamer. – AboAmmar Aug 06 '15 at 21:04
  • how can we fix this?I have added a snapshot of whats going on in my original question – NAASI Aug 06 '15 at 21:06
  • @NAASI Please see my edit. – AboAmmar Aug 06 '15 at 21:13
  • Got it. One last thing. Lets say That I have to write two separate facts (in form of bullets) on right side of bracket. How can we achieve that? – NAASI Aug 06 '15 at 21:18
  • @NAASI Use the itemize environment as usual, and change the triangle to bullet or whatever you like. For example, \begin{itemize} \item[\textbullet] Riemann Sum \item[\textbullet] Trapezoidal Rule \item[\textbullet] Simpson's 1/3 Rule \item[\textbullet] Simpson's 3/8 Rule \end{itemize}. – AboAmmar Aug 06 '15 at 21:39
  • I need to put two facts on right side of bracket i-e 1. Newton blah blah blah 2. John blah blah blah – NAASI Aug 06 '15 at 21:52
  • @NAASI Yes, put it here : \parbox{5.5cm}{<HERE>}. Replace HERE with your two facts. – AboAmmar Aug 06 '15 at 22:34
2

I propose an environment, braceditemize that simulates an itemize environment, within a blockarray environment. It has an optional argument, the text that will be to the right of the brace:

\documentclass{article}
\usepackage{mathtools, etoolbox}
\usepackage{blkarray}
\usepackage[showframe, nomarginpar]{geometry}

\newcommand\tabitem{\ifbool{firstrow}{\relax}{\\[\itemsep]}\boolfalse{firstrow}\makebox[\labelwidth][r]{\textbullet}\hspace*{\labelsep}}
\newbool{firstrow}
\newenvironment{braceditemize}[1][]{%
\booltrue{firstrow}
\vspace*{\topsep}\par\noindent
\setlength\BAextrarowheight{\parsep}\begin{blockarray}{@{}l <{\enspace}\Right{\}}{#1}}}
{\rule[-\itemsep-\parsep]{0pt}{\itemsep + \parsep}\end{blockarray}}

\begin{document}

Text text text text text text text text text text text text text

\begin{braceditemize}[Newton-Cotes formulae of different degrees]
  \tabitem Riemann Sum
  \tabitem Trapezoidal Rule
  \tabitem Simpson's 1/3 Rule
  \tabitem Simpson's 3/8 Rule
\end{braceditemize}

\end{document}

enter image description here

Bernard
  • 271,350
1

enter image description here

\documentclass{article}
\usepackage{amsmath}
\begin{document}


\begin{itemize}
  \item Riemann Sum

  \item
  Trapezoidal Rule

  \item
  Simpson's 1/3 Rule
    $\smash{\left.\rule{0pt}{.5\dimexpr3\baselineskip+2\itemsep+2\parskip}\right\}
      \text{Newton Cotes formulae of different degrees}}$

  \item
  Simpson's 3/8 Rule
\end{itemize}


\begin{itemize}
  \item Riemann Sum

  \item
  Trapezoidal Rule

  \item
  Simpson's 1/3 Rule
    \smash{\raisebox{.5\dimexpr\baselineskip+\itemsep+\parskip}{%
    $\left.\rule{0pt}{.5\dimexpr4\baselineskip+3\itemsep+3\parskip}\right\}$
      Newton Cotes formulae of different degrees}}

  \item
  Simpson's 3/8 Rule
\end{itemize}

\end{document}
Tarass
  • 16,912