Markdown modifies the color of latex mathematical formulas

need

When using markdown to type a formula on csdn, sometimes I want to mark the formula partly, which is more eye-catching, as shown below:

P ( x l ∣ y l ) = P ( x l , y l ) P ( y l ) = P ( y l ∣ x l ) P ( x l ) P ( y l ) P\left(x_{l} \mid y_{l}\right) = \frac{P(x_l,y_l)}{P(y_l)}=\frac{\textcolor{#FF0000}{P(y_l\mid x_l)}P(x_l)}{P(y_l)} P(xlyl)=P ( andl)P(xl,yl)=P ( andl)P ( andlxl)P(xl)


method

The code marked in red is

\textcolor{#FF0000}{}

#FF0000 in the first {} is the RGB value of red, and the second {} encloses the part that needs to be marked red with brackets.

Or, some commonly used colors can directly type its color English, such as

\textcolor{red}{}

Common colors:

  • red: red
  • green: green
  • blue: blue
  • yellow: yellow

example

original formula

Effect:

P ( x l ∣ y l ) = P ( x l , y l ) P ( y l ) = P ( y l ∣ x l ) P ( x l ) P ( y l ) P\left(x_{l} \mid y_{l}\right) = \frac{P(x_l,y_l)}{P(y_l)}=\frac{P(y_l\mid x_l)P(x_l)}{P(y_l)} P(xlyl)=P ( andl)P(xl,yl)=P ( andl)P ( andlxl)P(xl)

code:

$$P\left(x_{l} \mid y_{l}\right) = \frac{P(x_l,y_l)}{P(y_l)}=\frac{P(y_l\mid x_l)P(x_l)}{P(y_l)}$$

Modified formula

Effect:

P ( x l ∣ y l ) = P ( x l , y l ) P ( y l ) = P ( y l ∣ x l ) P ( x l ) P ( y l ) P\left(x_{l} \mid y_{l}\right) = \frac{P(x_l,y_l)}{P(y_l)}=\frac{\textcolor{#FF0000}{P(y_l\mid x_l)}P(x_l)}{P(y_l)}P(xlyl)=P ( andl)P(xl,yl)=P ( andl)P ( andlxl)P(xl)

code:

$$P\left(x_{l} \mid y_{l}\right) = \frac{P(x_l,y_l)}{P(y_l)}=\frac{\textcolor{#FF0000}{P(y_l\mid x_l)}P(x_l)}{P(y_l)}$$

or

$$P\left(x_{l} \mid y_{l}\right) = \frac{P(x_l,y_l)}{P(y_l)}=\frac{\textcolor{red}{P(y_l\mid x_l)}P(x_l)}{P(y_l)}$$

Of course, this method can also modify the color of the entire formula as a whole, just put the entire formula in the second bracket, that is:

Effect:

P ( x l ∣ y l ) = P ( x l , y l ) P ( y l ) = P ( y l ∣ x l ) P ( x l ) P ( y l ) \textcolor{#FF0000}{P\left(x_{l} \mid y_{l}\right) = \frac{P(x_l,y_l)}{P(y_l)}=\frac{P(y_l\mid x_l)P(x_l)}{P(y_l)}} P(xlyl)=P ( andl)P(xl,yl)=P ( andl)P ( andlxl)P(xl)

code:

$$\textcolor{#FF0000}{P\left(x_{l} \mid y_{l}\right) = \frac{P(x_l,y_l)}{P(y_l)}=\frac{P(y_l\mid x_l)P(x_l)}{P(y_l)}}$$

Guess you like

Origin blog.csdn.net/iteapoy/article/details/112846367