# Vertical top alignment of text and inline math using aligned

In the following MWE, the problem is that the Condition: is not aligned with the formula:

\documentclass{article}

\usepackage{amsmath}

\begin{document}

\textbf{Condition}:\begin{aligned} (\exists a \in A) (\exists b \in B)(\forall c \in C)[&F(a,b)=c~\wedge~F(c,d)=a~\wedge~ \\ &a \in X~\wedge~(c \in Y ~\vee~d \in M)] \end{aligned}

\end{document}


Just use the optional argument of aligned:

\textbf{Condition}:\begin{aligned}[t] (\exists a \in A) (\exists b \in B)(\forall c \in C)[&F(a,b)=c~\wedge~F(c,d)=a~\wedge~ \\ &a \in X~\wedge~(c \in Y ~\vee~d \in M)] \end{aligned}


Edit (old answer was really complicated without such need)

Second way without \ontop command:

\documentclass{article}
\usepackage{tabularx}
\usepackage{amsmath}

\begin{document}
\textbf{Condition}:
\begin{aligned}[t] (\exists a \in A) (\exists b \in B)(\forall c \in C)[&F(a,b)=c~\wedge~F(c,d)=a~\wedge~ \\ &a \in X~\wedge~(c \in Y ~\vee~d \in M)] \end{aligned}
\end{document}


Same output as below with no extra space.

The problem is that inline math are supposed to centered vertical with the text. What you want is a top aligned tabular.

So, you can try like this:

\documentclass{article}

\usepackage{amsmath}

\def\ontop#1{\vtop{\null\hbox{#1}}}

\begin{document}

\begin{tabular}{cc}\ontop{\textbf{Condition}:}&\ontop{\begin{aligned} (\exists a \in A) (\exists b \in B)(\forall c \in C)[&F(a,b)=c~\wedge~F(c,d)=a~\wedge~ \\ &a \in X~\wedge~(c \in Y ~\vee~d \in M)] \end{aligned}}\end{tabular}

\end{document}


Source of \ontop command from here:

https://tex.stackexchange.com/a/23522/120578

Output:

• Wow. It's a fairly complicated approach! Oct 16 '17 at 0:28
• @A.Loc you are right. I used realy complicated method but it works with any kind of math. The edited solution is for aligned environment only Oct 16 '17 at 0:49
• I believe that \aligned[t] does also work with any kind of math, don't you think? Oct 16 '17 at 0:57
• Can downvoter explain why this answer deserves a -1?! Oct 16 '17 at 0:59
• As I checked,aligned[t] even works in the case of \dfrac. Oct 16 '17 at 1:07