Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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.

share|improve this question

2 Answers 2

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

share|improve this answer
    
I think the text "outside aligned" is supposed to be, well, outside the align environment. –  Tyson Williams Jan 18 at 22:19

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.

share|improve this answer
    
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

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.