4

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}

enter image description here

2 Answers2

6

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}$
Bernard
  • 271,350
2

Edit (old answer was really complicated without such need)

Second way without \ontop command:

\documentclass{article}
\usepackage{adjustbox}
\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.

Old Answer:

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:

enter image description here

koleygr
  • 20,105
  • 1
    Wow. It's a fairly complicated approach! –  Oct 16 '17 at 00: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 – koleygr Oct 16 '17 at 00:49
  • 1
    I believe that \aligned[t] does also work with any kind of math, don't you think? –  Oct 16 '17 at 00:57
  • 1
    Can downvoter explain why this answer deserves a -1?! –  Oct 16 '17 at 00:59
  • @A.Loc Suppose you have a \dfrac and you want to align with its top part... Check it to see it is different result with the second option. I just left it there because may be found useful in other cases. – koleygr Oct 16 '17 at 01:05
  • 1
    As I checked,aligned[t] even works in the case of \dfrac. –  Oct 16 '17 at 01:07
  • @Roboticist thanks for the question... I had not noticed yet... But it is ok. Sometimes people downvotes if they feel that you made their life difficult without reason or that you don't really know as much as they would like you to know. It is ok for me. A.Loc try: '\begin{tabular}{cc}\ontop{\textbf{Over}:}&\ontop{$\text{Here is come text and a frac} \dfrac{7}{8}$}\end{tabular}' with my old answer. It is different (may be not too useful as it is... but can be useful in other cases) – koleygr Oct 16 '17 at 01:11