# “Where” notation in definition

I need to define a rather complex operation. Hence I want to use the classical "where" definition style, i.e.

Foo = Bar(x,y)
WHERE
x = Baz
y = Fob


My attempt so far in latex is:

\begin{align*}
\text{Foo} = \text{Bar}(x,y) && \mathbf{where} \\
x = \text{Baz}
\end{align*}


I am not really satisfied with the result, though:

• The where keyword does not really stand out from the layout
• The helper definitions are on the same level as the main definition

So instead of fiddling around with it, is there some kind of (semi-) canonical way to layout such definitions?

-
Is that maths you're writing? Or some code? If the latter, you should use a package for typesetting source code, such as listings or minted. – Jubobs Mar 24 '14 at 9:26
its pure math, code would be easy... – choeger Mar 24 '14 at 9:27
As Bernard mentioned in his answer, \intertext from amsmath (and \shortintertext from mathtools) seem sufficient: gist.github.com/9741278 (This is more or less just a simplification of the existing answer, thus this comment.) – Sean Allred Mar 24 '14 at 14:39

I'm guessing you're using the \text macro to typeset stuff in roman font, but that's bad pratice because semantically incorrect: the \text macro should be reserved for typesetting phrases such as "where", "for all", "subject to", etc. within display math environments (e.g. equation, align, etc.), not for variables or function names. You should use the \mathrm macro, instead, here.

Here's how I would write your equations:

\documentclass{article}

\usepackage{amsmath}

\newcommand\Foo{\mathrm{Foo}}
\newcommand\Barfun{\mathrm{Bar}}
\newcommand\Baz{\mathrm{Baz}}
\newcommand\Fob{\mathrm{Fob}}

\begin{document}
%
\begin{align*}
\Foo &= \Barfun(x,y) \\
\intertext{where}
x    &= \Baz         \\
y    &= \Fob
\end{align*}
%
\end{document}

-
Usually function names with more than one letter are typeset upright. Still, if you think it's better in italics, at least, put it in \mathit so it has better spacing. – Manuel Mar 24 '14 at 9:52
To your last edit, don't think of \operatorname as something that defines an operator, rather as something like \mathrmwithfinespacing. – Manuel Mar 24 '14 at 10:10
@Manuel You're wrong: \operatorname does build an operator atom. – egreg Mar 24 '14 at 10:12
@Manuel Try $\operatorname{A}+\operatorname{B}$ and compare with $\mathrm{A}+\mathrm{B}$. The first is wrong, the second is correct. – egreg Mar 24 '14 at 10:18
@egreg You are right, that's something I wasn't aware of. – Manuel Mar 24 '14 at 10:22
\documentclass{article}
\usepackage{amsmath}

\begin{document}

\begin{align*}
f &= f(x,y)\\
\makebox[0.6em][l]{where} & \\
x &= g(z)\\
y &= h(z,x)
\end{align*}

\end{document}


-

With another alignment and a smaller vertical spacing:

\documentclass{article}

\usepackage{mathtools}
\DeclareMathOperator{\Barr}{Bar}

\begin{document}
\begin{align*}
&  Foo   = \Barr(x,y)\\
\shortintertext{where}
\begin{cases}
{} \\ {}
\end{cases}
\hspace{-1.1em}
&
\begin{array}{@{}l}
x= Baz\\[6pt]
y= Fob
\end{array}
\end{align*}
\end{document}


-
caveat lector: it's not important to the core layout approach, but care should be taken for Foo's, Baz's, and Bar's kerning in math mode. – Sean Allred Mar 24 '14 at 14:26

Another option.

If the function name has more than one letter, it is usually typeset upright. If you are only using it once or twice, you can use \operatorname{Foo}, but if you are using it more times, may be it's worth defining a new command for them:

\documentclass{scrartcl}

\usepackage{mathtools}
\DeclareMathOperator\Fo{Foo}
\DeclareMathOperator\Ba{Bar}
\DeclareMathOperator\Bz{Baz}
\DeclareMathOperator\Fb{Fob}

\begin{document}

\begin{align*}
\Fo &= \Ba(x,y) \\ \intertext{where}
x &= \Bz \\
y &= \Fb
\end{align*}

\end{document}


After a little discussion it was shown that \operatorname{A}+\operatorname{B} and \mathrm{A}+\mathrm{B} give different results (which I didn't know). So, my answer is not necessarily right (probably not).

I leave it here in case they are, in fact, operators.

-
Those are not math operators. – Jubobs Mar 24 '14 at 10:03
I don't know what I would call an operator. – Manuel Mar 24 '14 at 10:05