1

I want to create a new matrix environment with different spacing for a matrix instead of manually typing arraystretch locally for each matrix. I am new to more advanced LaTeX coding, and have not quite figured this out. I thought that I could just do

\newenvironment{dbmatrix}{
    \renewcommand*{\arraystretch}{1.5}
    \ensuremath{\begin{bmatrix}  \end{bmatrix}}
}}

But then, after searching through Stack, I thought maybe I need to use \bgroup,\egroup or \makeatletter, \makeatother type commands, but have not figured out how these commands really work and failed using them. It would also be great to have maybe an additional environment that took an argument to adjust \arraystretch, like \begin{dbmatrix}{1.5} \end{dbmatrix}. Would love some help and suggestions.

4
  • Please try with \newenvironment{dbmatrix}{\bgroup \renewcommand*{\arraystretch}{1.5} \begin{bmatrix}}{\end{bmatrix}\egroup}
    – MadyYuvi
    Feb 27, 2021 at 14:35
  • 1
    @MadyYuvi Environments already form a group.
    – campa
    Feb 27, 2021 at 14:48
  • @MadyYuvi Yeah, this did the trick! It did not work without using \bgroup, \egroup. Thank you much.
    – CyCeez
    Feb 27, 2021 at 15:08
  • @campa Yeah, so that link has probably what I'd really like. Thanks for finding this.
    – CyCeez
    Feb 27, 2021 at 15:09

0

Browse other questions tagged .