Skip to main content
deleted 1 character in body
Source Link
Mr.Wizard
  • 273.1k
  • 34
  • 595
  • 1.4k

Without greater context I recommend a simple ReplaceAll operation, to work on all appearances of Style at any level.

{1, Style[2, Red], 3, Style[4, Red]} /. Style[x_, ___] :> x
{1, 2, 3, 4}

If you want to strip Style from only numbers then you could use something like:

/. Style[x_?NumericQNumberQ, ___] :> x

Without greater context I recommend a simple ReplaceAll operation, to work on all appearances of Style at any level.

{1, Style[2, Red], 3, Style[4, Red]} /. Style[x_, ___] :> x
{1, 2, 3, 4}

If you want to strip Style from only numbers then you could use something like:

/. Style[x_?NumericQ, ___] :> x

Without greater context I recommend a simple ReplaceAll operation, to work on all appearances of Style at any level.

{1, Style[2, Red], 3, Style[4, Red]} /. Style[x_, ___] :> x
{1, 2, 3, 4}

If you want to strip Style from only numbers then you could use something like:

/. Style[x_?NumberQ, ___] :> x
Source Link
Mr.Wizard
  • 273.1k
  • 34
  • 595
  • 1.4k

Without greater context I recommend a simple ReplaceAll operation, to work on all appearances of Style at any level.

{1, Style[2, Red], 3, Style[4, Red]} /. Style[x_, ___] :> x
{1, 2, 3, 4}

If you want to strip Style from only numbers then you could use something like:

/. Style[x_?NumericQ, ___] :> x