Graphics, Figures & TablesExplanations of terms in equations

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
pottertl
Posts: 7
Joined: Wed Jan 05, 2011 10:33 pm

Explanations of terms in equations

Post by pottertl »

I'm writing a document that has a number of equations, and in many cases I need to explain what each side of the equation represents. Is there any way to create brackets below each side of an equation and then to write a brief description below the brackets?

Alternatively, I could use lines connecting each side of the equation with a text box containing the explanation.

Any thoughts/ideas on how I can accomplish this? Thanks in advance.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

User avatar
frabjous
Posts: 2064
Joined: Fri Mar 06, 2009 12:20 am

Explanations of terms in equations

Post by frabjous »

How about using \underbrace?

Code: Select all

\documentclass{article}
\usepackage{amsmath}
\begin{document}
\[
\underbrace{A + B + C + D}_{\text{Some terms}} = \underbrace{D + C + B + A}_{\text{The same, reversed.}}
\]
\end{document}
ubrace.png
ubrace.png (5.64 KiB) Viewed 15342 times
If these explanations might get very long, you could use a parbox, I suppose. Here's a method using a defined command for the task:

Code: Select all

\documentclass{article}
\usepackage{amsmath}
\usepackage{calc}
\newcommand{\explain}[2]{\underbrace{#1}_{\parbox{\widthof{#1}}{\footnotesize\raggedright #2}}}
\begin{document}
\[
\explain{A + B + C + D}{Here $A$ is the first letter, and $B$ is the next, and $C$ next, and so on} = \explain{D + C + B + A}{Some other really wordy explanation that goes on for far too long.}
\]
\end{document}
ubrace2.png
ubrace2.png (15.41 KiB) Viewed 15342 times
Tweak as you see fit.

There's an underbracket package if you really want brackets rather than braces. Doesn't appeal as much to me, personally.
pottertl
Posts: 7
Joined: Wed Jan 05, 2011 10:33 pm

Re: Explanations of terms in equations

Post by pottertl »

Thanks so much for your help, and sorry for posting to multiple sub-forums. The second method you suggest, using \parbox, works except when the first argument has "mathematical" terms, such as \delta. I'm trying to sort this out right now. Any ideas why this might be happening and how I could fix it?

Let me know when you have a chance, thanks!
User avatar
frabjous
Posts: 2064
Joined: Fri Mar 06, 2009 12:20 am

Explanations of terms in equations

Post by frabjous »

The problem is with my use of \widthof.

Try this instead:

Code: Select all

\newcommand{\explain}[2]{\underbrace{#1}_{\parbox{\widthof{\ensuremath{#1}}}{\footnotesize\raggedright #2}}}
Post Reply