2

I am trying to align my cases with other lines in my align environment but have had no luck thus far. Can you tell me how to align all these lines:

enter image description here

Here is my code:

\documentclass[11pt]{article}


\usepackage[framemethod=default]{mdframed}
\usepackage{mathtools}
\usepackage[most]{tcolorbox}
\tcbset{myformula/.style={
  arc=0pt,
  outer arc=0pt,
  colback=blue!10,
  colframe=green,
  boxrule=0.8pt,
  left=2pt,
  right=2pt,
  highlight math style={
    arc=0pt,
    outer arc=0pt,
    colback=green,
    colframe=red.
    }
  }
}



\begin{document}

\begin{tcolorbox}[ams align, myformula]
Q(z) & =  a_{n}z^{n} + a_{n-1}z^{n-1} + \dots + a_{2}z^{2} + a_{1}z^{1} + a_{0} = 0
\intertext{The conditions for stability are}\\
Q(1) & >  0
\intertext{and:}
\begin{dcases}
Q(-1) & >  0 \quad \text{if $n$ is even}\\
Q(-1) & <  0\quad \text{if $n$ is odd}
\end{dcases}
\end{tcolorbox}

\end{document}
2
  • The & in dcases separates the formula from its description, so it should be Q(-1)>0 & \text{if $n$ is even}. Aside from this, are you sure you want to align those three formulas? I have no doubt I wouldn't.
    – egreg
    Jun 1, 2017 at 6:13
  • Why did you add a double backslash after the first \intertext?
    – Bernard
    Jun 1, 2017 at 7:29

2 Answers 2

6
\begin{tcolorbox}[ams align, myformula]
    & Q(z) =  a_{n}z^{n} + a_{n-1}z^{n-1} + \dots + a_{2}z^{2} + a_{1}z^{1} + a_{0} = 
    0
    \intertext{The conditions for stability are}
    & Q(1) >  0
    \intertext{and:}
    & \begin{dcases}
        Q(-1) & >  0 \quad \text{if $n$ is even}\\
        Q(-1) & <  0\quad \text{if $n$ is odd}
    \end{dcases}
\end{tcolorbox}

enter image description here

3

A… well, not-so-slight (:-) improvement on Herbert’s answer:

\documentclass[11pt]{article}


\usepackage[framemethod=default]{mdframed}
\usepackage{mathtools}
\usepackage[most]{tcolorbox}
\tcbset{myformula/.style={
  arc=0pt,
  outer arc=0pt,
  colback=blue!10,
  colframe=green,
  boxrule=0.8pt,
  left=2pt,
  right=2pt,
  highlight math style={
    arc=0pt,
    outer arc=0pt,
    colback=green,
    colframe=red.
    }
  }
}



\begin{document}

\begin{tcolorbox}[ams align, myformula]
    & Q(z) = a_{n}z^{n} + a_{n-1}z^{n-1} + \dots + a_{2}z^{2} + a_{1}z^{1} + a_{0} 
        = 0
    \intertext{The conditions for stability are}
    & Q(1) >  0
    \intertext{and:}
    & \begin{dcases*}
        Q(-1) > 0, & if $n$ is even;\\
        Q(-1) < 0, & if $n$ is odd.
    \end{dcases*}
\end{tcolorbox}
\end{document}

The output is:

Output of the code

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.