4

I have the following matrix:

\documentclass{article} 
\usepackage{amsmath,multirow} 
\begin{document}
\[
\begin{pmatrix}
1 & 0 & 0                             & 0                            \\
0 & 1 & 0                             & 0                            \\
0 & 0 & \multicolumn{2}{l}{\multirow{R}} \\
0 & 0 & \multicolumn{2}{l}{}   
\end{pmatrix}
\]
\end{document}

I would like to know how to put the R in the middle of these four empty cells.

  • Welcome to TeX.SE! – Mico Jun 25 at 4:53
4

Isn't it a block matrix?

\documentclass{article}
\usepackage{amsmath}

\begin{document}

\[
\begin{pmatrix}
\begin{matrix} 1 & 0 \\ 0 & 1 \end{matrix} &
\begin{matrix} 0 & 0 \\ 0 & 0 \end{matrix} \\
\begin{matrix} 0 & 0 \\ 0 & 0 \end{matrix} &
R
\end{pmatrix}
\qquad
\begin{pmatrix}
\begin{matrix} 1 & 0 \\ 0 & 1 \end{matrix} &
\begin{matrix} 0 & 0 \\ 0 & 0 \end{matrix} \\
\begin{matrix} 0 & 0 \\ 0 & 0 \end{matrix} &
\text{\Large$R$}
\end{pmatrix}
\]
\[
\begin{pmatrix}
0 & 0 & 0 & 0 \\
0 & 0 & 0 & 0 \\
0 & 0 & 0 & 0 \\
0 & 0 & 0 & 0
\end{pmatrix}
\qquad
\begin{pmatrix}
0 & 0 & 0 & 0 \\
0 & 0 & 0 & 0 \\
0 & 0 & 0 & 0 \\
0 & 0 & 0 & 0
\end{pmatrix}
\]

\end{document}

The bottom row is just for comparison.

enter image description here

| improve this answer | |
  • Thanks a lot, it worked wonderfully. – Edison Santos Jun 25 at 11:29
6

A simple way would be to use the nicematrix package.

\documentclass{article}
\usepackage{nicematrix}
\begin{document}
\[
\begin{pNiceArray}{CCCC}
1 & 0 & 0              & 0 \\
0 & 1 & 0              & 0 \\
0 & 0 & \Block{2-2}{R} &   \\
0 & 0 &                & 
\end{pNiceArray}
\]
\end{document}

| improve this answer | |
4

Raise it into place:

enter image description here

\documentclass{article}

\usepackage{amsmath}

\begin{document}

\[
  \begin{pmatrix}
    1 & 0 & 0 & 0 \\
    0 & 1 & 0 & 0 \\
    0 & 0         \\
    0 & 0 & \multicolumn{2}{c}{\raisebox{.5\normalbaselineskip}[0pt][0pt]{$R$}}
  \end{pmatrix}
\]

\end{document}
| improve this answer | |
4

A solution that keeps the existing pmatrix setup and combines \multicolumn and \multirow directives:

enter image description here

\documentclass{article} 
\usepackage{amsmath,multirow} 
\begin{document}
\[
\begin{pmatrix}
1 & 0 & 0 & 0 \\
0 & 1 & 0 & 0 \\
0 & 0 & \multicolumn{2}{c}{\multirow{2}{*}{$R$}} \\
0 & 0    
\end{pmatrix}
\]
\end{document}

In short, all you need to do is replace \multicolumn{2}{l}{\multirow{R}} in row 3 of your code with \multicolumn{2}{c}{\multirow{2}{*}{$R$}} and delete \multicolumn{2}{l}{} in row 4 of the pmatrix.

| improve this answer | |
  • I tried this method but it did not work somehow. – Edison Santos Jun 25 at 11:28
  • @EdisonSantos - Please clarify what "it did not work somehow" entails. (The method quite evidently worked just fine for the exaxmple shown above.) What, exactly, isn't working? Do you get error and/or warning messages? If so, what do they say? Did you modify the math part somehow? If so, how? Please be specific. – Mico Jun 25 at 11:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.