# How to write something vertically below another math symbol

I have to write some equations in latex, but I'm having trouble finishing them.

My Latex equation for image 1:

\widehat{f}(x,y)=median \left\{g(s,t)\right\}


My Latex equation for image 2:

A\oplus B = U A_{b}


How can I make a subscript below the formulas?

-

## migrated from stackoverflow.comAug 28 '13 at 15:03

This question came from our site for professional and enthusiast programmers.

Are you sure it's a U in the second example? I'd say it's \bigcup_{b\in B} – egreg Aug 28 '13 at 19:35

You want

\hat{f}(x,y) = \underset{(s,t)\in S_{xy}}{\mathrm{median}} \{g(s,t)\}


And

A \oplus B = \underset{b\in B}{\cup} A_b


The important things being:

• \underset which takes two arguments, the first is put under the second.
• \mathrm to make median appear upright and differentiate it from a multiplication of 6 variables named m, e, d, i, a, and n.
• \{ and \} need backslashes because { and } are part of the LaTeX base language.
• \cup which is a nicer symbol for a union.
-
How about this one "g(x,y)=\begin{cases}1 & If s hits f\\ 0 & otherwise\end{cases}". How to add space between "if s hits f"?? – Farhat Mann Aug 28 '13 at 15:19
@FarhatMann This is another question. Please post a new one in these cases. Anyway the answer is g(x,y)=\begin{cases}1 & \text{If $s$ hits $f$}\\ 0 & \text{otherwise}\end{cases} and requires the package amsmath – karlkoeller Aug 28 '13 at 15:55
How to make it displayed in center of the pages? Because if i write the equation, it will display in the left side of the page. – Farhat Mann Aug 30 '13 at 5:21

at least the first example is a case where limits are applied to an operator. using amsmath, put this in the preamble:

\DeclareMathOperator*{\median}{median}


and enter the math expression as

$\hat{f}(x,y)= \median_{(s,t)\in S_{xy}} \left\{g(s,t)\right\}$


with this result:

\DeclareMathOperator will set the specified string as roman, although other alphabet styles can be specified; the starred version causes strings designated as sub- or superscripts to the operator to be set as limits.

for the second example, it's reasonable to treat this the same way, but specifying italic:

\DeclareMathOperator{\Uoperator}{\mathit{U}}


then ... \Uoperator_{b\in B} ... would yield the requested result.

-