48

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?

1
  • 3
    Are you sure it's a U in the second example? I'd say it's \bigcup_{b\in B} Commented Aug 28, 2013 at 19:35

2 Answers 2

70

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.
3
  • 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"?? Commented Aug 28, 2013 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 Commented Aug 28, 2013 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. Commented Aug 30, 2013 at 5:21
25

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.

4
  • 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. Commented Mar 24, 2017 at 23:35
  • 1
    @Chill2Macht \overset{n}{\underset{i=1}{\bigwedge}} works well for me. The sugested \DeclareMathOperator* did not work. Commented Feb 12, 2019 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. Commented Feb 12, 2019 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. Commented Feb 12, 2019 at 16:23

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.