this question builds from questions answered by Ignasi and Paul Gessler. I would like to know how I can go about changing the font in the Matlab-prettifier environment using this WinEdt QuickGuide template. Here is my code:
\documentclass[%
,paper=a4
,pagesize=auto
,BCOR=0.75cm
% ,oneside
,DIV=10
% ,DIV=calc
,numbers=noenddot
,captions=heading
,captions=nooneline
,listof=totoc
,bibliography=totoc
,index=totoc
,headings=normal
% ,headings=small
,USenglish,
]{scrbook}
%
\usepackage{etex}
\reserveinserts{28}
\usepackage[refsection=chapter,defernumbers=true,sorting=none,sortcites=true,autopunct=true,babel=hyphen,hyperref=true,abbreviate=false,backref=true,backend=biber]{biblatex}
\newcommand*{\VersionInformation}{%
\centering{%
Controls\par
Typeset with \LaTeXe\ and \KOMAScript\ class\par
using \textrm{Palatino} and \textsf{Bera} fonts.\par
{\scriptsize generated: \today\par}}
}
%
\usepackage[%
,headsepline
,footsepline
,plainfootsepline
]{scrpage2}
\pagestyle{scrheadings}
\setheadwidth[-7.5mm]{1.175\textwidth}
%
% headline color
\setheadsepline{.5pt}[\color{Navy}]
\setfootsepline{.5pt}[\color{Navy}]
%
\newcommand*{\ORIGchapterheadstartvskip}{}%
% 2nd save the original definition to the new command
\let\ORIGchapterheadstartvskip=\chapterheadstartvskip
% 3rd redefine the command using the saved original command
\renewcommand*{\chapterheadstartvskip}{%
\ORIGchapterheadstartvskip
{\color{Navy}%
\setlength{\parskip}{0pt}%
\noindent\rule[.3\baselineskip]{\linewidth}{1pt}\par
}%
}
% see above
\newcommand*{\ORIGchapterheadendvskip}{}%
\let\ORIGchapterheadendvskip=\chapterheadendvskip
\renewcommand*{\chapterheadendvskip}{%
{\color{Navy}%
\setlength{\parskip}{0pt}%
\noindent\rule[.3\baselineskip]{\linewidth}{1pt}\par
}%
\ORIGchapterheadendvskip
}
%
\usepackage{chapterthumb}
\renewcommand*{\chapterthumbboxcolor}{Navy}
\renewcommand*{\chapterthumbfont}{\normalfont\Large\sffamily\bfseries}
\renewcommand{\chapterthumbwidth}{.125\paperheight}
\lohead[\putchapterthumb]{\putchapterthumb}
\addtokomafont{chapterthumb}{\small{\bfseries}}
\addtokomafont{captionlabel}{\bfseries\color{Navy}}
\addtokomafont{caption}{\color{Navy}}
\addtokomafont{chapter}{\color{Navy}}
\addtokomafont{section}{\color{Navy}}
\addtokomafont{subsection}{\color{Navy}}
\addtokomafont{subsubsection}{\color{Navy}}
\addtokomafont{paragraph}{\color{Navy}}
\addtokomafont{minisec}{\color{Navy}}
\addtokomafont{pageheadfoot}{\color{Navy}}
\addtokomafont{pagefoot}{\color{Navy}}
\addtokomafont{pagenumber}{\color{Navy}}
\addtokomafont{footnoterule}{\color{Navy}}
\usepackage{marvosym}
\usepackage{%
,fix-cm
% ,fix2col
,etex
,thinsp
,xspace
% ,ifthen
,calc
}
% --------------------------------------------------------------------
%
\usepackage{babel}
%
% line break after /:
\defineshorthand{"/}{\slash}
%
\usepackage[T1]{fontenc} % EC fonts
\usepackage[utf8]{inputenc} % coding UTF-8
\usepackage[%
,showerrors%
,svgnames%
,table% colors in tables
]{xcolor}
%
% --------------------------------------------------------------------
\usepackage{%
,graphicx
,rotating
,ltablex
%
%
,dcolumn
,booktabs
}
\usepackage{siunitx}
\renewcommand{\floatpagefraction}{0.75}% Standard = 0.5
\renewcommand{\textfraction}{0.15}% Standard = 0.2
%
\renewcommand{\topfraction}{0.8}% Standard = 0.7
\setcounter{topnumber}{3} % vorher: 2
\setcounter{bottomnumber}{1} % vorher: 1
\setcounter{totalnumber}{5} % vorher: 3
%
\renewcommand{\dbltopfraction}{.8}% Standard = 0.7
\renewcommand{\dblfloatpagefraction}{.6}% Standard = 0.5
%
% --------------------------------------------------------------------
\tolerance 1414
\hbadness 1414
\emergencystretch 1.5em
\hfuzz 0.3pt
\widowpenalty = 2500
\displaywidowpenalty = 2500
\vfuzz \hfuzz
\raggedbottom
\DeclareOption{tanz}{\raggedbottom}
%
\ProcessOptions\relax
\deffootnote{2.25em}{1.75em}{\thefootnotemark.\enspace}
\usepackage{expl3,xparse}
%
\ExplSyntaxOn
%
\cs_new_eq:Nc \emph_old:n { emph~ }
\cs_new_eq:NN \emph_braces:n \textup
%
\cs_new:Npn \emph_new:n #1 {
\tl_set:Nn \l_emph_tl {#1}
\tl_replace_all:Nnn \l_emph_tl {(}{\emph_braces:n{(}}
\tl_replace_all:Nnn \l_emph_tl {)}{\emph_braces:n{)}}
\tl_replace_all:Nnn \l_emph_tl {[}{\emph_braces:n{[}}
\tl_replace_all:Nnn \l_emph_tl {]}{\emph_braces:n{]}}
\exp_args:NV \emph_old:n \l_emph_tl
}
%
\RenewDocumentCommand {\emph} {sm} {
\IfBooleanTF {#1} {\emph_old:n {#2}} {\emph_new:n {#2}}
}
%
\AtEveryCitekey{\RenewDocumentCommand{\emph}{m}{%
\emph_old:n {#1}}
}
\AtBeginBibliography{\RenewDocumentCommand{\emph}{m}{%
\emph_old:n {#1}}
}
\ExplSyntaxOff% syntax of expl3 on
\usepackage[iso]{isodate}
\PassOptionsToPackage{hyphens}{url}
\ifpdfoutput{% needs a KOMA-Script class!!!
\usepackage[%
,final
,kerning
,babel
,protrusion=true
,expansion=true % better typography, but with much larger PDF file
,tracking=true
]{microtype}
\DeclareMicrotypeSet*[tracking]{my}{ font = */*/*/sc/* }%
\SetTracking{ encoding = *, shape = sc }{ 45 }
%
\usepackage[%
,pdftex%
,plainpages=false%
,colorlinks%
,linkcolor={Navy}%
,citecolor={Navy}%
,linktocpage={true}%
,breaklinks%
,pdfcreator={pdflatex}%
,pdfstartview=FitH
,bookmarksopen=true% book marks in PDF reader
]{hyperref}
%
\usepackage{bookmark}% bookmark cleanup
}%
{%
\usepackage[%
,hypertex%
,linktocpage={true}%
,breaklinks%
]{hyperref}
%
% optimized margin alignment with microtype:
\usepackage[%
,final
,DVIoutput
,kerning
,babel
,protrusion=true
]{microtype}
}
%
\usepackage[figure]{hypcap} % links to the upper edge of floating environments
%
%% ============================================================================
% extended handling of figures
\usepackage[caption=false]{subfig}
%
%% ============================================================================
% intelligent cross references
\usepackage{cleveref}
%% ============================================================================
% Fonts
\usepackage{textcomp}
%
\linespread{1.05}\selectfont
\usepackage[scaled=.88]{beramono}
\usepackage[scaled=.86]{berasans}
\usepackage[sc,osf]{mathpazo}
\usepackage{amsmath}
%
\usepackage{fixmath}
\typearea[current]{last}
\usepackage{textcomp}
\usepackage{eurosym}
\catcode`\=13
\def{•}
%% ============================================================================
\usepackage{lscape}
\usepackage[active,new,noold,marker]{xrcs}
%% ============================================================================
\newcommand{\WinEdtCmd}[1]{\textcolor{CornflowerBlue}{\textsf{#1}}}
\newcommand{\WinEdtKey}[1]{\textcolor{LightSeaGreen}{\textsf{#1}}}
\newcommand{\WinEdtFile}[1]{\textcolor{DarkSlateGray}{\texttt{#1}}}
%========================================================================================
% Bibliography
%========================================================================================
%\addbibresource{References}% BibTeX
\defbibheading{bibempty}{}
\newcommand*{\refname}{Bibliography}
% -----------------------------------------------------------------------------
% Matlab Arguments
% -----------------------------------------------------------------------------
\definecolor{ocre}{RGB}{243,102,25}
\usepackage{filecontents}
\begin{filecontents*}{sample.m}
% create a file for output
!touch testFile.txt
fid = fopen('testFile.text', 'w')
for i=1:10
fprintf(fid,'%6.2f \n', i);
end
\end{filecontents*}
\usepackage[numbered,framed]{matlab-prettifier}
%\usepackage[font={color=ocre,bf},figurename=Fig.,labelfont={it}]{caption}
%\newfontfamily{\lstconsolas}{Consolas}
\newcommand\ph\mlplaceholder
\makeatletter
\renewcommand\phOpDelim@mlpr{$\langle$}
\renewcommand\phClDelim@mlpr{$\rangle$}
\makeatother
\renewcommand{\lstlistingname}{Matlab Algorithm}
\renewcommand{\lstlistlistingname}{List of \lstlistingname s}
\begin{document}
\KOMAoptions{cleardoublepage=plain}
\addtokomafont{caption}{\centering}
\frontmatter
\subject{\ }
\title{Controls}
\subtitle{Problem Set 1}
\author{\textsc{Author}}
\date{2015}
%
\lowertitleback{\VersionInformation}
\maketitle
\tableofcontents
\listoffigures
\lstlistoflistings
\mainmatter
\chapter{Problem 1}
\lstinputlisting[style=Matlab-editor,caption=Sample code from Matlab]{sample.m}
%\include{Chapters/Solution1}
\begin{lstlisting}[
style=Matlab-editor,
basicstyle=\mlttfamily,
escapechar=`,
caption={For educational purposes},
]
% example of while loop using placeholders
while `\ph{condition}`
if `\ph{something-bad-happens}`
break
else
x = 2015 + 10098 % do something useful
end
% do more things
end
\end{lstlisting}
%% ============================================================================
\backmatter
\lohead[]{}
\printbibheading[heading=bibintoc,title=\bibname]
\printbibliography[heading=subbibintoc,type=book,prefixnumbers={B},title={Books}]
\printbibliography[heading=subbibintoc,type=article,prefixnumbers={A},title={Articles}]
\printbibliography[heading=subbibintoc,type=online,prefixnumbers={O},title={Online}]
\end{document}
However, when I try to implement
\usepackage[font={color=ocre,bf},figurename=Fig.,labelfont={it}]{caption} \newfontfamily{\lstconsolas}{Consolas}
I get errors using PDF latex. Ignasi said that I cannot use PDFLaTeX for this format. How can I change the Matlab font here?

fontspec, you have to use XeLaTeX or LuaLaTeX, there's no getting around that. But there are other ways to select fonts thanfontspec. Which type of solution are you looking for? – Paul Gessler Jun 15 '15 at 20:07fontspec(if so, you need to usexelatexorlualatex) or do you want some way to use Consolas inpdflatex? – Paul Gessler Jun 16 '15 at 02:33otftotfm. pdfTeX requires a number of files in order to use the font:.tfmfiles, an addition to the.mapfiles, the fonts themselves etc. For LaTeX, you need.fdfiles and, ideally, a.styfile as well. In some cases,.vffiles may also be either required or easier to work with. How badly do you want to use this font and how badly do you want to stick to pdfTeX?! – cfr Jun 18 '15 at 01:58