Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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!

share|improve this question
add comment

1 Answer 1

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}
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.