ドル記号のペア内のすべての式を目的の色にするにはどうすればよいですか?[複製]

Aug 17 2020

私テックスの文書では、私が(のような2ドル記号内のすべての式を色付けしたい$e^{i\pi}$$\log x$など)、ドル記号のペア内(のような$$e^{i\pi}+1=0$$内、)\begin{eqnarray}...\end{eqnarray}所望の色(例えば、黄色)で、それを毎回行わず。これを達成するためのコマンドはありますか?

回答

2 Bernard Aug 16 2020 at 23:54

簡単にできます\everymath。方程式番号の色は変更されないことに注意\newtagformしてくださいmathtools。からのコマンドで簡単に変更できます。

\documentclass[12pt]{article}
\usepackage{amsmath, bm}
\usepackage[svgnames]{xcolor}
\colorlet{mathcolour}{red}
\everymath{\color{mathcolour}}

\begin{document}

Some text. Some more text. $T_i$ \quad $\mathbf e^{i\pi}$

\colorlet{mathcolour}{DeepSkyBlue}
\begin{align} a & = \bm{b} \\ c & = \bm{d} \end{align}

\end{document} 

jsbibra Aug 16 2020 at 23:23

数学モードの着色

\documentclass{article}
\usepackage{xcolor}
\begin{document}
$T_i$

${\color{red}T_{\color{black}i}}$
${\color{blue}e^{i\pi}}$
\end{document}

編集

\documentclass{article}
\usepackage{xcolor}
\everymath{\color{red}}
\begin{document}
    $T_i$
    
    ${T_{i}}$
    ${\color{blue}e^{i\pi}}$
\end{document}