使用 LuaLaTeX 進行等寬 KP

使用 LuaLaTeX 進行等寬 KP

如何使用 fontspec 將 KP 等寬字體設定為 tt 字體?

我試過這個:

\documentclass{article}
\usepackage{fontspec}
\setmonofont{KP-monospaced}
\begin{document}
\texttt{120 test}
\end{document}

但這不起作用

答案1

我不確定這是正確的方法,但以下方法似乎對我有用,只需很少的測試。買者自負...

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage{fontspec}
\makeatletter
\DeclareRobustCommand\ttfamily{%
  \not@math@alphabet\ttfamily\mathtt
  \fontencoding{T1}\fontfamily\ttdefault\selectfont}
\makeatother
\renewcommand{\ttdefault}{jkptt}
\begin{document}
  \texttt{120 test}
\end{document}

相關內容