1

I'm using an align environment in a long derivation. Each equality is aligned at the equal sign. Individual lines are too long to fit the page, so I need wrap them. However, I don't just want them to continue in the next line as I usually do and maybe indent them with a \quad, I want them to align with the opening bracket which contains all the terms. I've been looking into the aligned environment which sort of does what I want, but now the aligned lines are vertically centered with the beginning of the equality:

\begin{align*}
 Z &= Tr_\text{el, ph}\bigl[\exp(-\beta H)\bigr]\\
 &= \int\mathcal{D}q Tr_\text{el}\biggl[T_\tau\exp\biggl(-\int_0^\beta d\tau\sum_j\Bigl[
 \begin{aligned}
   &-t\sum_\sigma\bigl(c_{j\sigma}^\dag(\tau)c_{j+1,\sigma}(\tau)+\text{h.c.}\bigr)\\
   &+\tfrac{M}{2}\bigl(\dot q_j(\tau)^2+\omega_0^2q_j(\tau)^2\bigr)\\
   &-g\sqrt{2M\omega_0}\sum_\sigma n_{j\sigma}(\tau)q_j(\tau)\Bigr]\biggr)\biggr]
 \end{aligned}\\
 &= ...
\end{align*}

What I have

This is what I would like it to look (photoshopped): enter image description here

I imagine, I'm not the first one to have this problem. I did a thorough search before posting this question, so before you mark this as a duplicate, please consider carefully if the alleged duplicate really addresses my issue.

4
  • You are missing the [t] option for aligned. You might also want to add a \! before \begin{aligned}
    – daleif
    Jul 24, 2015 at 13:49
  • Very nice, I missed that indeed. Is there maybe a way to center the equation number vertically? It was, before I added [t] but now it is on the same height has the equal sign. Maybe that's more reasonable anyway... Jul 24, 2015 at 13:54
  • No (AFAIK), the [t] changes the baseline, thus I only add it to constructions that are not individually numbered. Yuo could add a single equation number to the entire calculation instead.
    – daleif
    Jul 24, 2015 at 13:56
  • I'll write something a little longer, there are stuff here you should never do.
    – daleif
    Jul 24, 2015 at 13:57

1 Answer 1

3

To get aligned to line up with the first line remember the [t] option.

Don't use \text for anything but textual comments in display math. This _\text{el} is not a textual comment. Better to use another construction.

\documentclass[a4paper]{memoir}
\usepackage{mathtools}
\DeclareMathOperator\Tr{Tr}
% for text only subscripts 
\newcommand\tsub[1]{_\textup{#1}}% or \textnormal
% never use \text for anything but textual comments
\begin{document}
\begin{align*}
  Z &= \Tr\tsub{el,ph}\bigl[\exp(-\beta H)\bigr]\\
  &= \int\mathcal{D}q
  \Tr\tsub{el}\biggl[T_\tau\exp\biggl(-\int_0^\beta d\tau\sum_j\Bigl[
  \!
 \begin{aligned}[t]
   &-t\sum_\sigma\bigl(c_{j\sigma}^\dag(\tau)c_{j+1,\sigma}(\tau)+\text{h.c.}\bigr)\\
   &+\tfrac{M}{2}\bigl(\dot q_j(\tau)^2+\omega_0^2q_j(\tau)^2\bigr)\\
   &-g\sqrt{2M\omega_0}\sum_\sigma n_{j\sigma}(\tau)q_j(\tau)\Bigr]\biggr)\biggr]
 \end{aligned}\\
 &= ...
\end{align*}

The above waste a bit too much space IMO. Here is another

\begin{align*}
  Z &= \Tr\tsub{el,ph}\bigl[\exp(-\beta H)\bigr]\\
  &= \int\mathcal{D}q
  \Tr\tsub{el}
  \begin{aligned}[t]
  \biggl[&T_\tau\exp\biggl(-\int_0^\beta d\tau\sum_j
    \Bigl[
        -t\sum_\sigma\bigl(c_{j\sigma}^\dag(\tau)c_{j+1,\sigma}(\tau)+\text{h.c.}\bigr)
    \\
    &+\tfrac{M}{2}\bigl(\dot q_j(\tau)^2+\omega_0^2q_j(\tau)^2\bigr)
    \sqrt{2M\omega_0}\sum_\sigma
    n_{j\sigma}(\tau)q_j(\tau)\Bigr]\biggr)\biggr]
  \end{aligned}
  \\
  &= ...
\end{align*}
\end{document}

enter image description here

5
  • Thanks for the additional comments. el and ph are short for "electronic" and "phononic", so I would in fact consider them textual comments. Placing the three additive terms in separate lines make referring to them in the surrounding text easier. Jul 24, 2015 at 14:21
  • A different question, but I can't help to notice: you used \DecaleMathOperator to define the trace, I usually use \operatorname. Is there a reason why one is preferable? Jul 24, 2015 at 14:24
  • 1
    Less typing. Also \DeclareMathOperator* easily makes a \lim like operator (where linits go above and below in displayed math)
    – daleif
    Jul 24, 2015 at 14:26
  • 1
    As for your comments to el and ph those are not textual comments, they are textual indices. Big difference. Textual indices should always be upright (just as operator names), but \text is italic then the surrounding text is italic!
    – daleif
    Jul 24, 2015 at 14:28
  • Great, the \lim-like behavior is actually what I want! Jul 24, 2015 at 14:31

You must log in to answer this question.

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