mathlatex

How to colour each number differently in latex subscript


I have the following latex I am using in Lucidchart application:

\omega_{11}^{\ell}

I want the first 1 to be a red colour and the second 1 to be a green colour. How do I achieve that?

I have tried the following:

\omega_{1{red}1{green}}^{\ell}

but it doesn't lead to the right result.


Solution

  • \documentclass{article}
    
    \usepackage{xcolor}
    
    \begin{document}
    \[
    \omega_{\mathcolor{red}{1}\mathcolor{green}{1}}^{\ell}
    \]
    \end{document}
    

    enter image description here