

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer

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

Image 1

My Latex equation for image 1:

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

Image 2

My Latex equation for image 2:

A\oplus B = U A_{b}

How can I make a subscript below the formulas?

share|improve this question

migrated from stackoverflow.com Aug 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
up vote 10 down vote accepted

You want

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


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.
share|improve this answer
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:


and enter the math expression as

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

with this result:

output of example code

\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:


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

share|improve this answer

Your Answer


