I defined a new command named '\showLineNo', and used in '\lstdefinestyle', got an error:
Package Listings Error: Numbers none unknown. \lstset{style=customstyleone}
sample code:
\documentclass{article}
\RequirePackage{listings}
\def\showLineNo{none}
\lstdefinestyle{customstyleone}{
numbers=\showLineNo,
numbersep=5pt
}
\lstset{style=customstyleone}
\begin{document}
\begin{lstlisting}[language=Python, caption=python code example]
def incmatrix(genl1,genl2):
m = len(genl1)
n = len(genl2)
M = None #to become the incidence matrix
VT = np.zeros((n*m,1), int) #dummy variable
\end{lstlisting}
\end{document}
but work as follow:
\documentclass{article}
\RequirePackage{listings}
\lstdefinestyle{customstyleone}{
numbers=none,
numbersep=5pt
}
\lstset{style=customstyleone}
\begin{document}
\begin{lstlisting}[language=Python, caption=python code example]
def incmatrix(genl1,genl2):
m = len(genl1)
n = len(genl2)
M = None #to become the incidence matrix
VT = np.zeros((n*m,1), int) #dummy variable
\end{lstlisting}
\end{document}
How can I use custom command pass to lstdefinestyle?