5

I have the following code:

\documentclass{article}
\usepackage{amsmath}

\begin{document}
\begin{align}
&\begin{bmatrix}
a'_{1,1} & a'_{1,2}\\
a'_{2,1} & a'_{2,2}
\end{bmatrix} &&= 
\begin{bmatrix}
\cos{\alpha} & \sin{\alpha} \\
-\sin{\alpha} & \cos{\alpha} \\
\end{bmatrix}
&&\cdot
&&\begin{bmatrix}
a_{1,1} & a_{1,2}\\
a_{2,1} & a_{2,2}
\end{bmatrix}
&&\cdot
&&\begin{bmatrix}
\cos{\alpha} & -\sin{\alpha} \\
\sin{\alpha} & \cos{\alpha} \\
\end{bmatrix}
\\
&\textbf{A}' &&= \textbf{R}^T &&\cdot && \textbf{A} &&\cdot &&\textbf{R}
\end{align}
\end{document}

It aligns indeed all the arguments like this:

enter image description here

But I want to have all the arguments centered between the separation as follows and without the equation numbering:

enter image description here

3
  • You can use \underset in order to get some letters/words underneath the matrices but it doesn't quite give the desired result. And for the equal sign it won't even stay in the same line as the letters
    – Raven
    Dec 18, 2018 at 17:49
  • And of course you can always do it the manual, dirty way: Prepending ~ until the desired space is reached - or simply using \hspace{}. But that has to be adjusted every time the equation changes...
    – Raven
    Dec 18, 2018 at 17:51
  • indeed @Mico. I remove gather from the code
    – ecjb
    Dec 18, 2018 at 18:00

2 Answers 2

4

A seven column array does the job. The columns for = and \cdot are of type >{{}}c<{{}} so the spacing around the items is the expected one. The outer array has no intercolumn spaces.

\documentclass{article}
\usepackage{amsmath,array}

\begin{document}

\begin{equation*}
\begin{array}{ @{}c *{3} { >{{}}c<{{}} @{} c @{} } }
\begin{bmatrix}
a'_{1,1} & a'_{1,2}\\
a'_{2,1} & a'_{2,2}
\end{bmatrix}
&=&
\begin{bmatrix}
\cos{\alpha} & \sin{\alpha} \\
-\sin{\alpha} & \cos{\alpha} \\
\end{bmatrix}
&\cdot&
\begin{bmatrix}
a_{1,1} & a_{1,2}\\
a_{2,1} & a_{2,2}
\end{bmatrix}
&\cdot&
\begin{bmatrix}
\cos{\alpha} & -\sin{\alpha} \\
\sin{\alpha} & \cos{\alpha} \\
\end{bmatrix}
\\[2ex]
\textbf{A}' &=& \textbf{R}^T &\cdot& \textbf{A} &\cdot &\textbf{R}
\end{array}
\end{equation*}

\end{document}

enter image description here

6
  • Thank you again @egreg. Could you please the use of { @{}c *{3} { >{{}}c<{{}} @{} c @{} } }?
    – ecjb
    Dec 18, 2018 at 21:19
  • @ecjb @{} means “no intercolumn space at this point”. With *{3}{...} it is meant “repeat 3 times what comes in the second set of braces. As said in the answer, even numbered columns will be like {}={} so the spacing around the sign are correctly handled.
    – egreg
    Dec 18, 2018 at 21:21
  • thank you @egreg, as it is still a little dense for me, do you have a link for the documentation about that notation? Many thanks in advance!
    – ecjb
    Dec 18, 2018 at 21:25
  • @ecjb The *{n}(...} notation is documented in all main LaTeX manuals. For the prefixes and affixes >{...} and <{...} look at the manual of array: texdoc.net/texmf-dist/doc/latex/tools/array.pdf
    – egreg
    Dec 18, 2018 at 21:31
  • thank you again @egreg for the answer. I just tried the code again and {ccccccc} instead of { @{}c *{3} { >{{}}c<{{}} @{} c @{} } } works also.
    – ecjb
    Dec 27, 2018 at 15:12
5

Here's a suggestion: Take a different approach to denoting what's A', A, R, R^T, by using \underbrace directives. This should make it clear to even the most casual readers that they're not dealing with two separate equations.

enter image description here

\documentclass{article}
\usepackage{mathtools} % for 'bmatrix*' env.
\begin{document}
\begin{equation}
{\underbrace{\begin{bmatrix}
  a'_{1,1} & a'_{1,2}\\
  a'_{2,1} & a'_{2,2}
\end{bmatrix}}_{\textstyle\mathbf{A}'}} = 
{\underbrace{\begin{bmatrix*}[r]
   \cos{\alpha} & \sin{\alpha} \\
  -\sin{\alpha} & \cos{\alpha} \\
\end{bmatrix*}}_{\textstyle\mathbf{R}^T}}
\cdot
{\underbrace{\begin{bmatrix}
  a_{1,1} & a_{1,2}\\
  a_{2,1} & a_{2,2}
\end{bmatrix}}_{\textstyle\mathbf{A}}}
\cdot
{\underbrace{\begin{bmatrix*}[r]
  \cos{\alpha} & -\sin{\alpha} \\
  \sin{\alpha} &  \cos{\alpha} \\
\end{bmatrix*}}_{\textstyle\mathbf{R}}}
\end{equation}
\end{document}

You must log in to answer this question.

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