I would like to know how to make a nested comments (see figure) for a equation.

Kind Regards S.L.

nested comments


Adapted from my answer at How to link two terms in math mode, though I had to make some changes. First, you helped me discover a bug there (which I fixed), when the label was wider than the underset material. But in addition, I had to introduce a new dimension.

EDITED to improve syntax, but the basic macro is \ubar{left term}{middle stuff}{right term}{label}. In order to nest them, I now provide \addlevel and \subtractlevel.

To change the nest level (bracket depth), pre-emptively invoke \addlevel prior to the invocation (can be done more than once). Then, within the middle stuff, you can invoke \subtractlevel to reduce the bracket depth. In these two macros, I merely play with the strut height.

However, if you wish to adapt \addlevel and \subtractlevel to alter any of the dimensions, those at your disposal are:

\rldp the vertical underset of the horizontal bar

\rlht the height of the vertical struts below the math

\rlwd the rule width, and

\rlstub the height of the bottom (central) rule leading to the undertext


f + ghick = lmn\]

{\subtractlevel\subtractlevel \ubar{a}{^2 + b}{^2}
  {\text{sides}} = \addlevel \ubar{}{c^2}{}{\text{\makebox[3ex][r]{hypotenuse}}}}
{\text{The Pythagorean Theorem}}\]

enter image description here

  • Thanks so much for your help. The code defiantly helps me a lot. Have a nice day :). – SLN Jun 5 '14 at 13:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.