# Separate \arraystretch value for every table

\arraystretch defines vertical spacing of tables. If I have several tables, how can I define a separate value of \arraystretch for every table? In my case, the last defined \arraystretch works for all tables.

-
I would suggest accepting answers to some of the questions you have asked. –  Seamus Feb 13 '11 at 14:18
Another tip: you can use backticks  to mark your inline code as Martin did in his edit. –  Hendrik Vogt Feb 13 '11 at 14:38

If you define \arraystretch direct before the table (i.e. tabular) inside a group it should only be active for this table.

\begingroup
\renewcommand*{\arraystretch}{<value>}
\begin{tabular}{...}
...
\end{tabular}
\endgroup


\renewenvironment{mytabular}[1][1]{%
\renewcommand*{\arraystretch}{#1}%
\tabular%
}{%
\endtabular
}

% ...

\begin{mytabular}[<stretch value>]{...}
...
\end{mytabular}

-
\arraystrech is not a length ... –  Herbert Feb 13 '11 at 14:41
Thanks @Herbert. I changed it accordantly. –  Martin Scharrer Feb 13 '11 at 14:49
@MartinScharrer why do you use the * with the \renewcommand? –  Mario S. E. Apr 24 '13 at 12:52
@MarioS.E.: The starred version defines a "normal" macro, while the normal version defines a "long" macro which may contain \par. This is not required for \arraystretch so I used the starred version. This however is just a very minor difference and does not have a real impact here. –  Martin Scharrer Apr 24 '13 at 15:08
\documentclass{article}

\newenvironment{Tabular}[2][1]
{\def\arraystretch{#1}\tabular{#2}}
{\endtabular}

\begin{document}

\begin{Tabular}{ccc}
c & c & C\\
c & c & C
\end{Tabular}

\begin{Tabular}[3]{ccc}
c & c & C\\
c & c & C
\end{Tabular}

\end{document}

-
it worked. thank you. another question, e.g., how can i define a new command to use the new environment Tabular in the above example? i want to know how i can transfer parameters of \newcommand to \newenvironment. –  warem Feb 14 '11 at 9:02
@warem: there is no difference to the above example where I passed an argument from the environment to a command. However, to give a more explicitly answer, create an example of what you really want to do. Maybe as a new question. –  Herbert Feb 14 '11 at 9:08
i mean create a new command to use the Tabular environmet. e.g., \newcommand{\test}[2]{\begin{Tabular}[2]...\end{Tabular}}. it didn't work. it seemed that the parameters of test command can't be transferred to Tabular correctly. –  warem Feb 14 '11 at 9:22
@warem: \newcommand{\test}[2]{\begin{Tabular}{#1}#2\end{Tabular}}` It depends to the menaing of #1 and #2 –  Herbert Feb 14 '11 at 9:27
this is what i want. thank you very much. –  warem Feb 14 '11 at 9:38