3

I have the MWE as below:

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

I want to produce something showing the first figure as becoming the second one for example something like Figure1 ---> Figure2 (kind of like the tikz nodes/arrows state machine style but I want to be able to insert figures/listings inside) how can I achieve something like that? Hope I was clear thanks!

1 Answer 1

5

You can simply use tikz and have the lstlisting as the node content. (Remove the figure environment, but keep the 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}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .