[Tex/LaTex] How to make italic greek letter \lambda

fontsgreekitalicmath-mode

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.

Best Answer

Latin Modern math doesn't blend with Times New Roman. You're better using NewTX:

\documentclass{article}
\usepackage{newtxtext,newtxmath}

\begin{document}

The text is in Times; $\lambda\lambdaup$.

\end{document}

enter image description here

If you insist in using Latin Modern math symbols, here's how you can do:

\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

\DeclareSymbolFont{myletters}{OML}{ztmcm}{m}{it}
\DeclareMathSymbol{\uplambda}{\mathord}{myletters}{"15}

\begin{document}

\begin{align}
\textrm{Lambda in Latin modern:} \lambda \\
\textrm{Lambda in Times New Roman:}\uplambda
\end{align}
\end{document}

enter image description here