한 Tcolorbox에서 다른 Tcolorbox로 화살표 그리기

Nov 22 2020

비머에 대한 프레젠테이션을 만들고 있는데 이와 비슷한 슬라이드를 만들고 싶습니다. 두 세트의 방정식에 대해 Tcolorbox를 사용하고 정렬하여 상자 안에 방정식을 얻을 수 있다는 것을 알고 있습니다. 또한 열 환경을 사용하여 왼쪽과 오른쪽에 두 개의 상자를 가져올 수 있습니다. 그러나 아래 그림과 같이 두 상자를 화살표로 연결하는 방법을 모르겠습니다.

비머에서이 작업을 수행하는 방법을 안내하거나 아래 그림의 예를 재현 할 수 있다면 정말 감사하겠습니다!

답변

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}

결과는 두 번째 솔루션과 유사합니다.

1 Ignasi Nov 23 2020 at 09:06

이 사이의 혼합이다 Zarko의 부록 과 내 대답 하는 두 tcolorboxes 사이에 화살표 추가

예제는 beamer문서에 내장되어 있습니다. 따라 overlayremember picture사용, 상자 사이의 화살표는 두 번째 컴파일 후 나타납니다.

\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}