3

Searching the website I found plenty of similarly related questions, such as this, this or this one. Nevertheless none of the answers to the questions I found so far addressed precisely this issue.

As it happens, I have a series of equations and some of them are too long to fit a line. I would like to break them in two parts, with the upper part being aligned to the $=$-sign and the bottom part being aligned on the right margin. The output, in this case obtained using \hspace, should look like this

\documentclass[11pt]{article}

\usepackage[english]{babel}
\usepackage{amsmath}

\begin{document}

Here I write a line to be sure of the precise and exact extension of the margin.

\begin{align*}
\mathrm{HTr}K^\Gamma_{\overline{M}_{-k}}(t) = &  \sum_{\gamma \in H(\Gamma)} \int_X \sum_{[\kappa] \in \Gamma\backslash\Gamma_\gamma} \sum_{n=1}^\infty  j(\kappa^{-1}\gamma^n\kappa,z)^k\times{} \\
& \hspace{4.6cm} \times K_{-k,\text{hyp}}(t;\kappa^{-1}\gamma^n\kappa(z),z) \mu_\text{hyp}(z) 
\intertext{Now I comment on the next step,}
= &  \sum_{\gamma \in H(\Gamma)} \int_X \sum_{[\kappa] \in \Gamma\backslash\Gamma_\gamma} \sum_{n=1}^\infty  j(\kappa^{-1}\gamma^n\kappa,z)^k\times{} \\
& \hspace{4.6cm} \times K_{-k,\text{hyp}}(t;\kappa^{-1}\gamma^n\kappa(z),z) \mu_\text{hyp}(z) 
\intertext{And finally it simplifies}
= & \; 0.
\end{align*}
\end{document}

enter image description here

Is there a way to automatically align the second line to the right margin? I imagine something like flushright that works inside the align environment, or, as the present answer seems to suggest, a way to realign the equations into a multline-environment.

Thank you!

  • You want multline*, rather than align* – egreg Jan 11 '16 at 19:04
  • Thanks for the very prompt reply! Could I ask you to elaborate a bit more, please? – Giovanni De Gaetano Jan 11 '16 at 19:05
3

The environment you want is multline*, not align*:

\documentclass[11pt]{article}

\usepackage[english]{babel}
\usepackage{amsmath}

\DeclareMathOperator{\HTr}{HTr}

\begin{document}

Here I write a line to be sure of the precise and exact extension of the margin.
\begin{multline*}
\HTr K^\Gamma_{\overline{M}_{-k}}(t) =
  \sum_{\gamma \in H(\Gamma)} \int_X \sum_{[\kappa] \in \Gamma\setminus\Gamma_\gamma}
  \sum_{n=1}^\infty  j(\kappa^{-1}\gamma^n\kappa,z)^k\times{} \\
\times K_{-k,\mathrm{hyp}}(t;\kappa^{-1}\gamma^n\kappa(z),z) \mu_{\mathrm{hyp}}(z)
\end{multline*}
\end{document}

enter image description here

Note the {} after the trailing \times. Also \mathrm{HTr} is wrong and the same is for \text{hyp}; your \backslash should be \setminus.

For splitting lines keeping the alignment at the relation signs, there is multlined (requires mathtools):

\documentclass[11pt]{article}

\usepackage[english]{babel}
\usepackage{mathtools}

\DeclareMathOperator{\HTr}{HTr}

\begin{document}

Here I write a line to be sure of the precise and exact extension of the margin.

\begin{align*}
\HTr K^\Gamma_{\overline{M}_{-k}}(t) 
&= \begin{multlined}[t]
   \sum_{\gamma \in H(\Gamma)} \int_X \sum_{[\kappa] \in \Gamma\setminus\Gamma_\gamma}
     \sum_{n=1}^\infty  j(\kappa^{-1}\gamma^n\kappa,z)^k\times{} \\[2ex]
   \times K_{-k,\text{hyp}}(t;\kappa^{-1}\gamma^n\kappa(z),z) \mu_{\mathrm{hyp}}(z)
   \end{multlined}
\intertext{Now I comment on the next step,}
&= \begin{multlined}[t]
   \sum_{\gamma \in H(\Gamma)} \int_X \sum_{[\kappa] \in \Gamma\setminus\Gamma_\gamma}
     \sum_{n=1}^\infty  j(\kappa^{-1}\gamma^n\kappa,z)^k\times{} \\[2ex]
   \times K_{-k,\mathrm{hyp}}(t;\kappa^{-1}\gamma^n\kappa(z),z) \mu_{\mathrm{hyp}}(z)
   \end{multlined}
\intertext{And finally it simplifies}
&= 0.
\end{align*}
\end{document}

enter image description here

  • Thanks again, +1! Regarding multline I have the following problem: the formula in consideration is only a step in a computation that requires some inequalities to be developed, and I would like to have simultaneously the =-signs aligned in the center and the "too-long" parts in some of the lines moved to the right. Is it possible to do so with multline? I'm willing to invest some time to learn how to do it by myself, but it would be nice to know in advance whether it's possible or not. I extend the example of the question to show what I mean. – Giovanni De Gaetano Jan 11 '16 at 19:25
  • I updated the question! And, as a side question, why is the $\mathrm{HTr}$-wrong? I understand the other two, that I simplified to rapidly obtian a MWE, but not this one. Should have I declared a math operator? – Giovanni De Gaetano Jan 11 '16 at 19:31
  • 'sorry, I read only now that you already wrote I should have declared a math operator. – Giovanni De Gaetano Jan 11 '16 at 19:40
  • @GiovanniDeGaetano My crystal ball is under maintenance. ;-) I added a new part. – egreg Jan 11 '16 at 20:58

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.