I need to make brackets of various kinds stretch with the length of the argument below and above. They require rotation of text inside a rotated matrix.

For example, I am trying to make a round bracket below and above text, similar to underbrace and overbrace. But the rotation inside a rotation, so that text is properly oriented, does not compile. What am I doing wrong?

(If such a function already exists, that is an answer to the question, of course, but I would also like to know in that case the correct way to stack rotate boxes, too, for general knowledge.)

\def\underround #1 {\ensuremath{\rotatebox{90}{\begin{pmatrix}\;\rotatebox{-90}{#1}\;   \,\end{matrix}}}}%
\def\overround #1 {\ensuremath{\rotatebox{-90}{\begin{pmatrix}\;\rotatebox{90}{#1}\;\,\end{matrix}}}}
\def\underbracket #1 {\ensuremath{\rotatebox{90}{\begin{bmatrix}\;\rotatebox{-90}{#1}\;   \,\end{matrix}}}}%
\def\overbracket #1 {\ensuremath{\rotatebox{-90}{\begin{bmatrix}\;\rotatebox{90}{#1}\;\,\end{matrix}}}}
$\underround text $
  • please fix your example so it demonstrates the problem you describe, currently it just generates ! LaTeX Error: Environment tikzpicture undefined. Sep 27, 2014 at 16:55
  • Your right. I extracted it from a larger code. fixed now. Sep 27, 2014 at 17:05

1 Answer 1


Your example has several typos, pmatrix has to be in math mode, and ended by \end{pmatrix} not \end{matrix}, unused reference to an undefined tikzpicture environment etc.

If I fix those it works as I think you intended

\def\underround #1{\ensuremath{\rotatebox{90}{$\begin{pmatrix}\;\rotatebox{-90}{#1}\;\,\end{pmatrix}$}}}%
\def\overround #1{\ensuremath{$\rotatebox{-90}{$\begin{pmatrix}\;\rotatebox{90}{#1}\;\,\end{pmatrix}$}}}
$\underround{text} $
  • BTW, the lack of p in the end is intentional. I needed only under brackets or over brackets but not both at once. Sep 27, 2014 at 17:12
  • @GuidoJorg Oh, sorry. it may have been intentional but it can't possibly work, latex environments have to have matching begin and end Sep 27, 2014 at 17:14
  • I see what happened. An \overbracket and \underbracket command indeed exists. I had a typo in the macro, and the existing command was working instead. Fixed the typo and code doesn't compile. I suppose \left\ ... \right. environments are required. Sep 27, 2014 at 17:26

You must log in to answer this question.

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