# How Do I Horizontally Center An Operator Relative To Aligned Equations Above and Below

I want to achieve the following effect in a new enviornment I'm defining where the stuff inside what's supposed to be delimeters is a \begin{aligned} \end{aligned} block.

/ math math math math math \ (outside aligned)| \lor | \ math math /


This is all straightforward except I want to center the \lor inside the aligned equations, i.e., center it between the two delimiters. How do I do this in a macro (no hand setting alignment characters)?

Do I need to make the \lor a middle delimiter or something? Note sometimes the outside delimiters may need to be invisible if not absent entirely but \lor should still be centered inside the aligned environment.

-

I do not understand what exactly should be in the new environment.

\documentclass{article}
\usepackage{amsmath}

\begin{document}

\begin{align}
\text{(outside aligned)}
\left(\arraycolsep=1.35pt
\begin{array}{@{}rl@{}}
f(x) &= g(x)+h(x)\\
\multicolumn{2}{c}{\lor}\\
f(x) &= x
\end{array}
\right)
\end{align}
\end{document}


-
I think the text "outside aligned" is supposed to be, well, outside the align environment. –  Tyson Williams Jan 18 '14 at 22:19

I'm not totally positive, but are you looking for something like this?

\documentclass{article}
\usepackage{amsmath}
\usepackage{mathtools}

\makeatletter
\begingroup
\ifx\relax#1\relax
\else
\fi
\endgroup
}
\setbox0\hbox{$\m@th#1#2$}%
\rlap{\hbox to\wd0{\hfill$\m@th#1\lor$\hfill}}%
\box0
}
\makeatother
\begin{document}
\text{(outside aligned)} \left< \addlor{ \begin{aligned} f(x)&=g(x)+h(x)\\ &\\ f(x)&=x \end{aligned} } \right>
\makeatother
\end{document}


The \addlor macro takes an optional first argument that can be one of \displaystyle, \textstyle, \scriptstyle, or \scriptscriptstyle. Without the optional argument, it just uses the surrounding style.

-
That's great but could you explain a bit what is going on with the \setbox0 and \wd0 stuff since I kinda need to know what is going on so I can take it apart and modify stuff for my own macros. –  Peter Gerdes Jan 2 '11 at 22:40
@Peter: Sure. \setbox0 is putting the following box (which I construct with \hbox) into box register 0. The \hbox to\wd0 is constructing an \hbox that has the same width as box 0 (that's what \wd0 means). So what's going on is the \begin{aligned} ... \end{aligned} is going into box 0, then I measure the width, create a new box of that width, center \lor in it, and then overlap that with \box0. –  TH. Jan 3 '11 at 0:04