This question already has an answer here:

I am wondering is there a way to hide or comment out all lstinputlisting from latex without actually removing them.

My codes are all like this:

\lstinputlisting[language=Python, caption=NewHope implemented using SageMath]{code_snippets/LWE-KEX/NewHope.sage}

I tried to use comment package it as suggested here and also \renewcommand{\lstinputlisting}{}, both did not work.

marked as duplicate by Mike Renfro, Community Feb 21 '17 at 2:11

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.


Try with the following redefinition:


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