4

I hope to align equations as shown here: enter image description here

I used this code:

\begin{align*}
    \displaystyle {eq1} &\Longleftrightarrow& \displaystyle {eq2}
    \\\\
    \displaystyle {eq3} &\Longleftrightarrow& \displaystyle {eq4}
\end{align*}

Each eq#s' length is different. If I use this code, then my result is like the following: enter image description here

4 Answers 4

2

Use alignat environment.

Code

\documentclass{article}
\usepackage{mathtools}

\begin{document}
\begin{alignat}{3}
  aaa&=bbb &&\quad\Longleftrightarrow\quad & ccc&=ddd \\
  a  &=b   &&\quad\Longleftrightarrow      & c  &=d
\end{alignat}
\end{document}

Output

enter image description here

3
  • Mmm… It seems to work because both sides of equalities have the same length.
    – Bernard
    Apr 28, 2016 at 8:28
  • @Bernard: I assumed the OP wanted the equations on both sides of \Longleftrightarrow to be aligned at the equal sign, and my solution delivers this. However, if OP wanted the equations to be center-aligned, regardless of the connectives, then your solution (or Werner's) will be more appropriate.
    – Herr K.
    Apr 28, 2016 at 16:52
  • Yes, we took a different point of view. The O.P.'s sketch seemd to mean both sides had some axis of symmetry.
    – Bernard
    Apr 28, 2016 at 16:58
6

Since you're using an align*, I assume you're not interested in numbering the equations. As such, using an array allows you the freedom of specifying your alignments as you wish:

enter image description here

\documentclass{article}

\usepackage{array}

\begin{document}

\[
  \setlength{\arraycolsep}{0pt}% Remove horizontal column separation
  \renewcommand{\arraystretch}{1.2}% Stretch vertically
  \begin{array}{ *{3}{>{\displaystyle}c} }
    \mbox{a very long LHS} & {}\Longleftrightarrow{} & \mbox{a very long RHS} \\
       \mbox{short LHS}    & {}\Longleftrightarrow{} &    \mbox{short RHS}
  \end{array}
\]

\end{document}
4

A simple solution with the eqparbox package. I define an \eqmathboxcommand, which types its contents in displaystyle math mode. It uses a tag which ensures all boxes with the same tag will all have the width of the largest contents.

\documentclass{article}

\usepackage{eqparbox}
\newcommand\eqmathbox[2][]{\eqmakebox[Eq#1]{\ensuremath{ \displaystyle#2}}}

 \usepackage{mathtools}

\begin{document}

  \begin{align*}
    \eqmathbox[1]{\text{a very long equation}} & \Longleftrightarrow \eqmathbox[2]{\text{a still looooonger equation}} \\
       \eqmathbox[1]{\text{a short equation}} &{} \Longleftrightarrow \eqmathbox[2]{\text{a shorter eq}}
  \end{align*}

\end{document} 

enter image description here

1

The IEEEeqnarray environment is bulky, but powerful. It lets you have several aligned columns, and it also gives you the proper spacing around your = and \Leftrightarrow signs.

\usepackage[retainorgcmds]{IEEEtrantools}
\begin{document}

\begin{IEEEeqnarray*}{rClCrCl}
   aaa & = & bb & \Leftrightarrow & cccc & = & dd
\\ e & = & f & \Leftrightarrow & g & = & hhhhh
\end{IEEEeqnarray*}
\end{document}

Output:

Nice-looking equations.

IEEEtrantools is well-maintained, but notoriously hard to install. This StackExchange question provides a good guide to the process of installing it properly, but a completely workable option is just to download IEEEtrantools.sty from here and leave it in the same folder as your code.

You must log in to answer this question.

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