A single quote occuring inside a listings
string seems to be interpreted as ending the string. Is there a way to avoid this from happening?
\documentclass[12pt]{article}
\usepackage[top=0.3in, bottom=1.2in, left=0.8in, right=0.8in]{geometry}
\setlength{\parindent}{0cm}
\usepackage[english]{babel}
\usepackage{listings}
\usepackage[usenames,dvipsnames,svgnames,table]{xcolor}
\begin{document}
\lstset{language=Matlab,
basicstyle=\ttfamily,
keywordstyle=\color{Blue}\ttfamily,
stringstyle=\color{Red}\ttfamily,
commentstyle=\color{Emerald}\ttfamily,
morecomment=[l][\color{Magenta}]{\#},
breaklines=true,
breakindent=0pt,
breakatwhitespace,
columns=fullflexible,
showstringspaces=false
}
\begin{lstlisting}
a=1;
if a==1
disp('Is 1')
elseif a==2
disp('Is 2')
else
disp('I don't know')
end
\end{lstlisting}
\end{document}
disp('I don''t know')
.