I need italic and non-italic \lambda
in the same document. Since the \mathit{\lambda}
does not work, I got idea to simulate italic by changing fonts (Times New Roman for italic lambda, and Latin Modern for non-italic).
I made the following example based on answers from here and here
\documentclass{article}
\usepackage{amsmath}
\usepackage{lmodern} % set math font to Latin modern math
\usepackage[T1]{fontenc}
\renewcommand\rmdefault{ptm} %change text font to Times New Roman
\DeclareMathVersion{mymath}
\DeclareSymbolFont{myletters}{T1}{ptm}{m}{it}
\SetSymbolFont{letters}{mymath}{T1}{ptm}{m}{it}
\DeclareSymbolFont{myoperators}{T1}{ptm}{m}{n}
\SetSymbolFont{operators}{mymath}{T1}{ptm}{m}{n}
\newenvironment{myfont}{\mathversion{mymath}}{}
\DeclareTextFontCommand{\mathmyfont}{\myfont}
% Define lambda with Times New Roman font
\newcommand{\lambdaTimes}{\mathmyfont{$\lambda$}}
\begin{document}
\begin{align}
\textrm{Lambda in Latin modern:} \lambda \\
\textrm{Lambda in Times New Roman:}\lambdaTimes
\end{align}
\end{document}
This example does not work, it produce -
instead of lambda in Times font. What is wrong in this example?
Is there a easier way to make italic and non-italic lambda in the same document?
P.S. I am using Times New Roman in text mode, and Latin modern in math mode in document.