5

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}

3 Answers 3

3

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

3
  • 1) It's not a vector it's an ordered pair. 2) Sorry 3) I want the ordered pair above the matrix. Commented Apr 4, 2014 at 9:35
  • @user2342771 I did see the original comment; please, never do that again. Sorry for having misunderstood your request, now the answer should have what you're looking for. Still, I can't understand what the thing should mean.
    – egreg
    Commented Apr 4, 2014 at 9:55
  • That was a joke that my friend put in. I tried to add a new line to the comment and didn't realize it would actually submit the comment. Commented Apr 7, 2014 at 4:41
1
\documentclass[12pt]{article}

\begin{document}
\[
\begin{array}{r @{} c @{} l}
   (     & 2 \quad,\quad3 & )\\
  \Bigg[ & 
  \begin{array}{cr}
    \cos\theta & -\sin\theta \\
    \sin\theta & \cos\theta \\
  \end{array}             & \Bigg]
\end{array}
\]
\end{document}

enter image description here

0

With nicematrix.

\documentclass{article}
\usepackage{nicematrix}

\begin{document}

\begin{NiceMatrixBlock}[auto-columns-width]

$\begin{pNiceArray}{c@{,}c}
2 & 3 
\end{pNiceArray}$

\medskip
$\begin{bNiceMatrix}
\cos \theta & -\sin\theta \\
\sin \theta & \cos \theta 
\end{bNiceMatrix}$

\end{NiceMatrixBlock}

\end{document}

Output of the above code

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .