Thursday, July 03, 2008

Stack math symbols in Latex

When typing in formulas in Latex, sometimes we need to stack math symbols, especially with arrows. Here are some examples that show how to achieve this goal.
1. Using \xleftarrow or \xrightarrow. Both of them have the same syntax.
a=b \xleftarrow[H]{\xi+a\timesc} f=g

2. Using \overset
a=b\overset{F}{\longleftarrow}c=d

3. Using \underset
a=b\underset{F}{\longleftarrow}c=d

4. Using \stackrel
a=b \stackrel{F}{\longleftrightarrow}c=d

5. Using \mathop
ab \mathop{\sum\sum\sum}_{a=\frac{1}{2}\times 100000}^{b=\frac{4}{5}}cd

Chinese version:Latex: 堆叠数学符号

1. What about stacking *directly* on top (in the Z-axis)? For example, I'd like a 3 inside a \square.

2. Sorry, cannot understand your question. I don't think there is a "\square" in Latex.

3. If you mean superscript, use "^".

4. To stack directly on top, use a zero-width box, such as "\makebox[0pt][l]{\huge$\triangle$}\ \ 3"

5. I want to put a 1 directly below the center of a binomial factor in the denominator of a rational expression to show division to 1 when cancelling a factor. \underset is not working. Do you have any other suggestions?

6. Hi, George,

I tried the code

a =\frac{(a-b)^2}{\underset{1}{a-b}}
\label{eq:tes}

and it is working. If this is not you want, could you please upload a photo of the equation?