2

How can I add space between the rows of a tabular or an array environment so that it looks like I used an alignat environment?

\documentclass{article}
\usepackage{amsmath}
\usepackage{array}

\begin{document}

\begin{alignat*}{2}
&a \quad && b \\
&c \quad && d\\
&e \quad && f
\end{alignat*}

\[
\begin{array}{@{}ll@{}}
    a & b  \\
    c & d  \\
    e & f
\end{array}
\]

\end{document}
3
  • If you don't mind switching to the tabu packe maybe the use of \tabulinesep as explained in this answer might be usefull as well.
    – leandriis
    Aug 27, 2017 at 15:03
  • Keep in mind that changing the row spacing won't affect the math style. In array environments, the default math style is \textstyle, whereas in the multi-line equation environments of the amsmath package, the default math style is \displaystyle.
    – Mico
    Aug 27, 2017 at 15:42
  • I've taken the liberty of editing your posting so that it makes use of an array environment instead of a tabular environment, given that the contents of the environment appear to be math-related. Feel free to revert if you feel the modification is inappropriate or fails to address something important.
    – Mico
    Aug 27, 2017 at 15:49

2 Answers 2

1

\extrarowheight=3pt roughly does the job:

\documentclass{article}
\usepackage{amsmath}
\usepackage{array}

\begin{document}

\begin{alignat*}{2}
&a\quad && b \\
&c \quad && d\\
&e \quad&& f
\end{alignat*}

\[ \setlength\extrarowheight{3pt}
\begin{array}{@{}ll@{}}
    a & b \\
    c & d \\
    e & f
\end{array} \]

\end{document} 

enter image description here

7
  • 1
    From your mwe it is not exactly clear to me where to use extrarowsep.
    – leandriis
    Aug 27, 2017 at 15:06
  • The downsides of this approach are (a) it doesn't scale easily if the document font size is changed from, e.g., 10pt to 12pt, and (b) it inserts vertical whitespace above all rows, including the very first row -- which may not be desirable.
    – Mico
    Aug 27, 2017 at 15:40
  • 1
    @leandriis: Sorry. I didn't see I had a clipboard breakdown: I copied your initial code, instead of the code in my editot. I've fixed it, and took the opportunity to replace tabular with array, as suggested by Mico.
    – Bernard
    Aug 27, 2017 at 17:04
  • 1
    @Mico: Sure it's not universal, but I don't like very much ` \arraystretch`, as it induces asymmetric modifications between height and depth of the row.
    – Bernard
    Aug 27, 2017 at 17:07
  • Not “roughly”, actually: the default value of \jot is 3pt
    – egreg
    Aug 27, 2017 at 19:29
0

You should change the value of \arraystretch to 1.25. (The default value is 1.00.)

A full MWE, which provides a custom array-like environment called myarray:

\documentclass{article}
\usepackage{amsmath}
\newenvironment{myarray}[2][c]{%
   \begingroup
   \renewcommand\arraystretch{1.25}
   \begin{array}[#1]{#2}}{%
   \end{array}
   \endgroup}

\begin{document}
\begin{alignat*}{2}
&a\quad && b \\
&c \quad && d\\
&e \quad&& f
\end{alignat*}

\[
\begin{myarray}{@{}ll@{}}
    a   & b  \\
    c   & d  \\
    e   & f
\end{myarray}
\]
\end{document}

You must log in to answer this question.

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