0

I am using the following snippet to define a custom language:

\newcommand\mscript{customMATLAB}
\expandafter\expandafter\expandafter\lstdefinelanguage%
\expandafter{\mscript}{
alsoletter={:,=},
morekeywords={find_system,delete_line,...},% 
sensitive=t,%
morecomment=[l]//,%
morestring=[b]'
}

However when I use the language as below, only in line 1 the find_system is highlighted. I am assuming the space plays an important part on the syntax highlighting but I don't know how to configure the language or syntax highlighting to ignore the spaces after the assignment operator.

\begin{lstlisting}[language=customMatlab]
sys = find_system('x') 
sys=find_system('x') 
\end{lstlisting}
2
  • 1
    The = character is declared as a letter with alsoletter, so sys=find_system would be similar to for example sysxfind_system, which would also not be highlighted. If you remove = from alsoletter the second line should be highlighted as well.
    – Marijn
    May 5, 2020 at 21:25
  • Thanks @Marijn! It works 😊 May 6, 2020 at 12:37

1 Answer 1

1

As @Marijn kindly suggested, the key was to remove the = from the alsoletter.

You must log in to answer this question.

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