4

I created a matrix by this code

\documentclass{article}
\usepackage{amsmath}
\begin{document}
\[
A_{n+1}=
 \begin{pmatrix}
    a & \begin{tabular}{ccccc}
           0 & 0 & \ldots & 0 & 0 \\
        \end{tabular} 
    & 1\\
 \begin{tabular}{c}
    0\\
    \vdots\\
 \end{tabular} & A_n
               & \begin{tabular}{c}  0\\
                   \vdots
                 \end{tabular}  
  \\
  1 & \begin{tabular}{ccccc}
  0 & 0 & \ldots & 0 & 0 \\
\end{tabular} & a\\
\end{pmatrix}
\]
\end{document}

But I don't like the result because the margin between the "a" and the first "0" in the first line is too large. I guess it's due to the tabular environment. Anyway to improve it?

enter image description here

1
  • Already the great egreg provided the best answer, but just give @{} will produce almost the same output of egreg suggestion, and the code is \begin{tabular}{@{}c@{}} Commented 2 hours ago

1 Answer 1

7

You want a matrix, not a tabular.

\documentclass{article}
\usepackage{amsmath}

\begin{document}

\[
A_{n+1}=
\begin{pmatrix}
  a & \begin{matrix} 0 & 0 & \ldots & 0 & 0 \end{matrix} & 1 \\
  \begin{matrix} 0 \\ \vdots \end{matrix} & A_n \\
  1 & \begin{matrix} 0 & 0 & \ldots & 0 & 0 \end{matrix} & a
\end{pmatrix}
\]

\end{document}

output

Easier with nicematrix:

\documentclass{article}
\usepackage{amsmath}
\usepackage{nicematrix}

\begin{document}

\[
A_{n+1}=
\begin{pNiceMatrix}
  a & 0 & 0 & \dots & 0 & 0  & 1 \\
  0 & \Block{2-5}{A_n} \\
  \vdots  \\
  1 & 0 & 0 & \dots & 0 & 0  & a
\end{pNiceMatrix}
\]

\end{document}

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.