3

What a shame! After years of using LaTeX, I'm still truggling with the pesky alignat environment which I don't understand. Here's a MWE showing what I'm trying to do:

\documentclass[11pt,letterpaper,twoside]{book}
\usepackage{lmodern}
\usepackage{amsmath}

\begin{document}

Blabla bla :
\begin{alignat*}{4}
    x \quad &\Rightarrow \quad y \sim z,
    & a \quad &\Rightarrow \quad b\sim c, \\
    x \quad &\Rightarrow \quad xyz \sim z,
    & a \quad &\Rightarrow \quad 5b \sim c,
\end{alignat*}

\end{document}

Preview:

enter image description here

I need to get a large space on the red line, so each column is well balanced to the left and to the right. I need the arrows and the tildes to be aligned, without changing the space around them.

I know this should be very basic, but I don't get it! :-(

0

1 Answer 1

5

Here you are. I added a spacing of 4em. Anyway, you only need three alignment columns:

\documentclass[11pt,letterpaper,twoside]{book}
\usepackage{lmodern}
\usepackage{amsmath}

\begin{document}

Blabla bla :
\begin{alignat*}{4}
    x \quad &\Rightarrow \quad & y&\sim z,&\hspace{4em}
    a \quad &\Rightarrow \quad & 4b & \sim c, \\
    x \quad &\Rightarrow \quad & xyz & \sim z,&
     a \quad &\Rightarrow \quad & b & \sim xyzc,
\end{alignat*}

\end{document} 

enter image description here

8
  • Ow, so the space should be by hand! I was trying to do automatically, like align does.
    – Sigur
    Commented Feb 1, 2020 at 16:12
  • No, alignat gives you full control on the alignment columns spacing
    – Bernard
    Commented Feb 1, 2020 at 16:15
  • Why the \hspace{4em} spacing?
    – Cham
    Commented Feb 1, 2020 at 16:18
  • I understood you wanted a large spacing between the two groups. Isn't it so?
    – Bernard
    Commented Feb 1, 2020 at 16:20
  • 1
    If you want to align the \sim signs, you indeed need 4 columns (see my edited answer). The way alignat works is like align, but it doesn't add any spacing between the columns: any spacing has to be added by hand, at the relevant place. The &s with even index mark the start of a new alignment column and the following & (odd index) marks the alignment point of its column. What is on the left of the alignment point is right-aligned, and what is on the right is left-aligned, with proper spacing.
    – Bernard
    Commented Feb 1, 2020 at 16:38

You must log in to answer this question.

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