13

I want to align my equation by the center of a symbol, not by the beginning. More precisely, I have the following:

\begin{align*}
    A\subseteq B&\iff\forall a\in A:a\in B\\
    A\subsetneq B&\iff\forall a\in A:a\in B\land\exists b\in B:b\notin A\\
    A=B&\iff A\subseteq B\land B\subseteq A\\
    A\cup B&=\{x|x\in A\lor x\in B\}\\
    A\cap B&=\{x|x\in A\land x\in B\}\\
    A\setminus B&=\{x|x\in A\land x\notin B\}\\
    \mathcal P(A)&=\{B|B\subseteq A\}\\
    \overline A&=\{x|x\notin A\}
\end{align*}

Which results in

unwanted result

However, I want something like this:

enter image description here

3
  • It is easy to align-centre the = sign w.r.t. \iff, but at the cost of a wider spacing on either side.
    – Bernard
    Commented Jul 14, 2019 at 10:41
  • I can't see with my eyes any difference between your two screenshots. However, there is one because David Carlisle answered you. Can you point out this subtle difference that escapes my eye?
    – AndréC
    Commented Jul 14, 2019 at 10:47
  • 1
    Use \mid for the bar when specifying the bar in the set builder notation.
    – egreg
    Commented Jul 14, 2019 at 11:05

4 Answers 4

12

I'm not sure this is the best way to lay out those definitions: too many symbols. Anyway, you can add half of the symbol to the left and half to the right of the alignment point.

\documentclass{article}
\usepackage{amsmath,amssymb}

\newcommand{\crel}[1]{%
  \global\setbox1=\hbox{$#1$}%
  \global\dimen1=0.5\wd1
  \mathrel{\hbox to\dimen1{$#1$\hss}}&\mathrel{\mspace{-\thickmuskip}\hbox to\dimen1{}}%
}

\begin{document}

\[
\begin{aligned}
  A\subseteq B   \crel{\Longleftrightarrow} \forall a\in A:a\in B\\
  A\subsetneq B  \crel{\Longleftrightarrow} \forall a\in A:a\in B\land\exists b\in B:b\notin A\\
  A=B            \crel{\Longleftrightarrow} A\subseteq B\land B\subseteq A\\
  A\cup B        \crel{=}                   \{x \mid x\in A\lor x\in B\}\\
  A\cap B        \crel{=}                   \{x \mid x\in A\land x\in B\}\\
  A\setminus B   \crel{=}                   \{x \mid x\in A\land x\notin B\}\\
  \mathcal{P}(A) \crel{=}                   \{B \mid B\subseteq A\}\\
  \overline{A}   \crel{=}                   \{x \mid x\notin A\}
\end{aligned}
\]

\end{document}

enter image description here

A different layout:

\documentclass{article}
\usepackage{amsmath,amssymb}

\begin{document}

We present some definitions of symbols that are commonly used in set theory:
\begin{itemize}
\item $A\subseteq B$ means `for every $a\in A$, also $a\in B$';
\item $A\subsetneq B$ means `$A\subseteq B$, but $A\ne B$';
\item $A=B$ means `$A\subseteq B$ and $B\subseteq A$' (extensionality of sets);
\item $A\cup B=\{x \mid x\in A\lor x\in B\}$;
\item $A\cap B=\{x \mid x\in A\land x\in B\}$;
\item $A\setminus B=\{x \mid x\in A\land x\notin B\}$;
\item $\mathcal{P}(A)=\{B \mid B\subseteq A\}$;
\item $\overline{A}=\{x \mid x\notin A\}$.
\end{itemize}
Note that the last notation only makes sense when elements are restricted to belong to a 
`universe' set that is usually clear from the context.

\end{document}

enter image description here

3
  • Thanks, your first solution worked fine. Might I note that it's supposed to be an as short as possible layout, as I'll use it as a basis for personal notes later. Nevertheless, it's of course important that the equals signs are aligned nicely.
    – MetaColon
    Commented Jul 14, 2019 at 11:36
  • Can you explain the \thickmuskip here?
    – Eric
    Commented Sep 25, 2023 at 12:07
  • @Eric To counteract the \thickmuskip space in front of the \mathrel.
    – egreg
    Commented Sep 25, 2023 at 12:32
12

enter image description here

\documentclass{article}

\usepackage{amsmath,amssymb}

\sbox0{$\iff$}
\sbox2{$=$}
\newdimen\fudge
\setlength\fudge{0.5\dimexpr\wd0-\wd2\relax}

\begin{document}

\begin{align*}
    A\subseteq B&\iff\forall a\in A:a\in B\\
    A\subsetneq B&\iff\forall a\in A:a\in B\land\exists b\in B:b\notin A\\
    A=B&\iff A\subseteq B\land B\subseteq A\\
    A\cup B\kern-\fudge&\kern\fudge=\{x|x\in A\lor x\in B\}\\
    A\cap B\kern-\fudge&\kern\fudge=\{x|x\in A\land x\in B\}\\
    A\setminus B\kern-\fudge&\kern\fudge=\{x|x\in A\land x\notin B\}\\
    \mathcal P(A)\kern-\fudge&\kern\fudge=\{B|B\subseteq A\}\\
    \overline A\kern-\fudge&\kern\fudge=\{x|x\notin A\}
\end{align*}

\end{document}
1
  • Quite ingenious!
    – Bernard
    Commented Jul 14, 2019 at 10:59
5

A tabular solution: (may be useful in some cases but I suggest @egreg's solution because there the math environment is not inline)

\documentclass{article}
\usepackage{amsmath,amssymb}
\begin{document}
\begingroup
\setlength{\tabcolsep}{2pt}
\renewcommand{\arraystretch}{1.4}
\begin{tabular}{rcl}
    $A \subseteq B $&$\iff$ &$\forall a\in A:a\in B$\\
    $A \subsetneq B$&$\iff$& $\forall a\in A:a\in B\land\exists b\in 
    B:b \notin A$\\
    $A=B$ &$\iff$ &$A\subseteq B\land B\subseteq A$\\
    $A\cup B$ &$=$ & $\{x|x\in A\lor x\in B\}$\\
    $A\cap B$& $=$ &$\{x|x\in A\land x\in B\}$\\
    $A\setminus B$&$=$&$\{x|x\in A\land x\notin B\}$\\
    $\mathcal P(A)$ &$=$ &$\{B|B\subseteq A\}$\\
    $\overline A$&$=$&$\{x|x\notin A\}$
\end{tabular}
\endgroup
\end{document}

enter image description here

4

Here's a solution that's similar to the one by @koleygr. The main difference is the use of an array environment instead of a tabular environment, permitting the omission of 48 [!] $ symbols inside the environment. The solution also takes care of the spacing around the \iff symbols, and it uses \mid rather than | to denote conditioning.

enter image description here

\documentclass{article}
\usepackage{amssymb,array}
\newcolumntype{C}{>{{}}c<{{}}} % column type for relational and binary operators
\begin{document}

We present some definitions of symbols that are commonly used in set theory:\par
\begingroup % localize scope of the next two instructions
\setlength{\arraycolsep}{0pt}
\renewcommand{\arraystretch}{1.4}
$\begin{array}{rCl}
    A \subseteq B &\iff& \forall a\in A:a\in B\\
    A \subsetneq B&\iff& \forall a\in A:a\in B \land
                         \exists b\in B:b\notin A\\
    A=B           &\iff& A\subseteq B\land B\subseteq A\\
    A\cup B       &=& \{x\mid x\in A\lor x\in B\}\\
    A\cap B       &=& \{x\mid x\in A\land x\in B\}\\
    A\setminus B  &=& \{x\mid x\in A\land x\notin B\}\\
    \mathcal{P}(A)&=& \{B\mid B\subseteq A\}\\
    \overline A   &=& \{x\mid x\notin A\}
\end{array}$
\endgroup
\end{document} 

You must log in to answer this question.

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