jqMath: how to change the color of an expression?

319 Views Asked by At

I have this DOM class which I add to a jqMath expression to change the color of part of an equation which I've written using jqmath and the corresponding CSS:

.myclass {
  color: blue;
}

The thing is the color usually changes as expected but this is not the case if I have for example a division in the equation like this: $d/\dx[x^2]$. In this case the color isn't applied to the division (neither to numerator nor to denominator). As far as I know to add a class in jqmath I have to use this \cl "myclass" command.

Edit: This is my css:

#myid {
  align-text: left;
}
.myclass {
  color: blue;
}
.myclass:active {
  font-weight: bold;
}

and html:

<body>
  <div>
    <p id='myid' >$\cl 'myclass' {d/\dx[x]}$</p>
    <br>
  </div>
</body>
2

There are 2 best solutions below

1
has19 On BEST ANSWER

just in case anybody have the same problem i solved it by adding a * next to the class in css

.myclass *{
color:blue ;
}
3
Dave Barton On

Use $\cl"myclass" {d/\dx [x^2]}$, i.e. put {} around the expression to group it into a single item.

You might like $\cl"myclass" {d/{\it \dx} [x^2]}$ even better (I think it looks more standard).