# Multiline brackets within a {description} environment

Is it possible to have multiline brackets within a description environment? For instance, I'm looking to bracket the three items below without switching into a table or array environment.

If this is possible, is it then possible to have nested brackets? Could I have an outer bracket connecting A to C and an inner bracket connecting B and C?

\documentclass{report}

\begin{document}

\begin{description}

\item[A] First one \hfill \\
Other text

\item[B] Second one \hfill \\
Other text

\item[C] Second one \hfill \\
Other text

\end{description}

\end{document}
• Welcome to TeX.SX! Please help us to help you and add a minimal working example (MWE) that illustrates your problem. It will be much easier for us to reproduce your situation and find out what the issue is when we see compilable code, starting with \documentclass{...} and ending with \end{document}.
– user31729
Nov 8 '14 at 21:16
• Especially: Which brackets do you mean?
– user31729
Nov 8 '14 at 21:16
• I was hoping for square brackets such as [], but really any bracket types will work. (Sorry, I forgot to include the document class in the MWE; that's been fixed.) Nov 8 '14 at 21:39

One way to do this is to use \tikzmark to mark the specfic start and end points of the brace and the draw the brace using tikz:

## Notes:

• For the case of left brackets/braces, if you want to ensure that your braces and an other labels are with the margins, you need to move the list over to the right a bit. This can be easily done with the enumitem package via \usepackage{enumitem} and:

\begin{description}[leftmargin=!, labelwidth=1.75cm, align=right]

• For the brackets/braces on the right hand side you need to be carefully in providing the \tikzmark for the right most portion of the text. This allows computation of how far to the right to place the bracket. If the right hand side of the text is all the way to the right margin, the you need to either adjust the linewidth of the environment so that there is adequate room for the bracket (and optional text), or be ok with the bracket and optional text being in the margin.

• The node text is option, so if you don't want that you can pass in an empty parameter {}.

• This does require two runs. First one to determine the locations, and the second to do the drawing.

• The \tikzmark is from Adding a large brace next to a body of text.

## Code:

\documentclass{report}

\usepackage{enumitem}
\usepackage{xparse}
\usepackage{tikz}
\usetikzlibrary{calc,decorations.pathreplacing}

\newcommand{\tikzmark}[1]{%
\tikz[overlay,remember picture,baseline] \node [anchor=base] (#1) {};}

\NewDocumentCommand\LeftBrace{%
O{}% #1 = draw options
O{0pt}% #2 = shift to be applied (optional, for use with nested braces)
m% #3 = top \tikzmark name
m% #4 = bottom \tikzmark name
m% #5 = node text
}{%
\begin{tikzpicture}[overlay,remember picture,baseline]
\coordinate (Top Start of Bracket)    at ([shift={(#2-12pt,3pt)}]#3.north east);
\coordinate (Bottom Start of Bracket) at ([shift={(#2-12pt,2pt)}]#4.south east);

\draw[decorate,decoration={brace,raise=6pt, amplitude=1.0ex, mirror}, ultra thick, #1]
(Top Start of Bracket) --
node[xshift=-10pt, align=left, anchor=east, #1] {#5}
(Bottom Start of Bracket);
\end{tikzpicture}
}
\NewDocumentCommand\RightBrace{%
O{}% #1 = draw options
O{0pt}% #2 = shift to be applied (optional, for use with nested braces)
m% #3 = top \tikzmark name
m% #4 = bottom \tikzmark name
m% #5 = right most \tikzmark name
m% #6 = node text
}{%
\begin{tikzpicture}[overlay,remember picture,baseline]
\coordinate (Top Start of Bracket)    at ($(#5)!([yshift=3pt]#3.north)!(#5)$);
\coordinate (Bottom Start of Bracket) at ($(#5)!([yshift=3pt]#4.south)!(#5)$);

\draw[decorate,decoration={brace,raise=6pt, amplitude=1.0ex, mirror}, ultra thick, #1]
([xshift=#2]Bottom Start of Bracket) --
node[xshift=10pt, align=left, anchor=west, #1] {#6}
([xshift=#2]Top Start of Bracket);
\end{tikzpicture}
}

\newcommand*{\BracektStubSize}{0.5em}%
\NewDocumentCommand\LeftBracket{%
O{}% #1 = draw options
O{0pt}% #2 = shift to be applied (optional, for use with nested braces)
m% #3 = top \tikzmark name
m% #4 = bottom \tikzmark name
m% #5 = node text
}{%
\begin{tikzpicture}[overlay,remember picture,baseline]
\coordinate (Top Start of Bracket) at ([shift={(#2-15pt,5pt)}]#3.north east);
\coordinate (Bottom Start of Bracket) at ([shift={(#2-15pt,2pt)}]#4.south east);
\draw[ultra thick, #1]
(Top Start of Bracket) --++(-\BracektStubSize,0)
|-(Bottom Start of Bracket) ;

\node[xshift=-5pt, align=left, anchor=east, #1]
at ($(Bottom Start of Bracket)!0.5!(Top Start of Bracket)$) {#5};
\end{tikzpicture}
}
\NewDocumentCommand\RightBracket{%
O{}% #1 = draw options
O{0pt}% #2 = shift to be applied (optional, for use with nested braces)
m% #3 = top \tikzmark name
m% #4 = bottom \tikzmark name
m% #5 = right most \tikzmark name
m% #6 = node text
}{%
\begin{tikzpicture}[overlay,remember picture,baseline]
\coordinate (Top Start of Bracket)    at ($(#5)!([yshift=3pt]#3.north)!(#5)$);
\coordinate (Bottom Start of Bracket) at ($(#5)!([yshift=3pt]#4.south)!(#5)$);

\draw[ultra thick, #1]
([xshift=#2]Bottom Start of Bracket) -- ++(\BracektStubSize,0)
|- ([xshift=#2]Top Start of Bracket) ;

\node[xshift=10pt, align=left, anchor=west, #1]
at ($(Bottom Start of Bracket)!0.5!(Top Start of Bracket)$)
{#6};
\end{tikzpicture}
}

\SetLabelAlign{parright}{\strut\smash{\parbox[t]{\labelwidth}{\raggedleft#1}}}
\begin{document}

\begin{description}[leftmargin=!, labelwidth=1.75cm, align=right]
\item[A] \tikzmark{Mark A}First one \hfill \\
Other text

\item[B] \tikzmark{Mark B}Second longer one\tikzmark{Right Most Node}\hfill \\
Other text

\item[C] \tikzmark{Mark C}Second one \hfill \\
Other text
\end{description}
\LeftBracket[blue][-7pt]{Mark A}{Mark C}{ABC}
\LeftBracket[red]{Mark B}{Mark C}{}
\RightBracket[violet][7pt]{Mark A}{Mark C}{Right Most Node}{EFG}
\RightBracket[olive]{Mark B}{Mark C}{Right Most Node}{}

\begin{description}[leftmargin=!, labelwidth=1.75cm, align=right]
\item[A] \tikzmark{Mark A}First one \hfill \\
Other text

\item[B] \tikzmark{Mark B}Second longer one\tikzmark{Right Most Node}\hfill \\
Other text

\item[C] \tikzmark{Mark C}Second one \hfill \\
Other text
\end{description}
\LeftBrace[magenta][-7pt]{Mark A}{Mark C}{UVW}
\LeftBrace[cyan]{Mark B}{Mark C}{}
\RightBrace[orange][7pt]{Mark A}{Mark C}{Right Most Node}{XYZ}
\RightBrace[olive]{Mark B}{Mark C}{Right Most Node}{}
\end{document}