I'd like to typeset a document in MLModern's fonts (serif, sans serif, teletype, etc.), then later change the teletype font to a different custom font whose TTF I provide (Iosevka, in the example below). This is my attempt at doing it using fontspec, compiling with LuaLaTex:
\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage{fontspec}
\usepackage{mlmodern}
\begin{document}
%\setmainfont{MLModern}
This should be in MLModern's roman font.
\texttt{This should be in MLModern's teletype font.}
\setmonofont{iosevka.ttf}
\texttt{This should be in Iosevka.}
\end{document}
Having loaded the mlmodern
package, I expected the default font to be MLModern, but the first line seems to be in Latin Modern instead.
Curiously, the second line is also in roman and not teletype.
(Third line is fine.)
If I try to set the main font to MLModern with the commented out line above, compilation doesn't succeed:
This is LuaHBTeX, Version 1.13.2 (TeX Live 2021/Arch Linux)
restricted system commands enabled.
(./main.tex
LaTeX2e <2021-11-15> patch level 1
L3 programming layer <2021-11-22>
(/usr/share/texmf-dist/tex/latex/base/article.cls
Document Class: article 2021/10/04 v1.4n Standard LaTeX document class
(/usr/share/texmf-dist/tex/latex/base/size10.clo))
(/usr/share/texmf-dist/tex/latex/base/fontenc.sty
(/usr/share/texmf-dist/tex/latex/lm/t1lmr.fd))
(/usr/share/texmf-dist/tex/latex/fontspec/fontspec.sty
(/usr/share/texmf-dist/tex/latex/l3packages/xparse/xparse.sty
(/usr/share/texmf-dist/tex/latex/l3kernel/expl3.sty
(/usr/share/texmf-dist/tex/latex/l3backend/l3backend-luatex.def)))
(/usr/share/texmf-dist/tex/latex/fontspec/fontspec-luatex.sty
(/usr/share/texmf-dist/tex/latex/base/fontenc.sty)
(/usr/share/texmf-dist/tex/latex/fontspec/fontspec.cfg)))
(/usr/share/texmf-dist/tex/latex/mlmodern/mlmodern.sty)
LaTeX Font Warning: Font shape `TU/mlmr/m/n' undefined
(Font) using `TU/lmr/m/n' instead on input line 7.
(./main.aux) (/usr/share/texmf-dist/tex/latex/base/ts1cmr.fd)
luaotfload | db : Reload initiated (formats: otf,ttf,ttc); reason: Font "MLModern" not found.
Other names I've tried are mlmodern
and mlm
, with the same result. How do I set the main font to MLModern then?