# svmono with 'draft' causes lstlistings to produce no output

Why does the following produce no output?

\documentclass[draft]{svmono}
\usepackage{listings}
\begin{document}

\begin{lstlisting}
theorem :: GROUP_10:14
for G being finite Group,
p being prime (natural number) holds
(for H being Subgroup of G st
H is_p-group_of_prime p holds
\end{lstlisting}

\end{document}


(Obviously it is easy to fix this issue by switching off 'draft' -- but I would like to understand what is happening.)

-

## 1 Answer

It is unrelated to svmono. Class options are global options so it gets passed to listings the draft option of listings suppresses file handling as far as I can see. The listings documentation says

draft
The package prints no stand alone files, but shows the captions and defines
the corresponding labels. Note that a global \documentclass-option draft
is recognized, so you don't need to repeat it as a package option.

-
Pretty old question but... can you define a placeholder element like for figures instead of just hiding the listing? Collegue of mine lost about half an hour because nobody told him that listings are hidden in draft mode. – Hendrik Wiese Nov 18 '14 at 14:56
@HendrikWiese looking at listings source I see \def\lst@InputListing#1{% \begingroup \lsthk@PreSet \gdef\lst@intname{#1}% \expandafter\lstset\expandafter{\lst@set}% \lsthk@DisplayStyle \catcode\active=\active \lst@Init\relax \let\lst@gobble\z@ \lst@SkipToFirst \lst@ifprint \def\lst@next{\input{#1}}% \else \let\lst@next\@empty \fi \lst@next \lst@DeInit \endgroup} so putting that between \makeatletter \makeatother and change \let\lst@next\@empty to \def\lst@next{\fbox{#1 not printed}} probably does something. – David Carlisle Nov 18 '14 at 15:16