See below for expanded answer.
Here is the dBmatrix
and dpmatrix
environments, using code from the cited question and the environ
package. My tikz
is primitive, so I am still trying to figure out how to get bracket decorations.
\documentclass{article}
\usepackage{tikz,amsmath,environ}
\usetikzlibrary{decorations.pathreplacing,calligraphy}
\NewEnviron{dBmatrix}{\setbox0=\hbox{$\,\begin{matrix}\BODY\end{matrix}\,$}%
\setbox2=\hbox{\begin{tikzpicture}
\draw [dashed, thick, decorate, decoration={brace, amplitude=5pt}] (0,\botdim)--(0,\topdim);
\copy0
\draw [dashed, thick, decorate, decoration={brace, amplitude=5pt}] (0,\topdim)--(0,\botdim);
\end{tikzpicture}}
\vcenter{\hbox{\copy2}}}
\NewEnviron{dpmatrix}{\setbox0=\hbox{$\,\begin{matrix}\BODY\end{matrix}\,$}%
\setbox2=\hbox{\begin{tikzpicture}
\draw [dashed, thick, decorate, decoration={calligraphic straight parenthesis, amplitude=1pt}] (0,\botdim)--(0,\topdim);
\copy0
\draw [dashed, thick, decorate, decoration={calligraphic straight parenthesis, amplitude=1pt}] (0,\topdim)--(0,\botdim);
\end{tikzpicture}}
\vcenter{\hbox{\copy2}}}
\def\topdim{\dimexpr+\ht0+.5\ht\strutbox-.5\dp\strutbox-3pt\relax}
\def\botdim{\dimexpr-\ht0+.5\ht\strutbox-.5\dp\strutbox+3pt\relax}
\begin{document}
\[
\begin{Bmatrix}
0 & 1 \\ 2& 3
\end{Bmatrix}%
\quad
\begin{dBmatrix}
0 & 1 \\ 2& 3
\end{dBmatrix}
\]
\[
\begin{pmatrix}
0 & 1 \\ 2& 3\\4 & 5
\end{pmatrix}%
\quad
\begin{dpmatrix}
0 & 1 \\ 2& 3\\4& 5
\end{dpmatrix}
\]
\end{document}
Employing Peter Grill's answer at draw round/rectangular bracket embracing nodes in tikz allowed for the definition of rounded parens as well as square bracket decorations. Thus, the look here is slightly different than above. So here, dpmatrix
is redefined from above and dbmatrix
is introduced.
\documentclass{article}
\usepackage{tikz,amsmath,environ}
\usetikzlibrary{decorations.pathreplacing,calligraphy,calc}
\tikzset{
ncbar angle/.initial=90,
ncbar/.style={
to path=(\tikztostart)
-- ($(\tikztostart)!#1!\pgfkeysvalueof{/tikz/ncbar angle}:(\tikztotarget)$)
-- ($(\tikztotarget)!($(\tikztostart)!#1!\pgfkeysvalueof{/tikz/ncbar angle}:(\tikztotarget)$)!\pgfkeysvalueof{/tikz/ncbar angle}:(\tikztostart)$)
-- (\tikztotarget)
},
ncbar/.default=0.5cm,
}
\tikzset{square left brace/.style={ncbar=0.5ex}}
\tikzset{square right brace/.style={ncbar=-0.5ex}}
\tikzset{round left paren/.style={ncbar=0.3cm,out=115,in=-115}}
\tikzset{round right paren/.style={ncbar=0.3cm,out=65,in=-65}}
%
\NewEnviron{dBmatrix}{\setbox0=\hbox{$\,\begin{matrix}\BODY\end{matrix}\,$}%
\setbox2=\hbox{\begin{tikzpicture}
\draw [dashed, thick, decorate, decoration={brace, amplitude=5pt}] (0,\botdim)--(0,\topdim);
\copy0
\draw [dashed, thick, decorate, decoration={brace, amplitude=5pt}] (0,\topdim)--(0,\botdim);
\end{tikzpicture}}
\vcenter{\hbox{\copy2}}%
}
\NewEnviron{dpmatrix}{\setbox0=\hbox{$\,\begin{matrix}\BODY\end{matrix}\,$}%
\setbox2=\hbox{\begin{tikzpicture}
\draw [dashed, thick] (0,\botdim) to [round left paren] (0,\topdim);
\copy0
\draw [dashed, thick] (0,\botdim) to [round right paren] (0,\topdim);
\end{tikzpicture}}
\vcenter{\hbox{\copy2}}%
}
\NewEnviron{dbmatrix}{\setbox0=\hbox{$\,\begin{matrix}\BODY\end{matrix}\,$}%
\setbox2=\hbox{\begin{tikzpicture}
\draw [dashed, thick] (0,\botdim) to [square left brace] (0,\topdim);
\copy0
\draw [dashed, thick] (0,\botdim) to [square right brace] (0,\topdim);
\end{tikzpicture}}
\vcenter{\hbox{\copy2}}%
}
\def\topdim{\the\dimexpr+\ht0+.5\ht\strutbox-.5\dp\strutbox-3pt\relax}
\def\botdim{\the\dimexpr-\ht0+.5\ht\strutbox-.5\dp\strutbox+3pt\relax}
\begin{document}
\[
\begin{Bmatrix}
0 & 1 \\ 2& 3
\end{Bmatrix}%
\quad
\begin{dBmatrix}
0 & 1 \\ 2& 3
\end{dBmatrix}
\]
\[
\begin{pmatrix}
0 & 1 \\ 2& 3\\4 & 5
\end{pmatrix}%
\quad
\begin{dpmatrix}
0 & 1 \\ 2& 3\\4& 5
\end{dpmatrix}
\]
\[
\begin{bmatrix}
0 & 1 \\ 2& 3
\end{bmatrix}%
\quad
\begin{dbmatrix}
0 & 1 \\ 2& 3
\end{dbmatrix}
\]
\end{document}
You can use a minipage
as follows:
\documentclass{article}
\begin{document}
\begin{itemize}
\item Riemann Sum
\item Newton Cotes formulae of different degrees
\(
\left\{ \quad
\begin{minipage}[c]{0.3\linewidth}
\item Trapezoidal Rule
\item Simpson's \( 1/3 \) Rule
\item Simpson's \( 3/8 \) Rule
\end{minipage}
\right.
\)
\end{itemize}
\end{document}
Alternatively you can use a tabular
:
\documentclass{article}
\begin{document}
\begin{itemize}
\item Riemann Sum
\item Newton Cotes formulae of different degrees
\(
\left\{
\begin{tabular}{@{\textbullet\enspace}l}
Trapezoidal Rule \\
Simpson's \( 1/3 \) Rule \\
Simpson's \( 3/8 \) Rule
\end{tabular}
\right.
\)
\end{itemize}
\end{document}
This avoids having to specify the width, but means that you have to provide the itemize
-like markup yourself.
As Schweinebacke points out there is also the varwidth
environment from the varwidth
package, that will replace minipage
and you just specify a maximum width. However it behaves slightly differently: the itemize list is now at second level, so by default bullets are replaced by dashes, and there is a considerable left margin indentation. So if want the same type of appearance as before you need to modify the itemize
style, e.g. via the enumitem
package:
\documentclass{article}
\usepackage{varwidth}
\usepackage{enumitem}
\begin{document}
\begin{itemize}
\item Riemann Sum
\item Newton Cotes formulae of different degrees
\(
\left\{
\begin{varwidth}{\textwidth}
\begin{itemize}[label=\textbullet,leftmargin=1em]
\item Trapezoidal Rule
\item Simpson's \( 1/3 \) Rule
\item Simpson's \( 3/8 \) Rule
\end{itemize}
\end{varwidth}
\right.
\)
\end{itemize}
\end{document}
If you really want to avoid math mode and use tikz
then you can use
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{decorations.pathreplacing,calc}
\begin{document}
\begin{itemize}
\item Riemann Sum
\item Newton Cotes formulae of different degrees
\begin{tikzpicture}[baseline]
\node[inner ysep=0pt] (A) at (0,0) {
\begin{tabular}{@{\textbullet\enspace}l}
Trapezoidal Rule \\
Simpson's \( 1/3 \) Rule \\
Simpson's \( 3/8 \) Rule
\end{tabular}};
\draw [decoration={brace,amplitude=0.5em},decorate,thick]
(A.south west) -- (A.north west);
\end{tikzpicture}
\end{itemize}
\end{document}
which is at tabular at heart. In my opinion, the math mode option is easier.
Best Answer
With
Bmatrix
fromamsmath
: