# Change the colour in elements of the list and divide

I have the next code:

u = {{{1, 2}, {3, 4}, {5, 6}}, {{7, 8}, {9, 10}, {11,12}}}
u = MapAt[Style[#, Blue] &, u, {{1, 2, 1}, {1, 2, 2}}]
u[[1, 1, 2]]/u[[1, 2, 2]]

I want to do operation with elements of differents colours. When I change the colour to one element of the list and after I divide by other element which I have not change the colour, Mathematica not calculate. I donĀ“t know why happens it.

• How can mathematica know how to divide elements in Style[***] form? You'll have to write your own rules to process these operations. Also, what you want the result to be? a 1/2 styled blue or with no style? – Wjx Sep 3 '16 at 9:26
• I want that the result be with styled. In my example, u have possition [[1,2,1]] and [[1,2,2]] blue. I want only change the colour and after I can manipulated list (divide, etc...). – Manu Sep 3 '16 at 16:44
• will my solution solve your problem? – Wjx Sep 3 '16 at 23:37
• @Wjx, your solution work very well, thank so much, but there are some cases that not work and I don´t why. When I have these list, your solution not work: a={1014.24, 4807.98} and b={\!(* StyleBox["947.290786227471", StripOnInput->False, LineColor->RGBColor[0, 0, 1], FrontFaceColor->RGBColor[0, 0, 1], GraphicsColor->RGBColor[0, 0, 1], FontColor->RGBColor[0, 0, 1], \$CellContextBackFaceColor -> RGBColor[0, 0, 1]]), 4385.53}. Thanks for your help. – Manu Sep 5 '16 at 13:18
• thumbs.subefotos.com/aeda92dc7e423820166a6d785e5f101fo.jpg – Manu Sep 5 '16 at 13:38

Check this:

myOperation[func_][a_, b_] :=
If[Length@a == Length@b != 0 && Head[a] =!= Style,