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}
4
  • Welcome! You can use empheq. See e.g. tex.stackexchange.com/a/258879.
    – user194703
    Apr 5, 2020 at 6:19
  • 1
    Use \begin{equation}...\end{equation} instead of \[...\]. Apr 5, 2020 at 6: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}?
    – user194703
    Apr 5, 2020 at 6:26
  • Remember that amsmath <= mathtools.
    – Sebastiano
    Apr 5, 2020 at 10:47

1 Answer 1

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.

2
  • How to change the color of the equation to blue Apr 5, 2020 at 7:24
  • 3
    Load the (x)color package and add \color{blue} just after \begin{equation}.
    – Bernard
    Apr 5, 2020 at 8:50

You must log in to answer this question.

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