6

There was an earlier question about aligning different parts of two parallel equations in a multiple line environment, and I'm trying to adapt Werner's answer that used an array for my own use. Probably the problem is that I don't fully understand the code I should put directly after \begin{array}. Here are my code and the output:

\[
  \begin{array}{c*{2}{@{{}\mathrel{<}{}}l}}
    1 & |z| & |k|\inv \\[\jot]
    |k| & |\phi(z)| & \hphantom{|} 1
  \end{array}
\]

output

Why isn't the |z| in the top of the array centered? How should I fix that? (I also welcome comments about other aspects of the code, if applicable.)

justin
  • 1,509

2 Answers2

12

I think you wanted to write

*{2}{c@{{}\mathrel{<}{}}}l

instead of

c*{2}{@{{}\mathrel{<}{}}l}

which means having the last two columns left-aligned.

In fact, the syntax for multiple columns with same alignment is

*{<number of columns>}{<column alignment>}

Also, since the < symbol is defined as \mathrel by default, you can eliminate it:

*{2}{c@{{}<{}}}l

MWE:

\documentclass{article}

\newcommand{\inv}{^{-1}}

\begin{document}

\[
  \begin{array}{*{2}{c@{{}<{}}}l}
    1 & |z| & |k|\inv \\[\jot]
    |k| & |\phi(z)| & \hphantom{|} 1
  \end{array}
\]

\end{document} 

enter image description here

Moreover note that (citing egreg's comment) "adding a new column without intercolumn space for the exponent and changing the third one to be centered, avoids guessing that the width of k is the same as the width of 1".

That is, the same result can be obtained with the following code:

\documentclass{article}

\newcommand{\inv}{^{-1}}

\begin{document}

\[
  \begin{array}{*{2}{c@{{}<{}}}c@{}l}
    1 & |z| & |k| & \inv \\[\jot]
    |k| & |\phi(z)| & 1 &
  \end{array}
\]

\end{document} 
karlkoeller
  • 124,410
  • 2
    Adding a new column without intercolumn space for the exponent and changing the third one to be centered avoids guessing that the width of k is the same as the width of 1. – egreg Jul 27 '15 at 22:27
2

May be you are looking for

\documentclass{article}
\def\inv{^{-1}}
\begin{document}
\[
  \begin{array}{c*{2}{@{{}\mathrel{<}{}}c}}
    1 & |z| & |k|\inv \\[\jot]
    |k| & |\phi(z)| & \hphantom{|} 1
  \end{array}
\]
\end{document}

in your original code c*{2}{@{{}\mathrel{<}{}}l} means first column is center and the two last column are left

enter image description here

touhami
  • 19,520