Làm thế nào tôi có thể đặt tất cả các biểu thức trong một cặp ký hiệu đô la thành một màu mong muốn? [bản sao]

Aug 17 2020

Trong tài liệu Tex của mình, tôi muốn tô màu tất cả các biểu thức trong hai ký hiệu đô la (chẳng hạn như $e^{i\pi}$, $\log x$v.v.), trong một cặp ký hiệu đô la (chẳng hạn như $$e^{i\pi}+1=0$$), trong \begin{eqnarray}...\end{eqnarray}một màu mong muốn (giả sử, màu vàng) mà không cần thực hiện mỗi lần . Có lệnh nào để đạt được điều này không?

Trả lời

2 Bernard Aug 16 2020 at 23:54

Dễ dàng với. Lưu \everymathý không thay đổi màu số phương trình, có thể dễ dàng thay đổi nó bằng \newtagformlệnh from 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

chế độ toán học tô màu

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

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

biên tập

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