我过去曾使用 Matlab-Prettifier 来格式化我的 Matlab 代码,但从 ShareLaTeX 移出并进入本地环境后,我似乎无法获取 Bera Mono 字体。例如,代码...
\documentclass[11pt]{article}
% Matlab-Prettifier Setup
\usepackage{listings}
\usepackage{xcolor}
\usepackage[T1]{fontenc}
\usepackage[numbered,framed]{matlab-prettifier}
\let\ph\mlplaceholder % shorter macro
\lstMakeShortInline"
\lstset{
style = Matlab-editor,
basicstyle = \mlttfamily,
mlshowsectionrules = true
}
\begin{document}
\begin{lstlisting}[
style=Matlab-editor,
basicstyle=\mlttfamily,
escapechar=`,
caption={For educational purposes},
]
if a == b
a
end
\end{lstlisting}
\end{document}
... 产生不带 Bera 字体的输出: