2

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.

\begin{equation}

                  /    math math math math math     (outside aligned)|               \lor            |
                 \     math math                 /
\end{equation}

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.

2 Answers 2

1

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

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

\makeatletter
\newcommand*\addlor[2][]{%
        \begingroup
        \ifx\relax#1\relax
                \mathpalette\addlor@aux{#2}%
        \else
                \addlor@aux#1{#2}%
        \fi
        \endgroup
}
\def\addlor@aux#1#2{
        \setbox0\hbox{$\m@th#1#2$}%
        \rlap{\hbox to\wd0{\hfill$\m@th#1\lor$\hfill}}%
        \box0
}
\makeatother
\begin{document}
\begin{equation}
\text{(outside aligned)}
\left<
\addlor{
        \begin{aligned}
        f(x)&=g(x)+h(x)\\
        &\\
        f(x)&=x
        \end{aligned}
}
\right>
\end{equation}
\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.

2
  • 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. Jan 2, 2011 at 22:40
  • 1
    @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, 2011 at 0:04
3

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}

alt text

1
  • I think the text "outside aligned" is supposed to be, well, outside the align environment. Jan 18, 2014 at 22:19

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .