0

I´m struggling with the following problem: I have an align-environment with 5 rows and I´d like to have a line break in one of the rows, because of the length of the line. The problem is that I have a self-defined function \E with a \left[ and \right] statement around the whole argument, which prevents the line break in between.

My minimal example:

\documentclass[12pt,twoside]{report}

\usepackage{amsmath, amssymb, amsthm, mathtools}

\DeclarePairedDelimiter\var{Var(}{)} 
\newcommand{\E}[1]{\mathbb{E}\left[{#1}\right]} %expectation
\newcommand{\bet}[3]{\beta^{{#1}}_{{#2}}({#3})}

\begin{document}

    \begin{align*}
        %Line 1
        \var{\bet{}{k}{\mathcal{C}(\mathcal{X}_n,r_n)}}& \leq \frac{1}{2} \sum_{i=1}^n \E{[\bet{}{k} 
        {\mathcal{X}_n,r_n} - \bet{}{k}{\mathcal{X}_{n+1} \setminus \{X_i\},r_n}]^2}\\
        %Line 2
        & = \frac{1}{2} \sum_{i=1}^n \E{[\bet{}{k}{\mathcal{X}_n,r_n}-\bet{}{k}{\mathcal{X}_n 
        \setminus \{X_i\},r_n}  \\ 
        %Line 3
        & \phantom{{}=} + \bet{}{k}{\mathcal{X}_n \setminus \{X_i\},r_n} - \bet{}{k} 
        {\mathcal{X}_{n+1}\setminus \{X_i\},r_n}^2]} \\
        %Line 4
        & \leq \frac{1}{2} \sum_{i=1}^{n} 4 \sqrt{\Delta_k} \\
        %Line 5
        & = 2n \sqrt{\Delta_k}.
    \end{align*}

\end{document}

It isn´t working, because my function \E goes from line 2 to line 3. How do i make it work? Thanks in advance!

PS: I also don´t think the \phantom{{}=} is an elegant solution to reach correct intendation. Is there a correct way to do it?

7
  • 1
    You cannot break a \left....\right construction across lines, why do you think I told you using \left....\right by default was a bad idea?
    – daleif
    Commented Mar 18, 2020 at 21:20
  • 1
    For your PS, align in the right on the ='s but use = {} & not just =& (else wrong spacing), then no need for a phantom
    – daleif
    Commented Mar 18, 2020 at 21:21
  • 1
    Also please complete your MWE: where is the definition of \var?
    – daleif
    Commented Mar 18, 2020 at 21:22
  • 2
    This is just one of those instances where you cannot use a macro for the entire expactation macro.
    – daleif
    Commented Mar 18, 2020 at 21:25
  • 1
    In this case typeset it by hand. BTW your \var is not good var will not be upright. And {var(} is not a delimiter so \var* will not work. Look up \DeclarePairedDelimiterXPP in the mathtools manual, for the prefix you can use \operatorname{var}
    – daleif
    Commented Mar 18, 2020 at 21:51

1 Answer 1

2

Here is how I'd adjust it

\documentclass[12pt,twoside]{report}

\usepackage{amsmath, amssymb, amsthm, mathtools}


\DeclareMathOperator\var{var}
\DeclarePairedDelimiterXPP\Var[1]{\var}{(}{)}{}{#1} 

\newcommand\ExpecSymbol{\mathbb{E}}
\DeclarePairedDelimiterXPP\E[1]{\ExpecSymbol}{[}{]}{}{#1}

\newcommand{\bet}[3]{\beta^{{#1}}_{{#2}}({#3})}

\begin{document}

\begin{align*}
  % Line 1
  \Var[\big]{\bet{}{k}{\mathcal{C}(\mathcal{X}_n,r_n)}} \leq{}& \frac{1}{2}
  \sum_{i=1}^n \E[\big]{[\bet{}{k} {\mathcal{X}_n,r_n} -
    \bet{}{k}{\mathcal{X}_{n+1} \setminus \{X_i\},r_n}]^2}
  \\
  % Line 2
  = {} & \frac{1}{2} \sum_{i=1}^n
  \ExpecSymbol\Bigl[\bet{}{k}{\mathcal{X}_n,r_n}-\bet{}{k}{\mathcal{X}_n
    \setminus \{X_i\},r_n}
  \\
  % Line 3
  &  + \bet{}{k}{\mathcal{X}_n \setminus \{X_i\},r_n} -
  \bet{}{k} {\mathcal{X}_{n+1}\setminus \{X_i\},r_n}^2\Bigr]
  \\
  % Line 4
  \leq {} & \frac{1}{2} \sum_{i=1}^{n} 4 \sqrt{\Delta_k}
  \\
  % Line 5
  = {} & 2n \sqrt{\Delta_k}.
\end{align*}

\end{document}
1
  • Thats perfect! Thank you again.
    – nomeal
    Commented Mar 19, 2020 at 17:36

You must log in to answer this question.

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