LaTex排版技巧:[30]如何输入带颜色的公式

2026-02-28 10:10:29

1、大家是否对有输入下述图形中公式的需求呢?如果有的话,请继续往下看,^_^

LaTex排版技巧:[30]如何输入带颜色的公式

2、这里提供第一个公式的输入代码

\usepackage{amsmath}

\usepackage{empheq}

\usepackage{xcolor}

\usepackage{graphicx}

\definecolor{hellmagenta}{rgb}{1,0.75,0.9}

\definecolor{hellcyan}{rgb}{0.75,1,0.9}

\definecolor{hellgelb}{rgb}{1,1,0.8}

\definecolor{colKeys}{rgb}{0,0,1}

\definecolor{colIdentifier}{rgb}{0,0,0}

\definecolor{colComments}{rgb}{1,0,0}

\definecolor{colString}{rgb}{0,0.5,0}

\definecolor{darkyellow}{rgb}{1,0.9,0}

\def\xstrut{\vphantom{\dfrac{(A)^1}{(B)^1}}}

\begin{equation}\label{eq:6}

E = %

\colorbox{darkyellow}{$\xstrut a_vA$} -

\colorbox{hellmagenta}{$\xstrut a_fA^{2/3}$} -

\colorbox{green}{$\xstrut a_c\dfrac{Z(Z-1)}{A^{1/3}}$} -

\colorbox{cyan}{$\xstrut a_s\dfrac{(A-2Z)^2}{A}$} +

\colorbox{yellow}{$\xstrut E_p$}

\end{equation}

声明:本网站引用、摘录或转载内容仅供网站访问者交流或参考,不代表本站立场,如存在版权或非法内容,请联系站长删除,联系邮箱:site.kefu@qq.com。
猜你喜欢