I wonder is there any possibility to show two different listings in one table side by side? Here is my code that only show one listening but how can I embed it in a table and another one?
EDIT: Even I have tried the mentioned links on below, I get a few errors while compiling the file. I also post my edited LaTeX code.
\documentclass[english,a4paper,12pt]{report}
\usepackage{mathpazo}
\usepackage{graphicx}
\renewcommand{\sfdefault}{lmss}
\usepackage{courier}
\usepackage[T1]{fontenc}
\usepackage[latin9]{inputenc}
\usepackage{listings}
\begin{document}
\begin{tabular}{|l|l|}
\begin{minipage}{.48\textwidth}
\begin{lstlisting}[
basicstyle={\scriptsize\ttfamily},
identifierstyle={\color{black}},
tabsize=2,
language={[AspectJ]Java},
numbersep=8pt,
numbers=left,
xleftmargin=0.5cm,frame=tlbr,framesep=2pt,framerule=0pt,
morekeywords ={class,run}
]
class PrintHelloThread ext Thread {
void run(Dummy x) {
out.println("Hello world")
}
}
class X ext ProxifiedObject {
PrintHelloThread thread
void main(X x) {
x.thread := new PrintHelloThread;
x.thread.start(0);
x.thread.join(0);
}
}
\end{lstlisting}
\end{minipage}
&
\begin{minipage}{.48\textwidth}
\begin{lstlisting}[
basicstyle={\scriptsize\ttfamily},
identifierstyle={\color{black}},
tabsize=2,
language={[AspectJ]Java},
numbersep=8pt,
numbers=left,
xleftmargin=0.5cm,frame=tlbr,framesep=2pt,framerule=0pt,
morekeywords ={class,run}
]
class PrintHelloThread ext Thread {
void run(Dummy x) {
out.println("Hello world")
}
}
class X ext ProxifiedObject {
PrintHelloThread thread
void main(X x) {
x.thread := new PrintHelloThread;
x.thread.start(0);
x.thread.join(0);
}
}
\end{lstlisting}
\end{minipage}
\\
\end{tabular}
\end{document}
What I would like to show is :


