# Delete comment on input with listing [duplicate]

How i can deledete comment from listings code? I included source code file with \lstinputlisting{file.m} where file.m is matlab file. I want delete comment from file. % This is a comment function var = myfunction() 

I tried to use comment commentstyle=\color{white} but the result isn't as I expected cause between code there are some withe line that i want totally remove.

Just use the right delimiters instead of the ones in my code.

\documentclass{standalone}
\usepackage{listings}
\lstset{morecomment=[is]{/*}{*/}}
\begin{document}
\begin{lstlisting}
begin /* comment */ end
/* no comment but a blank line remains */
begin/* comment */end
\end{lstlisting}
\end{document}


Unfortunately, you cannot get rid of the blank line.

Reference: Delimiters in listings manual

• I didn't saw the comment from moewe. I think that the links that he provided are more useful than my anwer. ;) – gvgramazio May 2 '18 at 15:54