I want to append some matlab code to a tex document and I use the matlab-prettifier package for that. I updated my miktex installation yesterday and I am now forced to use the \UseRawInputEncoding code line. Everything works fine for the German and Latin symbols I have in my matlab code, except for the degree sign, which comes out as an r with an inverted hat above, regardless of whether I use the literate substitution approach or not. Any suggestions on how to solve this elegantly would be welcome.
Here is my MWE:
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[framed,numbered]{matlab-prettifier}
\usepackage{textcomp}
\UseRawInputEncoding
\begin{document}
\lstset{
language=Matlab,
style=Matlab-editor,
basicstyle=\mlttfamily\footnotesize,
literate=%
{°}{\textdegree{}}1%
}
\lstinputlisting[]{matlab_code.m}
\end{document}
and my matlab_code.m file reads as:
% ----------------------------
% Rö and Mé (T = 23°C)
var_1 = 10;
Obviously, I can write degree instead of ° in the matlab file and substitute that by \textdegree, but I would like to bring changes to the matlab code to a minimum and actually use the degree symbol, whose use comes much more naturally than that of the corresponding text. Is it possible to directly read in tex and via matlab-prettifier a ° symbol written on a matlab file, rather than "going around" by substituting the corresponding degree text by the actual symbol?