5

I need to fix this warnings with saving of Times New Roman and sizes of it.

Warnings:

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.

Test code:

\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}
Bernard
  • 271,350
Armoken
  • 69
  • I’d also suggest removing newtxmath. Replace it with \usepackage{unicode-math} and \setmathfont{TeX Gyre Termes Math}. – Davislor Jul 01 '19 at 03:46
  • @Davislor, test code in my question is a part of big latex project, where newtxmath fix a lot of warnings: LaTeX Font Warning: Font shapeOML/ftm/m/n' undefined LaTeX Font Warning: Font shape OMS/ftm/m/n' undefined LaTeX Font Warning: Font shapeOML/ftm/m/n' in size <29.86> not available LaTeX Font Warning: Font shape OML/ftm/m/n' in size <14.93> not available LaTeX Font Warning: Font shapeOMS/ftm/m/n' in size <29.86> not available LaTeX Font Warning: Font shape OMS/ftm/m/n' in size <14.93> not available – Armoken Jul 01 '19 at 13:21
  • Adding the other commands I recommended should, if everything else is working, remove those warnings. – Davislor Jul 01 '19 at 13:53
  • 1
    You’re including a lot of of different font commands that conflict with each other. I’m guessing that you copied these from different documents. In particular, you copied some document that sets the math alphabets to some non-standard font family named ftm that you don’t have. This is breaking, so you’re working around it by loading a different font package over it. You should delete all the font commands you don’t actually need. – Davislor Jul 01 '19 at 14:30
  • @Davislor, I remove using of mathtext, because it was really useless, and remove \renewcommand{\rmdefault}{ftm} because it has no effect. Now I have only Warning: Font shapeT1/TimesNewRoman(1)/m/n' undefineddue lstlisting style, where used\small` size of font – Armoken Jul 04 '19 at 06:01
  • @Armoken All the packages egreg mentioned are redundant if you’re loading polyglossia. They’re legacy 8-bit fonts, and polyglossia brings in Unicode. You end up setting the current font encoding to T1 when you’re using a Unicode font. Also redundant: \setromanfont.if you already have \setmainfont. – Davislor Jul 04 '19 at 08:43
  • @Davislor, I did what you said, but the warning didn't disappear, but I remove \fontencoding{T1} from setting basicstyle of lstlisting and it disappeared. But now I have strange looking russian words, but as said in link addition of texcl = true to lst style fix it. – Armoken Jul 04 '19 at 16:13
  • Add [Script=Cyrillic] after the definitions of \cyrillicfont, \cyrillicfontsf, etc. Delete the lines defining \romanfont and \cyrillicfontrm; they’re synonymous with the main font in polyglossia. If you end up with Russian words that are intelligible, but look “strange” to you, that’s just what the font you selected looks like. You can pick another \cyrillicfont. – Davislor Jul 04 '19 at 17:21
  • In general, it’s a bad idea to mix legacy 8-bit font encodings or packages and modern Unicode fonts in the same document. You can, but it’s complicated and normally unnecessary. If you’re setting your fonts with polyglossia, you don’t want to load any legacy font packages, too. If you’re loading Unicode, you don’t want to switch to any 8-bit encoding. – Davislor Jul 04 '19 at 18:26

1 Answers1

1

With the help of @Davislor and @egreg I fix my code. The correct version of code:

\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}
Armoken
  • 69