GeneralFont substitution warnings during compilation

LaTeX specific issues not fitting into one of the other forums of this category.
User avatar
Cham
Posts: 937
Joined: Sat Apr 02, 2011 4:06 pm

Font substitution warnings during compilation

Post by Cham »

While compiling a very large LaTeX document, I'm getting lots of warnings about font substitution, and I don't understand what is happening. Here are some typical warning messages :
LaTeX Font Warning: Font shape `U/stmry/b/n' undefined
(Font) using `U/stmry/m/n' instead on input line 15.
...
LaTeX Font Warning: Font shape `T1/lmr/bx/sc' undefined
(Font) using `T1/lmr/bx/n' instead on input line 18.
...
LaTeX Font Warning: Some font shapes were not available, defaults substituted.
The document compiles fine, and the PDF output appears to be okay.

I was able to isolate some parts which gives the warnings and created a MWE to show the "problem" (I'm not even sure this is really a problem). Take note there's a dummy_picture in there, and I don't know how to create a compilable MWE with a pict, so I turned OFF the includegraphics directive :

Code: Select all

\documentclass[12pt,letterpaper,twoside]{book}
\usepackage[T1]{fontenc}
\usepackage[french]{babel}
\usepackage{lmodern}
\usepackage{amsmath}
\usepackage{upgreek}
\usepackage{stmaryrd}
\usepackage{graphicx}
\usepackage{subfig}
\captionsetup{margin=1cm,format=hang,font=small,format=plain,labelfont={bf,up},textfont={it}}

\begin{document}
\chapter{Test}
Font substitution here : $\boldsymbol{\upomega}$
	\begin{figure}
		%\includegraphics[height=5cm]{dummy_picture}
		\caption[Inversion spatiale]{Inversion spatiale.} % Font substitution here ?
	\end{figure}
\end{document}
So I need advices and opinions about these messages.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

Stefan Kottwitz
Site Admin
Posts: 10345
Joined: Mon Mar 10, 2008 9:44 pm

Font substitution warnings during compilation

Post by Stefan Kottwitz »

Font shape `U/stmry/b/n' undefined:

stmaryrd doesn't support bold so well, that's why you get the warning. You can get rid of the warning if you would specify to also use the medium weight for bold. The symbol still comes out bold when \boldsybol is used.

Code: Select all

\SetSymbolFont{stmry}{bold}{U}{stmry}{m}{n}
Font shape `T1/lmr/bx/sc' undefined:

Your caption label font is bold, done by labelfont={bf,up}. It's already in small caps, but Latin Modern doesn't provide bold small caps. Remove that bf to see that you would get small caps FIGURE, and the warning would go away.

The same would happen if you would use

\usepackage{lmodern}

by

\usepackage{kpfonts}

because the Kepler fonts provide this shape. Some combinations, such as bold small caps, are not very common and not well supported. One reason is, that twice emphasizing is often considered as being too much.

Stefan
LaTeX.org admin
User avatar
Cham
Posts: 937
Joined: Sat Apr 02, 2011 4:06 pm

Font substitution warnings during compilation

Post by Cham »

Ah ! I see for the figures. Now, I'm not sure anymore if my figures should use caps only, or up bold. I have a choice to make, I guess.

But I don't understand the symbol case. What should I change in my preamble to solve the warning "problem" ?

And what about that warning message (not from the MWE code above) ?
LaTeX Font Warning: Font shape `T1/qzc/m/n' in size <10.95> not available
(Font) Font shape `T1/qzc/m/it' tried instead on input line 45.
User avatar
Stefan Kottwitz
Site Admin
Posts: 10345
Joined: Mon Mar 10, 2008 9:44 pm

Font substitution warnings during compilation

Post by Stefan Kottwitz »

Cham wrote:What should I change in my preamble to solve the warning "problem" ?
Use the line I wrote above, or ignore as it works.
Cham wrote:And what about that warning message (not from the MWE code above) ?
LaTeX Font Warning: Font shape `T1/qzc/m/n' in size <10.95> not available
(Font) Font shape `T1/qzc/m/it' tried instead on input line 45.
Similar, there's no "normal" shape. Its native shape is italic, I think.

Stefan
LaTeX.org admin
User avatar
Cham
Posts: 937
Joined: Sat Apr 02, 2011 4:06 pm

Re: Font substitution warnings during compilation

Post by Cham »

Ok, now I understand it better.

Another question : how can I remove the caps for the figures, and use only bf, without having any warnings ?
User avatar
Cham
Posts: 937
Joined: Sat Apr 02, 2011 4:06 pm

Font substitution warnings during compilation

Post by Cham »

I may have found a solution to my last question above :

Adding the option figurename=Figure removes the small caps font and all the related warnings. So I'm using this setup :

Code: Select all

\captionsetup{figurename=Figure,margin=1cm,format=hang,font=small,format=plain,labelfont={bf,up},textfont={it}}
If we want back the small caps, we just have to change labelfont={bf,up} to labelfont={sc,up}.
User avatar
Cham
Posts: 937
Joined: Sat Apr 02, 2011 4:06 pm

Font substitution warnings during compilation

Post by Cham »

I found a last font warning during compilation :
LaTeX Font Warning: Font shape `T1/qzc/m/n' in size <10.95> not available
(Font) Font shape `T1/qzc/m/it' tried instead on input line 45.
Now, I can't find any line 45 with something related to that message !

In the chapter 1, which seems to be indicated by the compilation code, there's simply nothing at line 45 ! Before and after that empty line, there's only a few lines of normal text code and a subsubsection :

Code: Select all

Un endomorphisme est une application agissant sur un ensemble $\mathcal{A}$ redonnant des éléments de l'ensemble de départ.  Autrement dit ; $\displaystyle{f : \mathcal{A} \rightarrow \mathcal{A}}$.  Les transformations de similarité des matrices carrées, de la forme $\displaystyle{M' = T M \1 T^{-\1 1}}$ ($T$ étant une matrice carrée de même taille que $M$), redonnent des matrices carrées de même dimension et constituent de ce fait un endomorphisme.
% This is line 45 !

\subsubsection{Fonctions analytiques}\index{fonction@fonction!analytique}
What is going on here ?
User avatar
Johannes_B
Site Moderator
Posts: 4182
Joined: Thu Nov 01, 2012 4:08 pm

Re: Font substitution warnings during compilation

Post by Johannes_B »

You should try to make a minimal working example, a mere code snippet is never helpful.

Maybe the mathcal switches to chorus, i don't know.
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.
User avatar
Stefan Kottwitz
Site Admin
Posts: 10345
Joined: Mon Mar 10, 2008 9:44 pm

Font substitution warnings during compilation

Post by Stefan Kottwitz »

I think your \mathcal is defined to use TeX Gyre Chorus (LaTeX package tgchorus). It can be finally said once I the code is seen here.

Stefan
LaTeX.org admin
User avatar
Cham
Posts: 937
Joined: Sat Apr 02, 2011 4:06 pm

Font substitution warnings during compilation

Post by Cham »

Ok, I finally found the source of my last font substitution warning : an epigraph.

Here's a MWE of the problem.

Code: Select all

\documentclass[12pt,letterpaper,twoside]{book}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[french]{babel}
\usepackage{epigraph}
\renewcommand{\textflush}{flushleft}
\setlength{\epigraphrule}{0pt}
\newcommand*{\chancery}{\usefont{T1}{qzc}{m}{n}\selectfont}
\newcommand{\epig}[2]{\epigraphhead[70]{\epigraph{\chancery{#1}}{\chancery\textit{#2}}}}

\begin{document}
\chapter{test}

\epig{This is an epigraph}{John Doe}

\end{document}
The code compiles fine, but I get the following warning message :
LaTeX Font Warning: Font shape `T1/qzc/m/n' in size <10.95> not available
(Font) Font shape `T1/qzc/m/it' tried instead on input line 16.
So what is the mistake in that code ? What is the solution to remove that "insolent" warning ?

Just for the epigraphs (one at the start of each chapter), what nice font would you suggest ? How to edit the code above ?

EDIT : Doh ! Changing the command \usefont{T1}{qzc}{m}{n} to \usefont{T1}{qzc}{m}{it} solves the issue.

But really, I dont understand that command line. What is {n} anyway ? normal ?

And still, what font style would you suggest for some nice looking epigraphs ?
Post Reply