I would like to insert a source code listing into my beamer presentation. I learnt that we cannot use lstlisting directly in the frame environment, so I am using the following trick:
\defverbatim[colored]\makeset{
\begin{lstlisting}[language=C++,basicstyle=\ttfamily,keywordstyle=\color{blue}]
void make_set(int X) {
parent[X] = X;
}
\end{lstlisting}
}
\begin{frame}
\makeset
\end{frame}
My lstset is:
\lstset{ %
backgroundcolor=\color{white},
basicstyle=\footnotesize,
breakatwhitespace=false,
breaklines=true,
captionpos=b,
commentstyle=\color{mygreen},
escapeinside={\%*}{*)},
extendedchars=true,
frame=single,
keywordstyle=\color{blue},
language=Prolog,
numbers=left,
numbersep=5pt,
numberstyle=\tiny\color{mygray},
rulecolor=\color{black},
showspaces=false,
showstringspaces=false,
showtabs=false,
stepnumber=2,
stringstyle=\color{mymauve},
tabsize=2,
title=\lstname,
morekeywords={not,\},\{,preconditions,effects },
deletekeywords={time}
}
Unfortunatelty the resulting slide has a thick grey line after the code:
Is there any way to remove the line?
lstlisting
environment as-is, but add the[fragile]
option to your frame.\lstset
. Please provide a complete, minimal working example (MWE).