I was trying to modify a latex snippet that gave this output:
so that a small C code snippet is place above the 'Code A' and 'Code B' labels as in
right
+--------------->-------------+
| |
| |
main { int main {
printf("Hello\n"); printf("Hello\n");
} return 0;
}
Code A Code B
| |
| |
+---------------<-------------+
left
So I tried to do
\documentclass{report}
\usepackage{tikz}
\usetikzlibrary{arrows,positioning}
\usetikzlibrary{arrows.meta,chains,shapes.geometric}
\begin{document}
\begin{figure}
\begin{center}
\begin{tikzpicture}[
node distance=2cm,
font=\small,
block/.style = {align=center}
]
\node (codeA) [block] {
% \begin{verbatim}
% main {
% printf("Hello\n");
% }
% \end{verbatim}
\tiny{Code A}
};
\node (codeB) [block, right=of codeA] {
% \begin{verbatim}
% int main {
% printf("Hello\n");
% return 0;
% }
% \end{verbatim}
\tiny{Code B}
};
\path [-latex]
(codeA.north) edge [bend left=35]
node[above] {right} (codeB.north);
\path [-latex] (codeB.south) edge [bend left=35]
node[below] {left} (codeA.south);
\end{tikzpicture}
\end{center}
\end{figure}
\end{document}
But using an environment in the label part gave error.
How can this be done?

