I am creating a beamer presentation with some code inside and I would like to add some vertical spacing inside a listings environment.
I tried using the phantom family commands, but as it is in a listings environment the phantom commands are not interpreted.
My Question is: how can I add some vertical spacing (eg. 3cm) inside my listings environment?
MWE
\documentclass[table,dvipsnames]{beamer}
%%% Basic packages
\usepackage{amsmath}
\usepackage{pgfpages}
\usepackage{pgfplots}
\usepackage{graphicx}
\usepackage{picture}
\usepackage{filecontents}
\usepackage{multicol}
\usepackage{ragged2e}
\usepackage{listingsutf8}
\lstset{
language=python,
inputencoding=utf8/latin1,
extendedchars=true,
keywordstyle=\bfseries\ttfamily\color{blue},
identifierstyle=\ttfamily,
commentstyle=\color{gray},
stringstyle=\ttfamily\color{green!50!black},
showstringspaces=false,
basicstyle=\footnotesize\ttfamily,
tabsize=2,
breaklines=true,
extendedchars=true,
xleftmargin=1cm,
xrightmargin=1cm,
backgroundcolor=\color{white!80!black},
literate=%
{é}{{\'{e}}}1
{è}{{\`{e}}}1
{ê}{{\^{e}}}1
{ë}{{\¨{e}}}1
{û}{{\^{u}}}1
{ù}{{\`{u}}}1
{â}{{\^{a}}}1
{à}{{\`{a}}}1
{î}{{\^{i}}}1
{ô}{{\^{o}}}1
{ç}{{\c{c}}}1
}
\title[Test listings]{Test listings}
\subtitle{ }
\author{ }
\institute{ }
\date{ }
\begin{document}
\begin{frame}[fragile]
\frametitle{test}
\begin{lstlisting}
if (1<2):
print('python')
\vphantom{vertical spacing}
if (2<3):
print('yay')
\end{lstlisting}
\end{frame}
\end{document}
listingsenvironment, you can simply add lines in the listed code. If you want to add spacing between twolistingsenvironments, you can then use\vspace{<someheight>}– BambOo Aug 21 '18 at 09:25listingenvironment? – belitd Aug 21 '18 at 09:33