给括号对着色的实用方法

给括号对着色的实用方法

我想找到一个选项来自动为括号对着色,因为我开始有一个非常长的等式(分成两行),我想知道是否有可能区分括号对\Biggl\Biggr

我知道有一些替代方案,例如:

$\textcolor{red}{\big(} a\big)$

但正如我所说的:它只会使我的编码越来越复杂,所以我正在寻找一种更简单的方法来做到这一点。

\documentclass{article}

%%%%%%%%MATHS%%%%%%%%%%%%%
\usepackage{amsmath}
\usepackage{breqn}
\usepackage{amsfonts}

\begin{document}

\begin{align*}
h_{i}^{n+1} &= h_{i}^{n} + \frac{4 \Delta t}{\Delta R} \Biggl[ \Biggl(\frac{h_{i+1}^n + h_{i}^n}{2} \Biggr)^3  \Biggl(R_{i+1/2} \Biggl(\frac{h_{i+1}^{n+1} - h_{i}^{n+1}}{\Delta R} \Biggr)  + 8B\sqrt{R_{i+1/2}} \Biggl[4 R_{i+1/2} \Biggl (\frac{-h_{i-1}^{n+1} + 3h_{i}^{n+1} - 3h_{i+1}^{n+1} + h_{i+2}^{n+1} }{(\Delta R)^3} \Biggr)
\\
&\mathrel{\phantom{=}}
+\Biggl(\frac{h_{i-1}^{n+1} - h_{i}^{n+1} - h_{i+1}^{n+1}+h_{i+2}^{n+1} }{(\Delta R)^2}\Biggr)\Biggr) + (R_{i+1/2})^2 \Biggl(  \frac{h_{i-2}^{n+1} - 3h_{i-1}^{n+1} + 2h_{i}^{n+1} + 2h_{i+1}^{n+1}-3h_{i+2}^{n+1} + h_{i+3}^{n+1}}{2(\Delta R)^4} \Biggr) \Biggr]\Biggr]
\end{align*}

\end{document}

在此处输入图片描述

非常感谢您的帮助,

答案1

这是一个丑陋的方法,但它会起作用:

\documentclass{article}

%%%%%%%%MATHS%%%%%%%%%%%%%
\usepackage{amsmath}
\usepackage{breqn}
\usepackage{amsfonts}
\usepackage{xcolor}

\begin{document}

\newcommand\splBiggl[1]{\color{blue}\Bigg#1\color{black}}%
\newcommand\splBiggr[1]{\color{blue}\Bigg#1\color{black}}%



\begin{align*}
h_{i}^{n+1} &= h_{i}^{n} + \frac{4 \Delta t}{\Delta R} \splBiggl[
\splBiggl(\frac{h_{i+1}^n + h_{i}^n}{2} \splBiggr)^3
\splBiggl(R_{i+1/2} \splBiggl(\frac{h_{i+1}^{n+1} -
h_{i}^{n+1}}{\Delta R} \splBiggr)  + 8B\sqrt{R_{i+1/2}} \splBiggl[4
R_{i+1/2} \splBiggl (\frac{-h_{i-1}^{n+1} + 3h_{i}^{n+1} -
3h_{i+1}^{n+1} + h_{i+2}^{n+1} }{(\Delta R)^3} \splBiggr)
\\
&\mathrel{\phantom{=}}
+\splBiggl(\frac{h_{i-1}^{n+1} - h_{i}^{n+1} -
h_{i+1}^{n+1}+h_{i+2}^{n+1} }{(\Delta R)^2}\splBiggr)\splBiggr) +
(R_{i+1/2})^2 \splBiggl(  \frac{h_{i-2}^{n+1} - 3h_{i-1}^{n+1} +
2h_{i}^{n+1} + 2h_{i+1}^{n+1}-3h_{i+2}^{n+1} +
h_{i+3}^{n+1}}{2(\Delta R)^4} \splBiggr) \splBiggr]\splBiggr]
\end{align*}

\end{document}

相关内容