0
\newcommand{\update}{\leftarrow}
\begin{alignat*}{2}
&c = 0 \wedge [c \update c - 1] &\wedge \bigcirc [c \update c + 1] &\to \bigcirc \bigcirc c = 0 \\
&c = 0 \wedge [c \update c + 1] &\wedge \bigcirc [c \update c - 1] &\to \bigcirc \bigcirc c = 0 \\
&c = 0 \wedge [c \update c] &\wedge \bigcirc [c \update c] &\to \bigcirc \bigcirc c = 0 \\
\end{alignat*}

What I have currently: enter image description here

Can I change it so that the second \wedge is aligned with the others as well?

Basically I want three alignments:

  • Left-alignment
  • Alignment in the middle \wedge
  • Alignment at the \to
5

You forgot that n alignment points require 2n-1 ampersands, as except for the first column, each new alignment point requires one & to mark the beginning of a new column, and another & to mark the alignment point inside this column.

\documentclass{article}

\usepackage{amsmath, amssymb}
\newcommand{\update}{\leftarrow}

\begin{document}

\begin{alignat*}{3}
c &= 0 \wedge [c \update c - 1] & & \wedge \bigcirc [c \update c + 1] & &\to \bigcirc \bigcirc c = 0 \\
c &= 0 \wedge [c \update c + 1] & & \wedge \bigcirc [c \update c - 1] & &\to \bigcirc \bigcirc c = 0 \\
c &= 0 \wedge [c \update c] & & \wedge \bigcirc [c \update c] & &\to \bigcirc \bigcirc c = 0 \\
\end{alignat*}

\end{document} 

enter image description here

0
2

Can use array as well.

\documentclass{article}
\usepackage{amsmath}
\begin{document}

\newcommand{\update}{\leftarrow}
\[
\begin{array}{l@{\;}l@{\;}l}
c = 0 \wedge [c \update c - 1] & \wedge \bigcirc [c \update c + 1] & \to \bigcirc \bigcirc c = 0 \\
c = 0 \wedge [c \update c + 1] & \wedge \bigcirc [c \update c - 1] & \to \bigcirc \bigcirc c = 0 \\
c = 0 \wedge [c \update c]     & \wedge \bigcirc [c \update c]     & \to \bigcirc \bigcirc c = 0 \\
\end{array}
\]

\end{document}

enter image description here

1

If you want to use an alignat environment, you need to tell it to use 3 columns (that is, three pairs of one right-aligned and one left-aligned column). And you need to place the alignment markers accordingly.

Because you do not want the first column to be right-aligned, you need to place the first alignment marker at the start of each line to leave the first (right-aligned) column empty.

The next columns should also not be right-aligned, so you need to place two ampersands before the \wedge symbol and the \to symbol. This way, all the right-aligned columns will be empty and what is left is three left-aligned columns.

\documentclass{article}
\usepackage{amsmath}

\begin{document}

\newcommand{\update}{\leftarrow}
\begin{alignat*}{3}
&c = 0 \wedge [c \update c - 1] &&\wedge \bigcirc [c \update c + 1] &&\to \bigcirc \bigcirc c = 0 \\
&c = 0 \wedge [c \update c + 1] &&\wedge \bigcirc [c \update c - 1] &&\to \bigcirc \bigcirc c = 0 \\
&c = 0 \wedge [c \update c] &&\wedge \bigcirc [c \update c] &&\to \bigcirc \bigcirc c = 0 \\
\end{alignat*}

\end{document}

enter image description here

4
  • I'm a little confused -- wouldn't this be 4 columns?
    – gust
    Mar 24 at 20:17
  • Well, 2 columns essentially means 2 pairs of one right-aligned and one left-align column. So you would have right-aligned & left-aligned & right-aligned & left-aligned. But here, we need more in order to have everything aligned properly. Mar 24 at 20:24
  • Your code has a small problem: normally, 3 columns require 5 &. Here it works because the final part is the same in all equations.
    – Bernard
    Mar 27 at 23:09
  • Yes, this is true. Thanks for pointing this out. Mar 27 at 23:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.