如何使用过度支撑和颜色框来拆分长方程式?

如何使用过度支撑和颜色框来拆分长方程式?

我有一个带有过度支撑和颜色框的长方程式。怎样才能像图片那样拆分方程式或者采用更好的方法?在此处输入图片描述

\documentclass{article}
\usepackage{amsmath}
\usepackage{mathtools}
‎\usepackage{tikz}‎
\begin{document}

\begin{equation}
‎\begin{split} ‎‎
&‎\sum_{p=1}^{n} \overbrace{\tikz[baseline]{‎
            ‎\node[fill=blue!30,anchor=base] (t1)‎
            ‎{$ \left[ \frac{\left(EI ‎‎\right)‎_i‎}{EI_0}‎‎\bar{D}‎‎_{ip}‎ +\frac{\left(EI ‎‎\right)‎_i‎}{EI_0}‎‎\bar{D}‎‎_{ip}+‎ \frac{\left(EI ‎‎\right)‎_i‎}{EI_0}‎‎\bar{D}‎‎_{ip}‎ ‎\frac{2}{EI_0}\left( \frac{dEI}{d \xi }‎‎\right)‎_i‎\bar{C}‎‎_{ip}
‎\left.‎ +\frac{1}{EI_0}\left(\frac{d^2EI}{d \xi ^2} ‎‎\right)‎_i‎ B_{ip} ‎+‎\frac{P_0L^2}{EI_0}B_{ip}‎  +‎\frac{k_wL^4}{EI_0} \delta _{ip} \right]$};‎
        }                  ‎\rule[-12pt]{0pt}{5pt}}^{\mbox{$A$}}‎ 
‎\bar{w}_p \\‎
&+\overbrace{\tikz[baseline]{‎
            ‎\node[fill=green!30,anchor=base] (t1)‎
            ‎{$[0]$};‎
        }                  ‎\rule[-12pt]{0pt}{5pt}}^{\mbox{$B$}} ‎‎\kappa‎ _{\bar{i}}=\overbrace{\tikz[baseline]{‎
            ‎\node[fill=yellow!50,anchor=base] (t1)‎
            ‎{${\frac{w_0}{L}}$};‎
        }                  ‎\rule[-12pt]{0pt}{5pt}}^{\mbox{$C$}} ‎                   
‎\end{split}‎                     
‎\end{equation}‎‎‎‎‎‎‏‎‏‎‎

How I can break large equation

\end{document}

答案1

您可以将长表达式放在aligned

示例输出

\documentclass{article}

\usepackage{mathtools}
\usepackage{tikz}

\begin{document}

\begin{equation}
  \begin{split}
    &\sum_{p=1}^{n}
      \overbrace{\tikz[baseline]{
      \node[fill=blue!30,anchor=base] (t1)
      {$\displaystyle
      \left[
          \begin{aligned}
            &\frac{(EI)_i}{EI_0}\bar{D}_{ip}
            + \frac{(EI)_i}{EI_0}\bar{D}_{ip}
            + \frac{(EI)_i}{EI_0}\bar{D}_{ip}
            \frac{2}{EI_0}
            \biggl( \frac{dEI}{d \xi}\biggr)_i
            \bar{C}_{ip}\\
            &\qquad
            + \frac{1}{EI_0}
            \biggl(\frac{d^2EI}{d \xi ^2} \biggr)_i
            B_{ip}
            + \frac{P_0L^2}{EI_0}B_{ip}
            + \frac{k_wL^4}{EI_0} \delta _{ip}
          \end{aligned}
        \right]
        $};
        }
        }^{\displaystyle A}
          \bar{w}_p \\
    &+ \overbrace{\tikz[baseline]{
      \node[fill=green!30,anchor=base] (t1)
      {$[0]$};
      }}^{\displaystyle B}
      \kappa _{\bar{i}}
      = \overbrace{\tikz[baseline]{
      \node[fill=yellow!50,anchor=base] (t1)
      {${\frac{w_0}{L}}$};
      }}^{\displaystyle C}
  \end{split}
\end{equation}

\end{document}

答案2

这里,有三种不同的方法来解决这个问题。

在此处输入图片描述 在此处输入图片描述 在此处输入图片描述

\documentclass{article}
\usepackage{amsmath}
\usepackage{mathtools}
\usepackage{tikz}
    \usetikzlibrary{decorations.pathreplacing}
\usepackage[customcolors]{hf-tikz}

\begin{document}

% #1 With separated braces

\begin{equation}
    \begin{split} 
\sum_{p=1}^{n}  &
    \overbrace{\tikz[baseline]{%
            \node[fill=blue!30,anchor=base] (t1)
            {%
            $\left[\frac{\left(EI\right)_i}{EI_0}\bar{D}_{ip} +\frac{\left(EI \right)_i}{EI_0}\bar{D}_{ip}+ \frac{\left(EI \right)_i}{EI_0}\bar{D}_{ip} \frac{2}{EI_0}\left( \frac{dEI}{d \xi }\right)_i\bar{C}_{ip}\right.$};
} \rule[-12pt]{0pt}{5pt}}^{\mbox{$A$}} \\
    & \underbrace{\tikz[baseline]{%
            \node[fill=blue!30,anchor=base] (t1)
            {$\left. +\frac{1}{EI_0}\left(\frac{d^2EI}{d \xi ^2} \right)_i B_{ip} +\frac{P_0L^2}{EI_0}B_{ip}+\frac{k_wL^4}{EI_0} \delta _{ip} \right]$};
    } \rule[-12pt]{0pt}{5pt}}_{\mbox{$A$}} \bar{w}_p \\
    &+\overbrace{\tikz[baseline]{%
            \node[fill=green!30,anchor=base] (t1)
            {$[0]$};
    } \rule[-12pt]{0pt}{5pt}}^{\mbox{$B$}} \kappa _{\bar{i}}=\overbrace{\tikz[baseline]{
            \node[fill=yellow!50,anchor=base] (t1)
            {${\frac{w_0}{L}}$};
    } \rule[-12pt]{0pt}{5pt}}^{\mbox{$C$}}                    
    \end{split}                     
\end{equation}

\bigskip

% #2 By colouring each section
% Ideas from https://tex.stackexchange.com/questions/75129/boxed-tikz-and-colored-equation-background

\hfsetfillcolor{blue!30}
\hfsetbordercolor{blue!30}
\begin{equation}
    \begin{split} 
\sum_{p=1}^{n}  &
    \tikzmarkin[disable rounded corners=true]{a}(0.05,-0.5)(0.1,0.65)
            \left[\frac{\left(EI\right)_i}{EI_0}\bar{D}_{ip} +\frac{\left(EI \right)_i}{EI_0}\bar{D}_{ip}+ \frac{\left(EI \right)_i}{EI_0}\bar{D}_{ip} \frac{2}{EI_0}\left( \frac{dEI}{d \xi }\right)_i\bar{C}_{ip}\right.\tikzmarkend{a} \\
    & \left.\tikzmarkin[disable rounded corners=true]{b}(0.03,-0.5)(0,0.75) +\frac{1}{EI_0}\left(\frac{d^2EI}{d \xi ^2} \right)_i B_{ip} +\frac{P_0L^2}{EI_0}B_{ip}+\frac{k_wL^4}{EI_0} \delta _{ip} \right] \tikzmarkend{b} \cdot\,\bar{w}_p  \\[2ex]
    &+\tikz[baseline]{\node[fill=green!30,anchor=base] (t1)
            {$[0]$};} \kappa _{\bar{i}}= \tikz[baseline]{%
            \node[fill=yellow!50,anchor=base] (t1)
            {${\frac{w_0}{L}}$};}%                    
    \end{split}
\end{equation}

\begin{center}
\tikz{\node (A) at (0,0) [draw=blue!30, fill=blue!30] {$A$};}
\tikz{\node (B) at (A.east) [draw=green!30, fill=green!30] {$B$};}
\tikz{\node (C) at (B.east) [draw=yellow!50, fill=yellow!50] {$C$};}
\end{center}

\bigskip

% #3 With coloured braces

\hfsetfillcolor{blue!30}
\hfsetbordercolor{blue!30}
\begin{equation}
    \begin{split} 
\sum_{p=1}^{n}  &
    \tikzmarkin[disable rounded corners=true]{c}(0.05,-0.5)(0.1,0.65)
            \left[\frac{\left(EI\right)_i}{EI_0}\bar{D}_{ip} +\frac{\left(EI \right)_i}{EI_0}\bar{D}_{ip}+ \frac{\left(EI \right)_i}{EI_0}\bar{D}_{ip} \frac{2}{EI_0}\left( \frac{dEI}{d \xi }\right)_i\bar{C}_{ip}\right.\tikzmarkend{c} \\
    & \left.\tikzmarkin[disable rounded corners=true]{d}(0.03,-0.5)(0,0.75) +\frac{1}{EI_0}\left(\frac{d^2EI}{d \xi ^2} \right)_i B_{ip} +\frac{P_0L^2}{EI_0}B_{ip}+\frac{k_wL^4}{EI_0} \delta _{ip} \right] \tikzmarkend{d} \cdot\,\bar{w}_p  \\[2ex]
    &+\color{green!30}\overbrace{\tikz[baseline]{%
            \node[fill=green!30,anchor=base] (t1)
            {$\color{black}[0]$};
    } \rule[-12pt]{0pt}{5pt}}^{\mbox{$B$}} \color{black}\kappa _{\bar{i}}=\color{yellow!60}\overbrace{\tikz[baseline]{
            \node[fill=yellow!50,anchor=base] (t1)
            {${\color{black}\frac{w_0}{L}}$};
    } \rule[-12pt]{0pt}{5pt}}^{\mbox{$C$}}                    
    \end{split}
\begin{tikzpicture}[%
        decoration = {brace,
        amplitude=5pt}]
\draw [rotate = 180, ultra thick, blue!40, decorate, transform canvas={xshift = 1em, yshift= -1em}]
    (1,-1) -- node [right=7pt]
    {\text{$A$}} (1,1.5);
\end{tikzpicture}
\end{equation}

\end{document}

相关内容