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. tex.stackexchange.com/a/258879. – Schrödinger's cat Apr 5 at 6:19
  • 1
    Use \begin{equation}...\end{equation} instead of \[...\]. – Henri Menke Apr 5 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}? – Schrödinger's cat Apr 5 at 6:26
  • Remember that amsmath <= mathtools. – Sebastiano Apr 5 at 10:47
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.

| improve this answer | |
  • How to change the color of the equation to blue – Vijay Kumar S Apr 5 at 7:24
  • 3
    Load the (x)color package and add \color{blue} just after \begin{equation}. – Bernard Apr 5 at 8:50

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.