Horizontal stretching of pmatrix
Use \arraycolsep
:
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{amsmath}
\usepackage{mathtools}
\usepackage{graphicx}
\begin{document}
\setlength{\arraycolsep}{10pt}.
\renewcommand\arraystretch{2}
\[
\begin{pmatrix}
2 & 1 & 0 & 0 & 1 & 0 \\
1 & 0 & 1 & 0 & 1 & 0 \\
0 & 1 & 0 & 1 & 0 & 0 \\
0 & 0 & 1 & 0 & 1 & 1 \\
1 & 1 & 0 & 1 & 0 & 0 \\
0 & 0 & 0 & 1 & 0 & 0
\end{pmatrix}
\]
\end{document}
And also please un-learn $$, it's deprecated.
You can play with \arraycolsep
, and to ensure a proper spacing between the contents of the matrix and the parentheses, you can nest a matrix
environment, surrounded by a pair of horizontal spaces, in a pmatrix
environment, like this:
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{mathtools}
\begin{document}
\[ \setlength{\arraycolsep}{10pt}
\renewcommand\arraystretch{2}
\begin{pmatrix}
\hspace {0.7em}
\begin{matrix}
2 & 1 & 0 & 0 & 1 & 0 \\
1 & 0 & 1 & 0 & 1 & 0 \\
0 & 1 & 0 & 1 & 0 & 0 \\
0 & 0 & 1 & 0 & 1 & 1 \\
1 & 1 & 0 & 1 & 0 & 0 \\
0 & 0 & 0 & 1 &0 & 0
\end{matrix}
\hspace {0.7em}
\end{pmatrix}
\]
\end{document}
One possibility is to use tabular*
. Please see here for more options.
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{amsmath}
\renewcommand\arraystretch{2}
\begin{document}
\[
\left(\vcenter{\hbox{\begin{tabular*}{0.85\textwidth}{@{\extracolsep{\fill}} *{6}{c}}
2 & 1 & 0 & 0 & 1 & 0 \\
1 & 0 & 1 & 0 & 1 & 0 \\
0 & 1 & 0 & 1 & 0 & 0 \\
0 & 0 & 1 & 0 & 1 & 1 \\
1 & 1 & 0 & 1 & 0 & 0 \\
0 & 0 & 0 & 1 & 0 & 0
\end{tabular*}}}\right)
\]
\end{document}