TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a diagram like this, explaining a formula:

    $\stackrel[e+f+g+h^i]{a^b}{c d}$

For this example, I have removed the numbers.

  • How can I scale this diagram up, so that each part appears exactly 300% larger?
  • If I am using an OpenType font, will this scaling produce errors?
  • How can I add labels to the formula describing what each part means?
share|improve this question
Labelling each part could be done in a varied number of ways: footnotes, arrows pointing to elements or just a plain textual description. You need to be a little more specific about your needs. – Werner Dec 2 '11 at 2:32
I must label all parts separately ("a" gets a label, "b" gets a label). The labels contain short sentences as descriptions. I see that underbrace's look very nice, but perhaps only can be used in cases where an item is very wide (which I might use in some places). Is there some other element that matches the style of underbrace, but can be used in situations where I must refer to a narrower item? Or place the label to the right or left? – Village Dec 2 '11 at 3:03
Underbrackets are also an option, and the distance from the equation can be varied more directly. I think they look ugly though. Under braces can be used on quite short bits of maths too. The limitation is really just what the label is. I suggest labeling parts with letters and then referring to these letters in the text proper. – qubyte Dec 2 '11 at 4:22
I added an alternative using align, which gives a bit more space. – qubyte Dec 2 '11 at 4:36
Your last bullet point should have been asked as a separate question. – Richard Jun 13 '13 at 21:54
up vote 14 down vote accepted

scalebox should do the trick for you. You'll need the graphicx package. For example:


    $\stackrel[e+f+g+h^i]{a^b}{c d}$


For labels, you can use something like the following

\underbrace{\frac{\hbar\omega_{\mathrm{a}}}{2}\sigma_3                      \rule[-12pt]{0pt}{5pt}}_{\mbox{atom}}
+\underbrace{\hbar\omega\left(a^\dagger a+\frac{1}{2}\right)                \rule[-12pt]{0pt}{5pt}}_{\mbox{field}}
-\underbrace{i\hbar g\left(a-a^\dagger\right)\left(\sigma^++\sigma^-\right) \rule[-12pt]{0pt}{5pt}}_{\mbox{interaction}}\,,

The underbraces highlight a section, and those rule commands allow you to line them up by pushing the under braces down. Labels go in the mboxs,

The result is this

enter image description here

As noted by Werner, replacing \mbox with \text from the amsmath package is a little nicer because it sizes the text properly.

You may also want to consider breaking your equation over multiple lines with the amsmath package and align. This will give you more space.

H_{\mathrm{atom-light}}=\ &\frac{\hbar\omega_{\mathrm{a}}}{2}\sigma_3  &&\mbox{atom}\\
&+\hbar\omega\left(a^\dagger a+\frac{1}{2}\right)                      &&\mbox{field}\\
&-i\hbar g\left(a-a^\dagger\right)\left(\sigma^++\sigma^-\right)\,.    &&\mbox{interaction}

enter image description here

Finally, inspired by Werner I've thrown this together with TikZ:



H_{\mathrm{atom-light}} = 
    \node[draw=red,rounded corners,anchor=base] (m1)
    \node[above of=m1] (l1) {atom};
    \draw[-,red] (l1) -- (m1);
    \node[draw=red,rounded corners,anchor=base] (m2)
    {$\displaystyle\hbar\omega\left(a^\dagger a+\frac{1}{2}\right)$};
    \node[above of=m2] (l2) {field};
    \draw[-,red] (l2) -- (m2);
    \node[draw=red,rounded corners,anchor=base] (m3)
    {$\displaystyle i\hbar g\left(a-a^\dagger\right)\left(\sigma^++\sigma^-\right)$};
    \node[above of=m2] (l3) {interaction};
    \draw[-,red] (l3) -- (m3);


enter image description here

which is based on an equation based on an equation... which I first borrowed from here. In your case however, perhaps it's best to build this from scratch in a TikZ picture. Remember, you can still put it into a scalebox after:

\begin{tikzpicture}[node distance=20pt]
\tikzstyle{boxes}=[draw=red, rounded corners]
\node[boxes] (middle) {\Large$c d$};
\node[boxes,above of=middle] (top) {$\displaystyle a^b$};
\node[boxes,below of=middle] (bottom) {$\displaystyle e+f+g+h^i$};
\node[right of=top, node distance = 35pt] (toplabel) {the top};
\draw[red] (toplabel) -- (top);
\node[left of=middle, node distance = 45pt] (midlabel) {the middle};
\draw[red] (midlabel) -- (middle);
\node[below of=bottom, node distance = 25pt] (botlabel) {the bottom};
\draw[red] (botlabel) -- (bottom);

enter image description here

share|improve this answer
The underbrace's look very good. In rendering them, does TeX use the selected font or is this a custom drawing which will remain the same regardless of the font? – Village Dec 2 '11 at 2:50
mbox will use the typeface from the text surrounding your equation. – qubyte Dec 2 '11 at 2:51
Oh, do you mean the brace itself? – qubyte Dec 2 '11 at 2:52
I think the brace is related to whichever typeface your math mode uses. – qubyte Dec 2 '11 at 3:01
Yes, it's a rectangle with glyphs on either side. – qubyte Dec 2 '11 at 4:38

Scaling in LaTeX is easily obtained by \scalebox{<factor>}{<stuff>} of the graphicx package. It works regardless of what <stuff> is:

enter image description here

\usepackage{graphicx}% http://ctan.org/pkg/graphicx
\usepackage{stackrel}% http://ctan.org/pkg/stackrel
$\stackrel[e+f+g+h^i]{a^b}{c d}$ \quad \scalebox{3}{$\stackrel[e+f+g+h^i]{a^b}{c d}$}

For adding labels to the components of your construction, you could use pst-node from the pstricks bundle. Here is a small mock-up, although I put the construction inside an array, for clearer presentation:

enter image description here

\usepackage{amsmath}% http://ctan.org/pkg/amsmath
\usepackage{graphicx}% http://ctan.org/pkg/graphicx
\usepackage{pst-node}% http://ctan.org/pkg/pst-node
    \node{a}{a}^{\node{b}{\mbox{\scriptsize$b$}}} \\
    \node{c}{c} \node{d}{d} \\
  \uput{20pt}[135]{0}(a){\rnode{a-desc}{\text{This is $a$}}} \ncline{->}{a-desc}{a}
  \uput{3cm}[40]{0}(b){\rnode{b-desc}{\text{This is $b$}}} \ncline{->}{b-desc}{b}
  \uput{140pt}[l]{0}(c){\rnode{c-desc}{\text{This is $c$}}} \ncline{->}{c-desc}{c}
  \uput{5em}[r]{0}(d){\rnode{d-desc}{\text{This is $d$}}} \ncline{->}{d-desc}{d}
  \uput{20pt}[190]{0}(e){\rnode{e-desc}{\text{This is $e$}}} \ncline{->}{e-desc}{e}
  \uput{20pt}[235]{0}(f){\rnode{f-desc}{\text{This is $f$}}} \ncline{->}{f-desc}{f}
  \uput{20pt}[300]{0}(g){\rnode{g-desc}{\text{This is $g$}}} \ncline{->}{g-desc}{g}
  \uput{20pt}[320]{0}(h){\rnode{h-desc}{\text{This is $h$}}} \ncline{->}{h-desc}{h}
  \uput{20pt}[345]{0}(i){\rnode{i-desc}{\text{This is $i$}}} \ncline{->}{i-desc}{i}

The macro \node{<label>}{<stuff>} was defined for ease-of-use. What is contained within the \rnodes used by \node can be anything, even a \parbox if you have long sentences/paragraphs. Also, since this approach uses the rich library of graphical components of pstricks, formatting of (say) \ncline is also possible.

Placement of the "element descriptors" (?-desc) is done using


This places <stuff>, rotated by <rotation> degrees, at a distance <labelsep> and angle <refangle> from x,y (since we're using pst-node, x,y can be represented by a node). <refangle> can also be symbolic angle references, like left, right, up, down, or combinations of these (ur, dl, ...). My knowledge of tikz/pgf is limited, but this is also possible using that design medium; expect some answers using this tool.

Since this uses pstricks, you need to compile with either xelatex or a latex->dvips->ps2pdf sequence.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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