1
\documentclass[10pt,letterpaper]{article}
\usepackage[utf8]{inputenc}
\usepackage{mathtools}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{parskip}
\usepackage[left=2cm,right=2cm,top=2cm,bottom=2cm]{geometry}
\begin{document}
$\text{tr }(PQ)=\displaystyle\sum_{i=i}^{n}\sum_{j=1}^m
\left[\displaystyle\prod_{i=i}^{n}\prod_{j=1}^m\
\left(p_{ij}q_{ij}\right)\right]
\\\text{tr }(QP)=\displaystyle\sum_{i=i}^{n}\sum_{j=1}^m
\left[\displaystyle\prod_{i=i}^{n}\prod_{j=1}^m
\left(q_{ij}p_{ij}\right)\right]$
\end{document}

When I use something like this, the output looks nice, but the breaks between lines look too small due to the size of \left[ and \right]:

enter image description here

Is there a way to add a bit of space between these lines, so \left[ and \right] don't look like they are almost touching?

  • Welcome to TeX.SX! Please add a minimal working example that takes the form \documentclass{...}\usepackage{....}\begin{document}...\end{document}. If possible, it should compile and have the minimum amount of code needed to illustrate your problem. This makes it much easier for people to help you - and much more likely that they will! – Andrew May 3 '15 at 5:39
3

First, you need at most \displaystyle per line but you are probably better off using \[...\] or an equation environment.

Secondly, to get the spacing right around operators rather than using \text it is better to use

\DeclareMathOperator{\tr}{tr}

from the amsmath package. Next, I suspect that what you really want here is to put everything into an alignment enviroment such as the align* environment to give:

enter image description here

Notice that the &'s tell latex where to align the two equations.

Finally, and this is a personal preference, I don't like using \left...\right as I think that the operators are usually too large. Instead I use the amsmath \big, \bigg, \Big, \Bigg operators. Here is the complete code.

\documentclass{article}
\usepackage{amsmath}
\DeclareMathOperator{\tr}{tr}
\begin{document}

  \begin{align*}
  \tr(PQ)&=\sum_{i=i}^{n}\sum_{j=1}^m
      \Big[\prod_{i=i}^{n}\prod_{j=1}^m\ p_{ij}q_{ij}\Big]\\
  \tr(QP)&=\sum_{i=i}^{n}\sum_{j=1}^m
    \Big[\prod_{i=i}^{n}\prod_{j=1}^m q_{ij}p_{ij}\Big]
  \end{align*}

\end{document}
  • 1
    \Bigl[ and \Bigr], not just \Big. You may also mention \\[<length>] – egreg May 3 '15 at 11:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.