0

I have several (well in this case 2) equations, that I want to align at the equality sign. This is easily done using the align environment from the amsmath package. Additionally, I want to have a note to the far right of each equation, which I do with double ampersands (&&).

My problem is now, what do I do if any of the above-mentioned equations are longer than a single line, i.e. have to be broken up? Right now I have broken them into several environments, but that looks ugly, and not aligned. Any suggestions?

EDIT: I was apparently so hungry that I forgot the MLE, so here it is.

\begin{align*}
Y_{i,k}^{-} = Y_{i-1,k} + &g^0_{k}(Y_{i-1}) \Delta_{i-1,k} + \sum_{j=1}^{d} g^1_{k,j}(Y_{i-1}) \Delta W_{i-1,j} \\&+ \sum_{j_1,j_2=1}^d h_{k,j_1,j_2}(Y_{i-1})(\Delta W_{i-1,j_1}\Delta W_{i-1,j_2}-\Omega_{j_1,j_2}\Delta - A_{i-1,j,k}) && (\mbox{Milstein})
\end{align*}
\begin{align*}
Y_{i,k} &= \begin{cases}
Y_{i,k}^- & \mbox{if } t_{i} \notin \mathcal{I}^k_{arrival} \\
Y_{i,k}^- + Y_{i,k}^- \Delta J_{i,k} & \mbox{if } t_{i} \in \mathcal{I}^k_{arrival} 
\end{cases} && (\mbox{Jump})
\end{align*}
  • There are several ways. If you provide a minimum working example, the "best" way may make itself more apparent for your particular cases. A lot may depend on how you want the multi-line part of the equations to be aligned. – Steven B. Segletes Sep 1 '17 at 9:41
  • Oops, my mistake. It is now included. – Nicky Mattsson Sep 1 '17 at 10:59
  • An MWE is more than a code snippet. For example, I have no idea how \W is defined with just a code snippet...or is that just a typo? – Steven B. Segletes Sep 1 '17 at 11:11
  • Maybe \documentclass{article} \usepackage{amsmath} \begin{document} \begin{align*} Y_{i,k}^{-} ={}& Y_{i-1,k} + g^0_{k}(Y_{i-1}) \Delta_{i-1,k} + \sum_{j=1}^{d} g^1_{k,j}(Y_{i-1}) \Delta W_{i-1,j} \\&+ \sum_{j_1,j_2=1}^d h_{k,j_1,j_2}(Y_{i-1})(\Delta W_{i-1,j_1}\Delta W_{i-1,j_2}-\Omega_{j_1,j_2}\Delta - A_{i-1,j,k}) && (\mbox{Milstein}) \\ Y_{i,k} ={}& \begin{cases} Y_{i,k}^- & \mbox{if } t_{i} \notin \mathcal{I}^k_{arrival} \\ Y_{i,k}^- + Y_{i,k}^- \Delta J_{i,k} & \mbox{if } t_{i} \in \mathcal{I}^k_{arrival} \end{cases} && (\mbox{Jump}) \end{align*} \end{document} – Steven B. Segletes Sep 1 '17 at 11:16
  • \W was a typo, it was supposed to just be W. – Nicky Mattsson Sep 1 '17 at 11:47
1

I propose two solutions for the first equation, using \tag. or the second equation, you'll a really centred equationusing \rlap:

\documentclass[11pt,a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage[showframe]{geometry}
\usepackage{mathtools}

\begin{document}

\begin{align*}
   & \begin{split}Y_{i,k}^{-} = Y_{i-1,k}&+g⁰_{k}(Y_{i-1}) \Delta_{i-1,k} + ∑_{j=1}^{d} g¹_{k,j}(Y_{i-1}) ΔW_{i-1,j} \\[-1.5ex
    ]&+ \smashoperator{∑_{j₁,j₂=1}^d h_{k,j₁,j₂}}(Y_{i-1})(ΔW_{i-1,j₁}ΔW_{i-1,j₂}-\Omega_{j₁,j₂}Δ- A_{i-1,j,k}) \end{split} \tag{Milstein}
\end{align*}

\begin{multline*}
  Y_{i,k}^{-} = Y_{i-1,k} + g⁰_{k}(Y_{i-1}) \Delta_{i-1,k} + ∑_{j=1}^{d} g¹_{k,j}(Y_{i-1}) ΔW_{i-1,j} \\[-1.5ex]
  + \smashoperator{∑_{j₁,j₂=1}^d h_{k,j₁,j₂}}(Y_{i-1})(ΔW_{i-1,j₁}ΔW_{i-1,j₂}-\Omega_{j₁,j₂}Δ- A_{i-1,j,k}) \tag{Milstein}
\end{multline*}

\begin{align*}
& & Y_{i,k} & = \begin{cases}
    Y_{i,k}^- & \mbox{if } t_{i} ∉ \mathcal{I}^k_\mathrm{arrival} \\
    Y_{i,k}^- + Y_{i,k}^- ΔJ_{i,k} & \mbox{if } t_{i} ∈ \mathcal{I}^k_\mathrm{arrival}
  \end{cases} & & \rlap{(Jump)}
\end{align*}

\end{document} 

enter image description here

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.