Fazer com que as figuras (listagens) sejam como transições de nó/seta tikz

Fazer com que as figuras (listagens) sejam como transições de nó/seta tikz

Eu tenho o MWE conforme abaixo:

\documentclass[a4paper,11pt,twoside]{report}
\usepackage[left=2.5cm,right=2cm,top=2cm,bottom=2cm]{geometry}
\usepackage[T1]{fontenc}
\usepackage{graphicx}

\usepackage{setspace}
\usepackage{bchart}
\usepackage{float}
\usepackage{listings}
\usepackage{color}
\usepackage{textcomp}
\lstset{
%frame=tb,
  language=C++,
  aboveskip=3mm,
  belowskip=3mm,
  showstringspaces=false,
  columns=flexible,
  %basicstyle={\small\ttfamily},
  basicstyle=\ttfamily\footnotesize\bfseries,
  numbers=none,
  numberstyle=\tiny\color{gray},
  %keywordstyle=\color{blue},
  commentstyle=\color{dkgreen},
  %stringstyle=\color{mauve},
  breaklines=true,
  breakatwhitespace=true,
  tabsize=3
}

\begin{document}

\begin{figure}[H]
\centering
\begin{minipage}{.45\linewidth}
\begin{lstlisting}
array stat_1[144] : w32 -> w8 = symbolic
(query [(Eq falseq
            (Eq 0
                N0:(ReadLSB w64 56 stat_1)))
        (Eq false
            (Eq 0 N1:(URem w64 8 N0)))]
       (Eq false
           (Eq 0 N2:(Read w8 56 stat_1))))
\end{lstlisting}
\end{minipage}
\end{figure}


\begin{figure}[H]
\centering
\begin{minipage}{.45\linewidth}
\begin{lstlisting}
array stat_1[144] : w32 -> w8 = symbolic
(query [(Eq falseq
            (Eq 0
                N0:(ReadLSB w64 56 stat_1)))
        (Eq false
            (Eq 0 N1:(URem w64 8 N0)))
        (Eq false
            (Eq 0 (URem w64 N0 N1)))]
       (Eq false
           (Eq 0 N2:(Read w8 56 stat_1))))

\end{lstlisting}
\end{minipage}
\end{figure}


\end{document}

Quero produzir algo que mostre a primeira figura como se tornando a segunda, por exemplo, algo como Figura1 ---> Figura2 (como o estilo de máquina de estado de nós/setas tikz, mas quero poder inserir figuras/listagens dentro) como posso conseguir algo assim? Espero ter sido claro, obrigado!

Responder1

Você pode simplesmente usar tikze ter lstlistingcomo conteúdo do nó. (Remova o figureambiente, mas mantenha o arquivo minipage.)

\documentclass[a4paper,11pt,twoside]{report}
\usepackage[left=2.5cm,right=2cm,top=2cm,bottom=2cm]{geometry}
\usepackage[T1]{fontenc}
\usepackage{graphicx}

\usepackage{setspace}
\usepackage{bchart}
\usepackage{float}
\usepackage{listings}
\usepackage{color}
\usepackage{textcomp}
\lstset{
%frame=tb,
  language=C++,
  aboveskip=3mm,
  belowskip=3mm,
  showstringspaces=false,
  columns=flexible,
  %basicstyle={\small\ttfamily},
  basicstyle=\ttfamily\footnotesize\bfseries,
  numbers=none,
  numberstyle=\tiny\color{gray},
  %keywordstyle=\color{blue},
  commentstyle=\color{dkgreen},
  %stringstyle=\color{mauve},
  breaklines=true,
  breakatwhitespace=true,
  tabsize=3
}

\usepackage{tikz}
\usetikzlibrary{positioning}

\begin{document}

\centering
\begin{tikzpicture}
  \node(listing1)[draw]{%
\begin{minipage}{.45\linewidth}
\begin{lstlisting}
array stat_1[144] : w32 -> w8 = symbolic
(query [(Eq falseq
            (Eq 0
                N0:(ReadLSB w64 56 stat_1)))
        (Eq false
            (Eq 0 N1:(URem w64 8 N0)))]
       (Eq false
           (Eq 0 N2:(Read w8 56 stat_1))))
\end{lstlisting}
\end{minipage}
}
node(listing2)[draw,right=of listing1]{%
\begin{minipage}{.45\linewidth}
\begin{lstlisting}
array stat_1[144] : w32 -> w8 = symbolic
(query [(Eq falseq
            (Eq 0
                N0:(ReadLSB w64 56 stat_1)))
        (Eq false
            (Eq 0 N1:(URem w64 8 N0)))
        (Eq false
            (Eq 0 (URem w64 N0 N1)))]
       (Eq false
           (Eq 0 N2:(Read w8 56 stat_1))))
\end{lstlisting}
\end{minipage}
};
\draw[->] (listing1)--(listing2);
\end{tikzpicture}

\end{document}

informação relacionada