# Put two parts of source code in the same line

How can I have this behavior in LaTeX please :

Two portions of code in the same line, separated by an arrow.

• Well, either use a tabular or an alignat environment, however, that's mathmode. You could use listings too – user31729 Apr 30 '16 at 10:24
• Can I have some source code if it's possible ? – Sidahmed Apr 30 '16 at 10:29

In math mode use two array environments:

\documentclass{article}
\begin{document}
$\begin{array}{lll} r1 & = & 12\\ r2 & = & 34\\ r3 & = & r1+r2 \end{array} \Leftrightarrow \begin{array}{lll} r3 & = & 12\\ r2 & = & 34\\ r2 & = & r3+r1 \end{array}$
\end{document}


In text mode use tabular at both sides of $\Leftrightarrow$:

\documentclass{article}
\begin{document}
\begin{tabular}{lll}
r1 & = & 12\\
r2 & = & 34\\
r3 & = & r1+r2
\end{tabular}
$\Leftrightarrow$
\begin{tabular}{lll}
r3 & = & 12\\
r2 & = & 34\\
r2 & = & r3+r1
\end{tabular}
\end{document}


For plain text is enough two minipages:

\documentclass{article}
\begin{document}
\begin{minipage}{3cm}
Some text come here in a minipage
\end{minipage}
$\Leftrightarrow$
\begin{minipage}{3cm}
More dummy text to see the minipage
\end{minipage}
\end{document}