4

I want to save paper when I print my LaTeX file. That's why I want to hide all my code, inserted wtih lstinputlisting{}

I already know how to exclude tables and images or math but the lstinputlisting{} is a problem.

Hope someone can help me

\usepackage{comment}
\excludecomment{figure}
\let\endfigure\relax
\excludecomment{table}
\let\endtable\relax
\excludecomment{align*}
\let\endalign\relax
\excludecomment{lstlisting}
\let\endlstlisting\relax

edit: added lstlisting

1 Answer 1

6

\lstinputlisting can be redefined via \renewcommand. The macro has one optional and one mandatory argument:

% ignore \lstinputlisting
\renewcommand*{\lstinputlisting}[2][]{}

Environment lstlisting can be excluded as the other environments:

\usepackage{comment}
\excludecomment{lstlisting}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .