3

I want some help, with this script :

\begin{center}
A = \begin{pmatrix}
0 & 1 & 1 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\
0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 1 \\
0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 1 \\
0 & 0 & 0 & 0 & 1 & 1 & 0 & 0 & 0 & 0 \\
0 & 0 & 1 & 0 & 0 & 0 & 0 & 1 & 1 & 0 \\
0 & 0 & 0 & 0 & 0 & 0 & 1 & 0 & 0 & 0 \\
0 & 0 & 0 & 0 & 0 & 0 & 0 & 1 & 1 & 0 \\
0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\
0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\
0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\
\end{pmatrix}
\end{center}

I get this Matrix :

enter image description here

But I want a matrix like this :

enter image description here

Can you help me ?

Red One
  • 633

3 Answers3

3

In this particular case, a simple fix is:

\documentclass{article}
\usepackage{amsmath,stackengine}
\stackMath
\begin{document}
\[
A = 
\begin{matrix}
1\\2\\3\\4\\5\\6\\7\\8\\9\\10
\end{matrix}
\stackon[1pt]{\begin{pmatrix}
0 & 1 & 1 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\
0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 1 \\
0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 1 \\
0 & 0 & 0 & 0 & 1 & 1 & 0 & 0 & 0 & 0 \\
0 & 0 & 1 & 0 & 0 & 0 & 0 & 1 & 1 & 0 \\
0 & 0 & 0 & 0 & 0 & 0 & 1 & 0 & 0 & 0 \\
0 & 0 & 0 & 0 & 0 & 0 & 0 & 1 & 1 & 0 \\
0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\
0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\
0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\
\end{pmatrix}
}{
\begin{matrix}
~1&2&3&4&5&6&7&8&9&10
\end{matrix}
}
\]
\end{document}

enter image description here

If you indeed wanted the labels in bold,

\documentclass{article}
\usepackage{amsmath,tabstackengine}
\TABstackTextstyle{\bfseries}
\setstacktabbedgap{9.2pt}
\begin{document}
\[
A = 
\tabbedCenterstack[r]{1\\2\\3\\4\\5\\6\\7\\8\\9\\10}
\stackon[1pt]{$\begin{pmatrix}
0 & 1 & 1 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\
0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 1 \\
0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 1 \\
0 & 0 & 0 & 0 & 1 & 1 & 0 & 0 & 0 & 0 \\
0 & 0 & 1 & 0 & 0 & 0 & 0 & 1 & 1 & 0 \\
0 & 0 & 0 & 0 & 0 & 0 & 1 & 0 & 0 & 0 \\
0 & 0 & 0 & 0 & 0 & 0 & 0 & 1 & 1 & 0 \\
0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\
0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\
0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\
\end{pmatrix}$%
}{%
\;\;\tabbedCenterstack{1&2&3&4&5&6&7&8&9&10}%
}
\]
\end{document}

enter image description here

2

You also can do it with blkarray:

\documentclass{article}
\usepackage{mathtools,blkarray}

\begin{document}

\[ \newcounter{rowct}\newcounter{colct}%\setlength\extrarowheight{1cm}
A =
\begin{blockarray}{*{11}{c}}
\begin{block}{r*{10}{>{\refstepcounter{colct}\mathclap{\mathbf\thecolct}}c}}
 & & & & & & & & & & \\%[-1ex]
 \end{block}
 \begin{block}{ >{\refstepcounter{rowct}\mathbf\therowct}r( >{\hspace{0.2em}}*{10}{c} <{\hspace{0.2em}})}
  &0 & 1 & 1 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \rule{0pt}{3.5ex} \\
 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 1 \\
 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 1 \\
& 0 & 0 & 0 & 0 & 1 & 1 & 0 & 0 & 0 & 0 \\
 & 0 & 1 & 0 & 0 & 0 & 0 & 1 & 1 & 0 & 0 \\
 & 0 & 0 & 0 & 0 & 0 & 1 & 0 & 0 & 0 & 0 \\
 & 0 & 0 & 0 & 0 & 0 & 0 & 1 & 1 & 0 & 0 \\
 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\
 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\
 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\[1ex]
 \end{block}
\end{blockarray}
\]
\end{document} 

enter image description here

Bernard
  • 271,350
2

With {pNiceMatrix} of nicematrix:

\documentclass{article}
\usepackage{nicematrix}

\begin{document}

\begin{center} $A = \begin{pNiceMatrix}% [ first-row, code-for-first-row = \mathbf{\arabic{jCol}}, first-col, code-for-first-col = \mathbf{\arabic{iRow}}, columns-width=auto, ] & & & & & & & & & & \ & 0 & 1 & 1 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \ & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 1 \ & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 1 \ & 0 & 0 & 0 & 0 & 1 & 1 & 0 & 0 & 0 & 0 \ & 0 & 0 & 1 & 0 & 0 & 0 & 0 & 1 & 1 & 0 \ & 0 & 0 & 0 & 0 & 0 & 0 & 1 & 0 & 0 & 0 \ & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 1 & 1 & 0 \ & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \ & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \ & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \ \end{pNiceMatrix}$ \end{center}

\end{document}

Output of the above code

F. Pantigny
  • 40,250