0

I'm looking for a way to centre-align the centre column (\xrightarrows) in this construction.

\documentclass{article}
\usepackage{mathtools}
\begin{document}
\begin{alignat}[2]
    \begin{bmatrix*}[r]
        2 & 2 & \vline & 3 \\
        1 & -3 & \vline & 2
    \end{bmatrix*} & \xrightarrow{-R_2 \to R_1} && \begin{bmatrix*}[r]
        1 & 5 & \vline & 1 \\
        1 & -3 & \vline & 2
    \end{bmatrix*} \\
    \begin{bmatrix*}[r]
        1 & 5 & \vline & 1 \\
        1 & -3 & \vline & 2
    \end{bmatrix*} & \xrightarrow{3 R_1} && \begin{bmatrix*}[r]
        3 & 15 & \vline & \mathllap{-}1 \\
        1 & -3 & \vline & 2
    \end{bmatrix*}
\end{alignat}
\end{document}

Example

Previous answers I've seen have used:

2
  • is insetead of \end{bmatrix*} & \xrightarrow{-R_2 \to R_1} && \begin{bmatrix*}[r] acepptable to you \end{bmatrix*} & \xrightarrow{-R_2 \to R_1} \begin{bmatrix*}[r]?
    – Zarko
    Jul 17, 2017 at 18:48
  • No, I want the \xrightarrows to be centre-aligned, not left-aligned.
    – user164587
    Jul 18, 2017 at 0:21

1 Answer 1

1

The alignat environment works just fine here. What made you believe it turns the centre column in textmode? Note the starred versions of the matrix environmùents require mathtools. I took the opportunity to align the right brackets of the righmots matrices, using the \mathllap command defined by this package:

\documentclass{article}
\usepackage{mathtools}

\begin{document}

\begin{alignat*}{2}
    \begin{bmatrix*}[r]
        2 & 2 & \vline & 3 \\
        1 & -3 & \vline & 2
    \end{bmatrix*} & \xrightarrow{-R_2 \to R_1} && \begin{bmatrix*}[r]
        1 & 5 & \vline & 1 \\
        1 & -3 & \vline & 2
    \end{bmatrix*} \\[1ex]
    \begin{bmatrix*}[r]
        1 & 5 & \vline & 1 \\
        1 & -3 & \vline & 2
    \end{bmatrix*} & \xrightarrow{-R_2 \to R_1} && \begin{bmatrix*}[r]
        0 & 8 & \vline & \mathllap{-}1 \\
        1 & -3 & \vline & 2
    \end{bmatrix*}
\end{alignat*}

\end{document} 

enter image description here

To centre the \rightarrows in their column, we can use the eqparbox package. I defines a \eqmathbox command, which types its contents in math mode and uss a system of tags. All boxes sharing the same tag have the width of the wides of their contents, which is centred in its box:

\documentclass{article}
\usepackage{mathtools}
\usepackage{eqparbox}
\newcommand{\eqmathbox}[2][M]{\eqmakebox[#1]{$\displaystyle#2$}}

\begin{document}

\begin{alignat*}{2}
    \begin{bmatrix*}[r]
        2 & 2 & \vline & 3 \\
        1 & -3 & \vline & 2
    \end{bmatrix*} & \eqmathbox{\xrightarrow{-R₂ + R_1\to R₁}} && \begin{bmatrix*}[r]
        1 & 5 & \vline & 1 \\
        1 & -3 & \vline & 2
    \end{bmatrix*} \\[1ex]
    \begin{bmatrix*}[r]
        1 & 5 & \vline & 1 \\
        1 & -3 & \vline & 2
    \end{bmatrix*} & \eqmathbox{\xrightarrow{-R₂ \to R₁}} && \begin{bmatrix*}[r]
        0 & 8 & \vline & \mathllap{-}1 \\
        1 & -3 & \vline & 2
    \end{bmatrix*}
\end{alignat*}

\end{document} 

enter image description here

2
  • I didn't say that the alignat environment turns the centre column into text mode, but the referenced answer does turn it into text mode. In your answer the \xrightarrow column is left-aligned, not centred. I suspect my example doesn't show this clearly, I'll edit it.
    – user164587
    Jul 18, 2017 at 0:18
  • @user164587: I se what you mean: the \xrightarrows look centred because they have the same width. I have a solution with eqparbox . Please take a look at my updated answer.
    – Bernard
    Jul 18, 2017 at 1:58

You must log in to answer this question.

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