This is my preamble for my book documentclass:
\documentclass[11pt,fleqn]{book} % Default font size and left-justified equations
\usepackage[top=3cm,bottom=3cm,left=3.2cm,right=3.2cm,headsep=10pt,a4paper]{geometry} % Page margins
\usepackage[titletoc]{appendix}
\usepackage[svgnames]{xcolor} % Required for specifying colors by name
\definecolor{ocre}{RGB}{243,102,25} % Define the orange color used for highlighting throughout the book
\definecolor{mygray}{RGB}{243,243,244}
% Font Settings
\usepackage{avant} % Use the Avantgarde font for headings
\usepackage{mathptmx}
\usepackage{microtype}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{makeidx}
\usepackage{calc}
%\usepackage{bigfoot}
\usepackage[numbered,framed]{matlab-prettifier}
\usepackage{filecontents}
\usepackage{empheq}
% Index
\usepackage{calc} % For simpler calculation - used for spacing the index letter headings correctly
\usepackage[font={color=ocre,bf},figurename=Fig.,labelfont={it}]{caption}
\usepackage[framemethod=default]{mdframed}
\usepackage{mathtools}
\usepackage[most]{tcolorbox}
\tcbset{myformula/.style={
arc=0pt,
outer arc=0pt,
%colback=ocre!10,
colback=mygray,
colframe=ocre,
boxrule=0.8pt,
left=2pt,
right=2pt,
highlight math style={
arc=0pt,
outer arc=0pt,
colback=mygray,
colframe=red.
}
}
}
%\usepackage{hyperref}
\newenvironment{spread}[1]{%
\advance\jot#1% indeed
}{%
\ignorespacesafterend
}
When I try to put some matlab code in:
\begin{lstlisting}[caption = {For educational purposes}]
% example of while loop using placeholders
while "\ph{condition}"
if "\ph{something-bad-happens}"
break
else
% do something useful
end
% do more things
end
\end{lstlisting}
It only shows up as black and white:

where as I wanted to get:

can you tell me how I can fix my tex file so that the Matlab code can show up with color??


style=Matlab-editorto thelstlistingenvironment options. Without this, thelistingspackage has no idea what style to apply to the code. – Paul Gessler Jun 05 '15 at 00:28