I want to customize the style of Matlab-editor in matlab-prettifier package. What I want is to produce background for MATLAB styled commands, but it does not seem that basicstyle key accepts commands with arguments
It is possible to get this by creating custom commands such as in
Different background colors for lstinline
However, I would rather use \lstinline command directly because I want TeXstudio to highlight verbatim code. This topic seems to contain what I want, but I need to adapt it for my specific needs
listings lstdefinestyle not work with custom defined command
This is the result I want
\documentclass[aspectratio=169, xcolor={x11names}, t, handout]{beamer}
\usetheme{Dresden}
\usefonttheme{professionalfonts}
\renewcommand{\sfdefault}{ppl}
\usepackage[T1]{fontenc}
\renewcommand{\encodingdefault}{T1}
\usepackage{bigstrut}
\usepackage[]{matlab-prettifier}
% BEGIN_FOLD
\lstdefinestyle{matlab-inline}{
% style
style=Matlab-editor, % default style for matlab pretification
basicstyle=\linespread{0.8}\mlttfamily\color{DodgerBlue3}, % font style and size
}
% END_FOLD
\usepackage{tikz}
\newcommand{\matlabinline}[1]
{%
\begin{tikzpicture}[baseline]
\node[fill=Ivory1, inner sep=0mm, outer sep=0mm, inner xsep=0mm, inner ysep=1pt, opacity=0.75, anchor=base] (node) {\bigstrut#1};
\end{tikzpicture}%
}
\begin{document}
\begin{frame}[fragile, environment=frame, allowframebreaks=0.99]
\smash{\rlap{\vrule width 0.1pt depth 0em height 0.75em}}%
\smash{\rlap{\rule{\linewidth}{0.1pt}}}%
\matlabinline{\lstinline[style=matlab-inline]|plot(X1, Y1, LineSpec1)|} \lstinline[style=matlab-inline]|plot(X1, Y1, LineSpec1)|
\end{frame}
\end{document}

\lstinline[style=matlab-inline]|plot(X1, Y1, LineSpec1)|to have the identical result as the first line\matlabinline{\lstinline[style=matlab-inline]|plot(X1, Y1, LineSpec1)|}? – user202729 Jan 28 '23 at 08:01