# Landscape view, two separate columns with listings over multiple pages

I want to compare two codes in two different languages in latex. I use lstlisting for both of them and then I want to see them side by side. I archived this using minipage environment but my listings are bigger than one page so they are overlapped. Also I have a strange empty page before listings. Multicolsenvironment doesn't allow me to see listings side by side. Anybody know solution?

I use code like this

\begin{landscape}
\noindent\begin{minipage}{.45\columnwidth}
\begin{lstlisting}[caption=code 1,frame=tlrb]{Name}
void code()
{
}
\end{lstlisting}
\end{minipage}\hfill
\begin{minipage}{.45\columnwidth}
\begin{lstlisting}[caption=code 2,frame=tlrb]{Name}
void code()
{
}
\end{lstlisting}
\end{minipage}
\end{landscape}


This is how it looks if i use paracol

• Welcome to TeX.SX! Maybe you can make use of the paracol package as already suggested in the comments on this related question: side-by-side inputlisting in landscape over multiple pages](tex.stackexchange.com/q/377797/134144)[ – leandriis Jun 29 at 21:16
• Hi, i uploaded image how it looks if i use paracol package – Atar1x Jun 29 at 21:25
• Unfortunately my ides using paracol only seems to work in portrait pages. Would that be an option for you? – leandriis Jun 30 at 16:26

It turns out that paracol is incompatible with pdflscape and IIRC listings can't break pages. You can use paracol to create a side by side two page layout, but it leaves the remainder of the right page blank.

\documentclass{article}
\usepackage{listings}
\usepackage{paracol}
\usepackage{lipsum}% MWE only
\usepackage{showframe}% MWE only

\globalcounter{lstlisting}% if you want different caption numbers

\begin{document}
\begin{paracol}[1]{2}
\begin{lstlisting}[caption=code 1,frame=tlrb]{Name}
void code()
{
}
\end{lstlisting}
\switchcolumn
\begin{lstlisting}[caption=code 2,frame=tlrb]{Name}
void code()
{
}
\end{lstlisting}
\end{paracol}
\lipsum[1-8]
\end{document}


It is also possible to store lstlisting in a savebox and use adjustbox to crop it into page sized chunks. See cropping boxes and boxing lstlisting.