# rotate box in reverse inside a rotate box ? possible?

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.)

\documentclass[border=4pt]{article}\usepackage{amssymb,mathtools}
%LABELCONVENTION
\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}}}}
\begin{document}
$\underround text$
\end{document}
• please fix your example so it demonstrates the problem you describe, currently it just generates ! LaTeX Error: Environment tikzpicture undefined. – David Carlisle Sep 27 '14 at 16:55
• Your right. I extracted it from a larger code. fixed now. – Guido Jorg Sep 27 '14 at 17:05

## 1 Answer

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

\documentclass{article}
\usepackage{amssymb,mathtools}
%LABELCONVENTION
\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}$}}} \begin{document}$\underround{text} \$
\end{document}
• BTW, the lack of p in the end is intentional. I needed only under brackets or over brackets but not both at once. – Guido Jorg Sep 27 '14 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 – David Carlisle Sep 27 '14 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. – Guido Jorg Sep 27 '14 at 17:26