两个括号之间的箭头

两个括号之间的箭头

来源:

显示分配律的更好解决方案

问题:

当我看到 Peter Grill 给出的答案时,

我很想知道如何扩展(修改)这种类型的乘法代码 (a+b)(c+d)=ac+ad+bc+bd

我的意思是我们如何在这两个括号的部分之间画箭头。

我尽了很多努力,但还是找不到合适的改正方法。

代码:

\documentclass{article}
\usepackage{amsmath}
\usepackage[dvipsnames]{xcolor}
\usepackage{tikz}
\usetikzlibrary{calc,shapes}

\newcommand{\tikzmark}[1]{\tikz[overlay,remember picture] \node (#1) {};}
\newcommand{\DrawBox}[2]{%
  \begin{tikzpicture}[overlay,remember picture]
    \draw[->,shorten >=5pt,shorten <=5pt,out=70,in=130,distance=0.5cm,#1] (MarkA.north) to (MarkC.north);
    \draw[->,shorten >=5pt,shorten <=5pt,out=50,in=140,distance=0.3cm,#2] (MarkA.north) to (MarkB.north);
  \end{tikzpicture}
}
\begin{document}
    \LARGE
\[\tikzmark{MarkA}(a+b)(c\tikzmark{MarkB}+d\tikzmark{MarkC})=ac+ad+bc+bd \DrawBox{OrangeRed,distance=1cm,in=110,shorten >=10pt}{Cerulean,out=115,in=70,distance=1.5cm}\]


\end{document}

答案1

\documentclass{article}
\usepackage{amsmath}
\usepackage[dvipsnames]{xcolor}
\usepackage{tikz}
\usetikzlibrary{calc,shapes}

\newcommand{\tikzmark}[1]{\tikz[overlay,remember picture] \node (#1) {};}

\begin{document}
\[(\tikzmark{MarkA}a+\tikzmark{MarkB}b)(c\tikzmark{MarkC}+d\tikzmark{MarkD})=ac+ad+bc+bd   
\begin{tikzpicture}[overlay,remember picture]
    \draw[->,shorten >=5pt,shorten <=5pt,out=70,in=110,distance=0.75cm,OrangeRed,] (MarkA.north) to (MarkD.north);
    \draw[->,shorten >=5pt,shorten <=5pt,out=60,in=110,distance=0.5cm,Cerulean] (MarkA.north) to (MarkC.north);
    \draw[->,shorten >=1pt,shorten <=2pt,out=-70,in=-110,distance=0.5cm,OrangeRed,] (MarkB.south) to (MarkD.south);
    \draw[->,shorten >=1pt,shorten <=2pt,out=-60,in=-110,distance=0.25cm,Cerulean] (MarkB.south) to (MarkC.south);
  \end{tikzpicture}
\]

\end{document}

在此处输入图片描述

相关内容