I'm writing a document using Overleaf. The main language I'm using is Greek. The Greek shows up fine but when I try to enter Matlab code using the package listings, it shows up as Greek in the compiled document instead of the English Matlab commands. Part of the code:
\usepackage[english, greek]{babel}
\usepackage{listings}
\begin{document}
%matlab
\lstset{language=Matlab,%
%basicstyle=\color{red},
breaklines=true,%
morekeywords={matlab2tikz},
keywordstyle=\color{blue},%
morekeywords=[2]{1}, keywordstyle=[2]{\color{black}},
identifierstyle=\color{black},%
stringstyle=\color{mylilas},
commentstyle=\color{mygreen},%
showstringspaces=false,%without this there will be a symbol in the places where there is a space
numbers=left,%
numberstyle={\tiny \color{black}},% size of the numbers
numbersep=9pt, % this defines how far the numbers are from the text
emph=[1]{for,end,break},emphstyle=[1]\color{red}, %some words to emphasise
%emph=[2]{word1,word2}, emphstyle=[2]{style},
}
\lstinputlisting{MyMatlabCode.m}
Result:
How it should look like:
I used code from this question: What can I use to typeset MATLAB code in my document?

