我需要通过保存 Times New Roman 及其大小来修复此警告。
警告:
LaTeX Font Warning: Font shape `TU/ftm/m/n' undefined
(Font) using `TU/lmr/m/n' instead on input line 49.
LaTeX Font Warning: Font shape `PD1/ftm/m/n' undefined
(Font) using `PD1/pdf/m/n' instead on input line 51.
LaTeX Font Info: Try loading font information for PU+ftm on input line 51.
LaTeX Font Info: No file PUftm.fd. on input line 51.
LaTeX Font Warning: Font shape `PU/ftm/m/n' undefined
(Font) using `PU/pdf/m/n' instead on input line 51.
LaTeX Font Info: Try loading font information for T1+TimesNewRoman(1)
on input line 54.
LaTeX Font Info: No file T1TimesNewRoman(1).fd. on input line 54.
LaTeX Font Warning: Font shape `T1/TimesNewRoman(1)/m/n' undefined
(Font) using `T1/cmr/m/n' instead on input line 54.
测试代码:
\documentclass[a4paper,14pt,russian,oneside,final]{extreport}
\usepackage{xltxtra}
\usepackage{courier}
\usepackage{lmodern}
\usepackage{tempora}
\usepackage{newtxmath}
\usepackage[T1,T2A]{fontenc}
\usepackage{polyglossia}
\defaultfontfeatures{Ligatures = TeX, Mapping = tex-text}
\setmainlanguage[babelshorthands = true]{russian}
\setotherlanguage{english}
\setmainfont{Arial}
\setmonofont{Courier New}
\setromanfont{Times New Roman}
\setsansfont{Arial}
\newfontfamily\cyrillicfont{Times New Roman}
\newfontfamily\cyrillicfontrm{Times New Roman}
\newfontfamily\cyrillicfontsf{Arial}
\newfontfamily\cyrillicfonttt{Courier New}
\newfontfamily\englishfont{Times New Roman}
\newfontfamily\englishfontrm{Times New Roman}
\newfontfamily\englishfontsf{Arial}
\newfontfamily\englishfonttt{Courier New}
\usepackage{mathtext}
\usepackage{extsizes}
\renewcommand{\rmdefault}{ftm}
\usepackage[final,hidelinks]{hyperref}
\renewcommand{\UrlFont}{\small\rmfamily\tt}
\usepackage[final]{listings}
\lstdefinestyle{C}{
xleftmargin = 1.25cm,
basicstyle = \fontencoding{T1}\small\ttfamily,
breaklines = true,
columns = fullflexible
}
\begin{document}
\section{Test section}
\url{http://stackoverflow.com/}
\begin{center}
\begin{lstlisting}[style=C]
#include <stdio.h>
int main()
{
printf("Hello, World!");
return 0;
}
\end{lstlisting}
\end{center}
\end{document}
答案1
在@Davislor 和 @egreg 的帮助下,我修复了我的代码。正确的代码版本:
\documentclass[a4paper,14pt,russian,oneside,final]{extreport}
\usepackage{newtxmath}
\usepackage{polyglossia}
\defaultfontfeatures{Ligatures = TeX, Mapping = tex-text}
\setmainlanguage[babelshorthands = true]{russian}
\setotherlanguage{english}
\setmainfont{Times New Roman}
\setmonofont{Courier New}
\setsansfont{Arial}
\newfontfamily\cyrillicfont{Times New Roman}
\newfontfamily\cyrillicfontsf{Arial}
\newfontfamily\cyrillicfonttt{Courier New}
\newfontfamily\englishfont{Times New Roman}
\newfontfamily\englishfontsf{Arial}
\newfontfamily\englishfonttt{Courier New}
\usepackage[final,hidelinks]{hyperref}
\renewcommand{\UrlFont}{\small\rmfamily\tt}
\usepackage[final]{listings}
\lstdefinestyle{C}{
xleftmargin = 1.25cm,
basicstyle = \small\ttfamily,
breaklines = true,
columns = fullflexible,
texcl = true
}
\begin{document}
\section{Test section}
\en{\url{http://stackoverflow.com/}}
\begin{center}
\begin{lstlisting}[style=C]
#include <stdio.h>
int main()
{
printf("Hello, World!");
return 0;
}
\end{lstlisting}
\end{center}
\end{document}