# how to use overbrace and underbrace when their arguments include alignment symbol

I have an split equation.

\documentclass{article}

\usepackage{mathtools}

\begin{document}

\begin{equation*}
\label{eq:elig}
\begin{split}
\Omega_{v} := \{(a,\sigma)|a \in A &\wedge b \in B \wedge x(a,b)=v\\ &\wedge (\forall \sigma' \in B)[x(a,\sigma')! \neq v \rightarrow ( \sigma' \in \Sigma_{\text{hib}} \vee b \in \Sigma_{\text{for}})]\}
\end{split}
\end{equation*}

\end{document}


I need to add an overbrace to the upper piece and ans underbrace to the lower one, but the following does not work.

\documentclass{article}

\usepackage{mathtools}

\begin{document}

\begin{equation*}
\label{eq:elig}
\begin{split}
\Omega_{v} := \{(a,\sigma)|\overbrace{a \in A &\wedge b \in B \wedge x(a,b)=v}^{\alpha}\\ &\wedge \underbrace{(\forall \sigma' \in B)[x(a,\sigma')! \neq v \rightarrow ( \sigma' \in \Sigma_{\text{hib}} \vee b \in \Sigma_{\text{for}})]}_{\beta}\}
\end{split}
\end{equation*}

\end{document}


I just checked some other questions like the one below, but they are about different situations like tables.

Overbrace in amsmath align environment

Here is what I really need:

• What makes you think you can use & in the argument of \overbrace? Can you show an approximate representation of the desired output? – egreg Dec 12 '17 at 18:23
• @egreg: please have a look at the added image. – A.Loc Dec 12 '17 at 18:33

I don't think you need to align the two \wedge symbols: a multline is better.

\documentclass{article}

\usepackage{mathtools}

\begin{document}

\begin{multline*}
\label{eq:elig}
\Omega_{v} := \{(a,\sigma)\mid
\overbrace{a \in A \wedge b \in B \wedge x(a,b)=v}^{\alpha}\\
\wedge \underbrace{(\forall \sigma' \in B)[x(a,\sigma')!
\neq v \rightarrow ( \sigma' \in \Sigma_{\mathrm{hib}}
\vee b \in \Sigma_{\mathrm{for}})]}_{\beta}
\,\}
\end{multline*}

\end{document}


• @Thanks for the help! Just for the sake of curiosity, isn't it possible to handle the issue for the case of split without switching to multline? – A.Loc Dec 12 '17 at 18:52
• What if the wedge alignment is a requirement? Of course, I know that one can shift the lower part by hspace{}, but I thought you may have a better idea for that. – Roboticist Dec 12 '17 at 18:57
• @Roboticist: You can use \phantom. – Werner Dec 12 '17 at 19:06

You can insert \phantom content to align \wedge:

\documentclass{article}

\usepackage{amsmath}

\begin{document}

\begin{align*}
& \Omega_v := \bigl\{ (a, \sigma) \mid
\overbrace{a \in A \wedge b \in B \wedge x(a, b) = v}^{\alpha} \\
& \phantom{\Omega_v := \bigl\{ (a, \sigma) \mid a \in A} % for alignment with \wedge
\wedge \underbrace{(\forall \sigma' \in B) [x(a, \sigma')!
\neq v \rightarrow ( \sigma' \in \Sigma_{\mathrm{hib}}
\vee b \in \Sigma_{\mathrm{for}})]}_{\beta}
\bigr\}
\end{align*}

\end{document}


In case you have reasons to keep the alignment symbols (like here), there is an alternative based on tikz:

\documentclass{article}
\usepackage{mathtools}
\usepackage{tikz}
\usetikzlibrary{matrix,decorations.pathreplacing,calc}
% from https://tex.stackexchange.com/questions/339526/confusion-over-use-of-tikzmark
\newcommand{\tikzmark}[1]{\tikz[overlay,remember picture] \node (#1) {};}
\begin{document}

\begin{equation*}
\label{eq:elig}
\begin{split}
\Omega_{v} := \{(a,\sigma)|\tikzmark{a}a \in A &\wedge b \in B \wedge
x(a,b)=v\tikzmark{v}\\
&\wedge \tikzmark{lb}(\forall \sigma' \in B)[x(a,\sigma')! \neq v \rightarrow
( \sigma' \in \Sigma_{\text{hib}} \vee b \in \Sigma_{\text{for}})\tikzmark{rb}]\}
\end{split}
\end{equation*}
\tikz[remember picture, overlay,decoration={brace}]{%
\draw[decorate,transform canvas={xshift=0em,yshift=0.75em},thick] (a.north) -- (v.north) node[above=3pt,midway] {$\alpha$};
\draw[decorate,transform canvas={xshift=0em,yshift=-0.5em},thick] (rb.south) -- (lb.south) node[below=3pt,midway] {$\beta$};}
\end{document}


Here you can control the distance of the brace, its thickness etc. Whether this is an advantage or disadvantage is a matter of taste.