46

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?

Ry-
  • 101
Farhat Mann
  • 1,515

2 Answers2

68

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.
rubenvb
  • 3,883
  • 4
  • 26
  • 36
  • 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 05:21
24

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:

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:

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

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

  • 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 07: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. –  Feb 12 '19 at 16:23