[Tex/LaTex] Giving two matrices the same width

matrices

I've got two matrices, were one is an ordered pair (a point) and the second one is a rotation matrix below that. How do I get them both to be the same width? I have two sets of parentheses and I still want them to be separate arrays.

\documentclass[12pt]{article}
\usepackage{a4wide}
\usepackage{amsmath}

\begin{document}
    $$
    \left(
    \begin{array}{ccc}
        2 & , & 3
    \end{array}
    \right)
    \left[
    \begin{array}{ccc}
        \cos{\theta} & -\sin{\theta} \\
        \sin{\theta} & \cos{\theta}
    \end{array}
    \right]
    $$
\end{document}

Best Answer

Note that $$...$$ shouldn't be used in LaTeX, see Why is \[ ... \] preferable to $$ ... $$?; also a4wide is a deprecated package. If you want to widen the text area, use geometry.

You can obtain what you want with blkarray:

\documentclass[12pt]{article}
\usepackage{amsmath,blkarray}

\begin{document}
\[
\begin{blockarray}{cc}
\begin{block}{(c@{\rlap{,}}c)}
2 & 3 \\
\end{block}
\begin{block}{[cc]}
\cos\theta & -\sin\theta \\
\sin\theta & \cos\theta \\
\end{block}
\end{blockarray}
\]
\end{document}

enter image description here

If you want to distance the two blocks, add a phantom row and some vertical negative space:

\documentclass[12pt]{article}
\usepackage{amsmath,blkarray}

\begin{document}
\[
\begin{blockarray}{cc}
\begin{block}{(c@{\rlap{,}}c)}
2 & 3 \\
\end{block}
& \\[-2ex]
\begin{block}{[cc]}
\cos\theta & -\sin\theta \\
\sin\theta & \cos\theta \\
\end{block}
\end{blockarray}
\]
\end{document}

enter image description here


Original answer, superseded by OP's comments.

Matrices are better typeset with the environments provided by amsmath, rather than directly with array.

\documentclass[12pt]{article}
\usepackage{amsmath,mathtools,calc}

\begin{document}
\[
\begin{pmatrix}
\mathmakebox[\widthof{$\cos\theta$}]{2}\mathrlap{\ \ ,}&
\mathmakebox[\widthof{$-\sin\theta$}]{3}
\end{pmatrix}
\begin{bmatrix}
\cos\theta & -\sin\theta \\
\sin\theta & \cos\theta
\end{bmatrix}
\]
\[
\begin{bmatrix}
2 & 3
\end{bmatrix}
\begin{bmatrix}
\cos\theta & -\sin\theta \\
\sin\theta & \cos\theta
\end{bmatrix}
\]
\end{document}

enter image description here