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?

  • 3
    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)\}


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.
| 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
  • 5
    @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.

| improve this answer | |
  • This answer is nice because it lets you put the arguments both above and below the expression, whereas using underset/overset you can only do one of the two, not both. – Chill2Macht Mar 24 '17 at 23:35
  • 1
    @Chill2Macht \overset{n}{\underset{i=1}{\bigwedge}} works well for me. The sugested \DeclareMathOperator* did not work. – Evgeny Kuznetsov Feb 12 '19 at 7:37
  • 1
    @EvgenyKuznetsov-- I'm not able to test this at present, but \DeclareMathOperator* is designed to support limits on its argument -- but only in display mode. (Limits would appear to the side in text mode.) This does require amsmath. Since this doesn't work for you, please ask a separate question, providing a complete compilable example showing what you are doing, and cite this question and answer in yours, describing exactly what is different in what you are doing. – barbara beeton Feb 12 '19 at 16:16
  • 2
    @EvgenyKuznetsov \documentclass{article} \usepackage{amsmath} \DeclareMathOperator*{\median}{median} \begin{document} \[ \hat{f}(x,y)= \median_{(s,t)\in S_{xy}} \left\{g(s,t)\right\} \] \end{document} works beautifully on my machine. – user121799 Feb 12 '19 at 16:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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