あるTcolorboxから別のTcolorboxに矢印を描く

Nov 22 2020

ビーマーでプレゼンテーションを作成していますが、これに似たスライドを作成したいと思います。2セットの方程式の場合、Tcolorboxを使用して整列し、ボックス内の方程式を取得できることを知っています。さらに、列環境を使用して、左側と右側の2つのボックスを取得できます。ただし、下の図に示すように、2つのボックスを矢印でリンクする方法がわかりません。

誰かがビーマーでこれを行う方法を私に案内したり、下の写真の例を再現したりすることができれば、私は本当に感謝しています!

回答

3 Zarko Nov 22 2020 at 11:48

これまでに追跡したコードを提供していないため、方程式を推測して最終的に再入力することしかできません。通常、このようなサービスはここでは提供されないため、次の提案はすべての問題に直接対処するわけではありません。

あなたがtcolorboxesを持ちたい場合は、以下が解決策かもしれません:

\usepackage[most]{tcolorbox}

\tcbset{on line,    
        boxsep=0pt, 
        colframe=gray,colback=white,
        highlight math style={enhanced}  % <---
        }

\begin{document}
    \[
\tcbhighmath{\begin{aligned} a=b\\ c=d\end{aligned}}
    \longrightarrow
\tcbhighmath{K=\begin{bmatrix} a\\ b \end{bmatrix}}
    \]
\end{document}

注:tcolorboxamsmathで定義されているすべての数学環境を使用して整理できるesの内容。

別の方法は、TikZ画像の使用です。

\documentclass{article}
\usepackage{amsmath}
\usepackage{tikz}
\usetikzlibrary{arrows.meta,
                positioning}

\begin{document}
Some text

    \begin{tikzpicture}[
every node/.style = {draw=gray, rounded corners, very thick}
                        ]
\node (left)    {$\begin{aligned} a=b\\ c=d\end{aligned}$};
\node (right) [right=of left]
                {$\begin{gathered} X = [\text{some equation}] \\ K_1=\begin{bmatrix} a\\ b \end{bmatrix} \quad K_2=\begin{bmatrix} c\\ d \end{bmatrix} \end{gathered}$};
\draw[-Straight Barb] (left) -- (right);
    \end{tikzpicture}
\end{document}

補遺:上記の両方のソリューションを組み合わせることもできます。

\documentclass{article}
\usepackage{amsmath}
\usepackage[most]{tcolorbox}
\usetikzlibrary{arrows.meta,
                positioning}

\tcbset{on line,    % borrowed from https://tex.stackexchange.com/questions/568880/
        boxsep=0pt, % left=1pt,right=1pt,top=1pt,bottom=1pt,
        colframe=gray,colback=white, % or some other color of box background
        highlight math style={enhanced}  % <---
        }

\begin{document}
    \begin{tikzpicture}[
every node/.style = {inner sep=0pt}
                        ]
\node (left)    {\tcbhighmath{\begin{aligned} a=b\\ c=d\end{aligned}}};
\node (right) [right=of left]
                {\tcbhighmath{\begin{gathered} X = [\text{some equation}]    \\
                        K_1=\begin{bmatrix} a\\ b \end{bmatrix}
                        \quad
                        K_2=\begin{bmatrix} c\\ d \end{bmatrix}
                 \end{gathered}}};
\draw[-Straight Barb] (left) -- (right);
    \end{tikzpicture}
\end{document}

結果は2番目のソリューションと同様です。

1 Ignasi Nov 23 2020 at 09:06

これは、Zarkoの補遺と2つのtcolorboxの間に矢印を追加するという私の答えの組み合わせです

この例はbeamerドキュメントに組み込まれています。通りoverlayremember picture使用されている、ボックス間の矢印は、2回目のコンパイル後に表示されます。

\documentclass{beamer}
\usepackage{amsmath}
\usepackage[most]{tcolorbox}
\usetikzlibrary{arrows.meta,
                positioning}

\tcbset{on line,    % borrowed from https://tex.stackexchange.com/questions/568880/
        boxsep=0pt, % left=1pt,right=1pt,top=1pt,bottom=1pt,
        colframe=gray,colback=white, % or some other color of box background
        highlight math style={enhanced}  % <---
        }

\begin{document}
\begin{frame}{With tcolorbox}
\tcbhighmath[remember as=left]{\begin{aligned} a=b\\ c=d\end{aligned}}\hspace{1cm}
\tcbhighmath[remember as=right]{\begin{gathered} X = [\text{some equation}]    \\
                        K_1=\begin{bmatrix} a\\ b \end{bmatrix}
                        \quad
                        K_2=\begin{bmatrix} c\\ d \end{bmatrix}
                 \end{gathered}}
\tikz[overlay, remember picture] \draw[-Straight Barb] (left) -- (right);
\end{frame}

\end{document}