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

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}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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