3

I am trying to put the equation number for the below expression. how to do it?

\documentclass[12pt,a4paper]{article}
\usepackage{amssymb}
\usepackage{amsmath}
\usepackage{mathtools}

\begin{document}

\[  \Phi_{1}= \left\{
\begin{array}{ll}
      a(x) & x\leq \frac{1}{3} \\ 
      b(x) & x> \frac{1}{3} \\
\end{array} 
\right. \] 

\end{document}
  • Welcome! You can use empheq. See e.g. https://tex.stackexchange.com/a/258879. –  Apr 05 '20 at 06:19
  • 1
    Use \begin{equation}...\end{equation} instead of \[...\]. – Henri Menke Apr 05 '20 at 06:20
  • The question is a bit ambiguous. Are you looking for `\documentclass[a4paper,10pt]{article}

    \usepackage{amsmath} \usepackage{empheq}

    \begin{document} \begin{empheq}[left={\Phi_{1}=\empheqlbrace,}]{align} a(x);, &\quad\text{if}~ x\leq \frac{1}{3};, \notag\ b(x);, &\quad\text{if}~x> \frac{1}{3} ;. \end{empheq} \end{document}`?

    –  Apr 05 '20 at 06:26
  • Remember that amsmath <= mathtools. – Sebastiano Apr 05 '20 at 10:47

1 Answers1

6

Like this:

enter image description here

For such equations is in amsmath defined environment cases. For its numbering you should insert in equation environment as stated @Henri Menke in his comment:

\documentclass[12pt,a4paper]{article}
\usepackage{amssymb}
\usepackage{amsmath}
\usepackage{xcolor}  % <---


\begin{document}

\begin{equation}\color{blue!70!black} <---  
\Phi_{1} =  
\begin{cases}
      a(x) & x\leq \frac{1}{3} \\
      b(x) & x> \frac{1}{3} \\
\end{cases}
\end{equation}

\end{document}

Edit (1): If you like to have only this equation in blue color, than after \begin{equation} add for example \color{blue!70!black}, as is added now in above MWE.

Edit (2): However, if you like to have all math expressions colored, than two solutions are provided in answer of Stefan Kottwitz and in answer of David Carlisle. Considering them in above MWE, you will get:

enter image description here

and

enter image description here

respectively. Difference between them is color of equation numbers.

Zarko
  • 296,517