TransWikia.com

Drawing arrows from one Tcolorbox to another

TeX - LaTeX Asked by Josh Pilipovsky on January 16, 2021

I am creating a presentation on beamer and want to create a slide similar to this.
I know that for the two sets of equations, I can use a Tcolorbox and align to get the equations inside the boxes.
Additionally, I can use the columns environment to get the two boxes on the left and right sides.
However, I’m not sure how to link the two boxes together with the arrow, as shown in the picture below.

If anyone can guide me through a way to do this in beamer or reproduce an example of the picture below, I’d really appreciate it!

enter image description here

2 Answers

You not provide any code what you tray so far, so, we can only guess and eventually retype your equations. Usually such service is not provided here, so the following proposition not directly addresses all your problems.

In case that you like to have tcolorboxes, the following may be a solution:

usepackage[most]{tcolorbox}

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

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

enter image description here

Note: contents of tcolorboxes you can organize by use all math environments defined in amsmath.

Another way is use of TikZ picture:

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=dend{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}

enter image description here

Addendum: you can also combine the both above solutions:

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=dend{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}

Result is similar as the second solution:

enter image description here

Answered by Zarko on January 16, 2021

This is a mix between Zarko's Addendum and my answer to Add arrow between two tcolorboxes

The example is built into a beamer document. As overlay and remember picture are used, the arrow between boxes will appear after second compilation.

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=dend{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}

enter image description here

Answered by Ignasi on January 16, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP