2

So I have got a pretty complex equation (with different types of brackets) and it's too long, so I want to break the equation up to start a new line. The equation is:

\begin{document}
$$
Cl_f(\vec x):=\min\left\lbrace a\in\{1,\cdots,m\} : p_a Tr(F^{(n)}_a\rho^{(n)}_{\vec{x}})=\max_j\left\lbrace p_j Tr ( F^{(n)}_j\rho^{(n)}_{\vec{x}}), 1\le j\le m \right\rbrace\right\rbrace. \notag
$$
\end{document}

How do I start a new line in the equation when using $$? Say for eg., I want to break the equation up to start a new line after the colon sign (:), just before p_a. I would like the output to look something like:

Cl_f(\vec x):=\min\left\lbrace a\in\{1,\cdots,m\} :
              p_a Tr(F^{(n)}_a\rho^{(n)}_{\vec{x}})=\max_j\left\lbrace p_j Tr ( F^{(n)}_j\rho^{(n)}_{\vec{x}}), 1\le j\le m \right\rbrace\right\rbrace. \notag

I have tried using \begin{align*} but it's giving me funny error messages in the log (which I think it's to do with the bracket calls). I am good to use $$, \begin{align*} or any other method as long as I can get the output that I am after, with minimal packages that I need to load if possible.

2 Answers 2

6
  • $$ syntax for math environment is used in plain TeX, not in LaTeX, where is used \[ and \] instead.
  • For multiline math expression you need to use some of the amsmath packages environments: align, gather, etc.
  • Your equations contain errors (unpaired braces)

An working example with your equations can be:

\documentclass{article}
\usepackage{amsmath}

\begin{document}
    \begin{align*}
Cl_f(\vec x)
    & := \min\Bigl(a\in\{1,\cdots,m\} : p_a Tr\Bigl(F^{(n)}_a\rho^{(n)}_{\vec{x}}\Bigr) \Bigr)  \\
    &  = \max_j\Bigl(p_j Tr \Bigl( F^{(n)}_j\rho^{(n)}_{\vec{x}}\Bigr)\Bigr),
        \quad 1\le j\le m.
    \end{align*}
\end{document}

which gives:

enter image description here

Addendum: According to your comments below, I guess that you looking for the following:

\documentclass{article}
\usepackage{amsmath}

\begin{document}
    \begin{align*}
Cl_f(\vec x) := {}
    & \min\Bigl(a\in\{1,\cdots,m\} : \\
    & \,p_a Tr\Bigl(F^{(n)}_a\rho^{(n)}_{\vec{x}}\Bigr) \Bigr) 
      = \max_j\Bigl(p_j Tr \Bigl( F^{(n)}_j\rho^{(n)}_{\vec{x}}\Bigr)\Bigr),
        \quad 1\le j\le m.
    \end{align*}
\end{document}

enter image description here

7
  • Hi @Zarko, thanks! How do I start a new line after the colon sign (:), just before p_a?
    – Leockl
    Mar 29, 2021 at 7:41
  • 1
    @Leockl, on the same way as is started the second equation line. See addendum to answer (will appear ASAP).
    – Zarko
    Mar 29, 2021 at 7:43
  • Thanks @Zarko for the updated addendum, but in doing so you have added an extra = sign right after the colon sign. I would really like to make the equation look like in the 2nd grayed out box in my original post/question above (ie. on 2 lines only). Really appreciate your help.
    – Leockl
    Mar 29, 2021 at 8:00
  • 1
    @Leockl, your comment wasn't so clear ... hopefully now you have what you after.
    – Zarko
    Mar 29, 2021 at 9:04
  • 1
    @Leockl, as you can see from equation code, in it instead \left\lbrace and \right\rbrace are used Bigl( and \Bigr). However, you can use \left( and \right) if the both are on the same side of equations (between them had not to be ampersand).
    – Zarko
    Mar 29, 2021 at 10:22
3

You could use the multline* environment, as in:

\begin{document}
\begin{multline*}
Cl_f(\vec x):=\min\left\lbrace a\in\{1,\cdots,m\} : p_a Tr(F^{(n)}_a\rho^{(n)}_{\vec{x}})=\\=\max_j\left\lbrace p_j Tr ( F^{(n)}_j\rho^{(n)}_{\vec{x}}), 1\le j\le m \right\rbrace\right\rbrace. \notag
\end{multline*}
\end{document}
7
  • 2
    your first sentence seems to imply that you can use \\ in $$, which is not the case. Mar 29, 2021 at 7:31
  • Hi @José Carlos Santos, do you mean if I use multline*, then I would be able to use `\` to start a new line?
    – Leockl
    Mar 29, 2021 at 7:44
  • 1
    Yes, that is what I meant. Mar 29, 2021 at 7:53
  • 2
    \\ doesn't work in $$ or \[ Mar 29, 2021 at 9:40
  • 1
    @DavidCarlisle Thank you. I've edited my answer. Mar 29, 2021 at 9:44

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.