我希望数学的互文性即使在内部也能被赋予色彩\shortintertext
。\intertext
使用
\newcommand{\colorInlinedMath}{\everymath{\color{SpringGreen3}}\sisetup{color=SpringGreen3}}
我换了颜色,但我必须每次都使用它\shortintertext
,\intertext
如何获得第三个条目的结果而不必为每个\shortintertext
and手动更改颜色\intertext
?
\documentclass[aspectratio=169, xcolor={x11names}, t, handout]{beamer}
\usetheme{Dresden}
\usepackage{mathtools}
\usepackage{siunitx}
\usefonttheme{professionalfonts}
\usepackage[defaultmathsizes, subdued, italic, LGRgreek, symbolre]{mathastext}
\setbeamercolor{math text inlined}{fg=SpringGreen3}
\newcommand{\colorInlinedMath}{\everymath{\color{SpringGreen3}}\sisetup{color=SpringGreen3}}
\begin{document}
\begin{frame}
\begin{itemize}
\item $I_{f} = i_{L}(\infty) = \SI{0}{\ampere}$ (\alert{why?}). $\omega_{d}$ is given by
\begin{alignat*}{2}
\shortintertext{$I_{f} = i_{L}(\infty) = \SI{0}{\ampere}$ (\alert{why?}). $\omega_{d}$ is given by}
\omega_{d} &= \sqrt{\omega_{0}^{2} - \alpha^{2}}
\\
\shortintertext{\colorInlinedMath $I_{f} = i_{L}(\infty) = \SI{0}{\ampere}$ (\alert{why?}). $\omega_{d}$ is given by}
\omega_{d} &= \sqrt{\omega_{0}^{2} - \alpha^{2}}
\end{alignat*}
\end{itemize}
\end{frame}
\end{document}
答案1
\pretocmd
使用以下命令解决etoolbox
:
\documentclass[aspectratio=169, xcolor={x11names}, t, handout]{beamer}
\usetheme{Dresden}
\usepackage{mathtools}
\usepackage{siunitx}
\usefonttheme{professionalfonts}
\usepackage[defaultmathsizes, subdued, italic, LGRgreek, symbolre]{mathastext}
\setbeamercolor{math text inlined}{fg=SpringGreen3}
\newcommand{\colorInlinedMath}{\everymath{\color{SpringGreen3}}\sisetup{color=SpringGreen3}}
\usepackage{etoolbox}
\makeatletter
\pretocmd{\intertext@}{\colorInlinedMath}{}{}
\makeatother
\begin{document}
\begin{frame}
\begin{itemize}
\item $I_{f} = i_{L}(\infty) = \SI{0}{\ampere}$ (\alert{why?}). $\omega_{d}$ is given by
\begin{alignat*}{2}
\shortintertext{$I_{f} = i_{L}(\infty) = \SI{0}{\ampere}$ (\alert{why?}). $\omega_{d}$ is given by}
\omega_{d} &= \sqrt{\omega_{0}^{2} - \alpha^{2}}
\\
\shortintertext{\colorInlinedMath $I_{f} = i_{L}(\infty) = \SI{0}{\ampere}$ (\alert{why?}). $\omega_{d}$ is given by}
\omega_{d} &= \sqrt{\omega_{0}^{2} - \alpha^{2}}
\end{alignat*}
\end{itemize}
\end{frame}
\end{document}