0

I am currently having a problem with multiplying matrices over a number of lines, my code is as follows:

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[a4paper, total={6in, 8in}]{geometry}
\usepackage{bm}
\usepackage{amsmath}

\begin{document}

\begin{align} = \min tr \left { \begin{bmatrix} d_1 & 0 & \cdots & 0\ 0 & d_2 & \cdots & 0\ \vdots & \vdots & \ddots & \vdots\ 0 & 0 & 0 & d_p\ 0 & 0 & \cdots & 0 \end{bmatrix} \left (\begin{bmatrix} 1 & 0 & \cdots & 0\ 0 & 1 & \cdots & 0\ \vdots & \vdots & \ddots & \vdots\ 0 & 0 & 0 & 1\ 0 & 0 & \cdots & 0 \end{bmatrix} - \begin{bmatrix} 1 & 0 & \cdots & 0\ 0 & 1 & \cdots & 0\ \vdots & \vdots & \ddots & \vdots\ 0 & 0 & 0 & 0\ 0 & 0 & \cdots & 0 \end{bmatrix} \right ) \ \begin{bmatrix} d_1 & 0 & \cdots & 0\ 0 & d_2 & \cdots & 0\ \vdots & \vdots & \ddots & \vdots\ 0 & 0 & 0 & d_p\ 0 & 0 & \cdots & 0 \end{bmatrix} \left(\begin{bmatrix} 1 & 0 & \cdots & 0\ 0 & 1 & \cdots & 0\ \vdots & \vdots & \ddots & \vdots\ 0 & 0 & 0 & 1\ 0 & 0 & \cdots & 0 \end{bmatrix} - \begin{bmatrix} 1 & 0 & \cdots & 0\ 0 & 1 & \cdots & 0\ \vdots & \vdots & \ddots & \vdots\ 0 & 0 & 0 & 0\ 0 & 0 & \cdots & 0 \end{bmatrix} \right) \right } \end{align}

\end{document}

Ideally I would want all of them in the same line, but since they are too long, I have to use multiple lines.
It seems like the problem might be with the curly bracket at the end.

I have tried to implement what is suggested here and have also tried using multiline, but have not been successful.

I am fairly new to latex, so apologies if this question has a very simple answer.
Thank you!

Stochastic
  • 103
  • 5
  • you can not break the line between \left and \right, use `\bigl{ and \bigr} also please post the example in a form that we can run without guessing the needed preamble and page size. – David Carlisle Jun 11 '20 at 16:52
  • Thank you @DavidCarlisle I have added the preamble and page size. – Stochastic Jun 11 '20 at 17:44

1 Answers1

2

I guess that this is part of a bigger display. Since all objects have the same height, you can use \right. and \left. to insert “empty delimiters”.

\documentclass{article}
\usepackage{amsmath}

\begin{document}

\begin{align} &= \min \operatorname{tr} \left { \begin{bmatrix} d_1 & 0 & \cdots & 0\ 0 & d_2 & \cdots & 0\ \vdots & \vdots & \ddots & \vdots\ 0 & 0 & 0 & d_p\ 0 & 0 & \cdots & 0 \end{bmatrix} \left( \begin{bmatrix} 1 & 0 & \cdots & 0\ 0 & 1 & \cdots & 0\ \vdots & \vdots & \ddots & \vdots\ 0 & 0 & 0 & 1\ 0 & 0 & \cdots & 0 \end{bmatrix} - \begin{bmatrix} 1 & 0 & \cdots & 0\ 0 & 1 & \cdots & 0\ \vdots & \vdots & \ddots & \vdots\ 0 & 0 & 0 & 0\ 0 & 0 & \cdots & 0 \end{bmatrix} \right ) \right. \ &\hspace{6em}\left. \begin{bmatrix} d_1 & 0 & \cdots & 0\ 0 & d_2 & \cdots & 0\ \vdots & \vdots & \ddots & \vdots\ 0 & 0 & 0 & d_p\ 0 & 0 & \cdots & 0 \end{bmatrix} \left( \begin{bmatrix} 1 & 0 & \cdots & 0\ 0 & 1 & \cdots & 0\ \vdots & \vdots & \ddots & \vdots\ 0 & 0 & 0 & 1\ 0 & 0 & \cdots & 0 \end{bmatrix} - \begin{bmatrix} 1 & 0 & \cdots & 0\ 0 & 1 & \cdots & 0\ \vdots & \vdots & \ddots & \vdots\ 0 & 0 & 0 & 0\ 0 & 0 & \cdots & 0 \end{bmatrix} \right) \right } \end{align}

\end{document}

enter image description here

egreg
  • 1,121,712