# How to go to the next line in a matrix form and how to reduce the vertical space in a matrix

In fact after compiling the code below, the third matrx is outside the paper form, I want to have this matrix in the next line in the middle, also I want to reduce the vertical space in a matrix, I know in this example it's reduced but generally how can we reduce it.

\immediate\write18{makeindex \jobname.nlo -s nomencl.ist -o \jobname.nls}
\documentclass[12pt]{report}
\DeclareMathSizes{12}{30}{16}{12}
\usepackage[utf8]{inputenc}
\usepackage{lineno}
\usepackage{amsmath}
\usepackage{array}
\usepackage{mathptmx}
\begin{document}
$$[L_{ss}]= \begin{bmatrix} R_s & M_s & M_s \\ M_s & R_s & M_s \\ M_s & M_s & R_s \end{bmatrix}, [L_{rr}]= \begin{bmatrix} R_r & M_r & M_r \\ M_r & R_r & M_r \\ M_r & M_r & R_r \end{bmatrix} [M_{sr}]=[M_{rs}]^t= M_{sr} \begin{bmatrix} cos(\theta) & cos(\theta-4\pi/3) & cos(\theta-2\pi/3) \\ cos(\theta-2\pi/3) & cos(\theta) & cos(\theta-4\pi/3 \\ cos(\theta-4\pi/3) & cos(\theta-2\pi/3) & cos(\theta) \end{bmatrix}$$
\end{document}


For vertical spacing:

• What's the purpose of \DeclareMathSizes{12}{30}{16}{12}? – egreg Mar 19 '18 at 15:02
• Changing the font of an equation – twimo Mar 19 '18 at 15:06

I propose to use the gathered environment, and the xmatrix* envoronments from mathtools (the columns alignment is an optionand the medium-sized fractions fromnccmath:

\documentclass[12pt]{report}
\DeclareMathSizes{12}{30}{16}{12}
\usepackage[utf8]{inputenc}
\usepackage{mathtools}
\usepackage{array, nccmath}
\usepackage{mathptmx}

\begin{document}

$$\begin{gathered} [L_{ss}]= \begin{bmatrix} R_s & M_s & M_s \\ M_s & R_s & M_s \\ M_s & M_s & R_s \end{bmatrix},\qquad [L_{rr}]= \begin{bmatrix} R_r & M_r & M_r \\ M_r & R_r & M_r \\ M_r & M_r & R_r \end{bmatrix} \\[1.5ex] [M_{sr}]=[M_{rs}]^t= M_{sr} \begin{bmatrix*}[l] \cos\theta & \cos\Bigl(\theta-\mfrac{4\pi}{3}\Bigr) & \cos\Bigl(\theta-\mfrac{2\pi}{3}\Bigr) \\[1.5ex] \cos\Bigl(\theta-\mfrac{2\pi}{3}\Bigr) & \cos(\theta) & \cos\Bigl(\theta-\mfrac{4\pi}{3}\Bigr) \\[1.5ex] \cos\Bigl(\theta-\mfrac{4\pi}{3}\Bigr) &\cos\Bigl(\theta-\mfrac{2\pi}{3}\Bigr) & \cos\theta \end{bmatrix*} \end{gathered}$$

\end{document}


Edit:

To answer a question in the comments, this code for the last matrix:

\begin{bmatrix}
\cos\theta & \cos\Bigl(\theta-\mfrac{4\pi }{3}\Bigr) & \cos\Bigl(\theta-\mfrac{2\pi }{3}\Bigr) \\[1.5ex]
\cos\Bigl(\theta-\mfrac{2\pi }{3}\Bigr) & \cos \theta  & \cos\Bigl(\theta-\mfrac{4\pi }{3}\Bigr) \\[1.5ex]
\cos\Bigl(\theta-\mfrac{4\pi }{3}\Bigr) &\cos\Bigl(\theta-\mfrac{2\pi }{3}\Bigr) & \cos\theta
\end{bmatrix}


yields this result:

• Thank you very much @Bernard but how about reducing the vertical space in a matrix see the new edited post and also I want to know how can I make cos(\theta) in the middle not aligned with the vertical expressions – twimo Mar 19 '18 at 15:32
• @Twimo: to reduce the vertical spacing, use \renewcommand{\arraystretch}{some number < 1} before the matrix (put it with the matrix in a group if you want it to be local). However I had to increase the spacing here – otherwise two consecutive rows touch each other. For your other question, I'll post a solution in a moment. – Bernard Mar 19 '18 at 15:47
• @twimo; Does the new code correspond to what you want? – Bernard Mar 19 '18 at 15:54
• Thank you so very much @Bernardeverything is fine but the cos \theta of the first and the third column are not in the middle even if I use {}\hfill – twimo Mar 19 '18 at 16:11
• @Twimo: Oh! I hadn't understood you want them centred in all columns. In this case, simply remove the optional argument [l]: all columns will be centred (it's the default). No \hfill{}` to be used in this case. – Bernard Mar 19 '18 at 17:12