# A diagram with matrices

I want to draw the following diagram which contains two matrices (2x2 on left and 4x4 on right) and a box. Could someone help?

• What have you tried so far? Please add a minimal working example (MWE). – epR8GaYuh Nov 19 '18 at 8:51
• Actually, I have never made a drawing in latex before. So, I have completely no idea how to begin. – Tobias Fritzn Nov 19 '18 at 8:53

With some motivations from @Alain Matthes answer: Tikz: Arrowheads in the center

This could be a starting point for your quest:

\documentclass{article}
\usepackage{amsmath}
\usepackage{tikz}
\usetikzlibrary{arrows}
\usetikzlibrary{decorations.markings}

\begin{document}
\pagestyle{empty}
%
\tikzstyle{int}=[draw, minimum size=2em]
\tikzset{->-/.style={decoration={
markings,
mark=at position #1 with {\arrow{>}}},postaction={decorate}}}
\begin{tikzpicture}[node distance=2.5cm, auto]
\node [int] (a) {DST};
\node (b) [left of=a, coordinate] {a};
\node (c) [right of=a, coordinate] {a};
\draw[dashed, ->-=0.5] (b) --(a);
\draw[dashed, ->-=0.5] (a) --(c);
\node        (d) [right of=c,shift={(-1.1cm,0mm)}]{$\begin{pmatrix} c&c&v&b\\ a&b&c&d\\ a&b&c&d\\ a&b&c&d \end{pmatrix}$};
\node        (e) [right of=b, shift={(-3.1cm,0mm)}]{$\begin{pmatrix} c&c\\ a&b \end{pmatrix}$};
\end{tikzpicture}

\end{document}


which would give:

Note: Since your arrows are not aligned in the center, I used the macro option from the answer to play with the placement of the arrows as you define. For more information on how-to, please refer the link given above.

Rather similar to Raaja's nice answer except that I am using tikzmark to annotate an ordinary equation, such that identations are unchanged. And the TikZ path can be done in one stroke.

\documentclass[fleqn]{article}
\usepackage{amsmath}
\usepackage{tikz}
\usetikzlibrary{tikzmark}
\usetikzlibrary{decorations.markings}
% from https://tex.stackexchange.com/a/39282/121799
\tikzset{->-/.style={decoration={
markings,
mark=at position #1 with {\arrow{>}}},postaction={decorate}}}
\begin{document}
$\tikzmarknode{L}{\begin{pmatrix} 1 & 2 \\ 3 & 4 \end{pmatrix}} \qquad\qquad\qquad\qquad\qquad\qquad \tikzmarknode{R}{\begin{pmatrix} 1 & 2 & 3 & 4 \\ 5 & 6 & 7 & 8 \\ 9 & 10 & 11 & 12 \\ 13 & 14 & 15 & 16 \\ \end{pmatrix}}$
\begin{tikzpicture}[overlay,remember picture]
\draw[>=latex,dashed,->-=0.2,->-=0.8] (L) -- (R)
node[midway,fill=white,draw,solid]{DST};
\end{tikzpicture}
\end{document}