Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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.)

share|improve this question

1 Answer 1

up vote 2 down vote accepted

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.
share|improve this answer
    
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 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 at 15:16

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.