Given this simple LaTeX code

\documentclass [spanish] {book}



I get the warning Font shape `T1/lmr/bx/sc' undefined(Font) using `T1/lmr/bx/n' instead`

I'm writing in spanish and using lots of TikZ, so I have to be careful not to spoil the pictures. How do I get rid of it? What am I doing wrong with fonts?

  • 1
    Your document or class wants to use small caps, but your font doesn't have any. It should be safe to ignore this warning, LaTeX automatically uses the regular font. – Ingmar Nov 29 '20 at 10:42
  • The example doesn't produce the warning. – egreg Nov 29 '20 at 10:51
  • 1
    To be more precise, somewhere you're trying to use bold (extended) small caps, which aren't available in lmodern. Either pick another font which has them (e.g., kpfonts does), or stick with lmodern and use the automatic substitution to use normal bold (extended) instead. – Skillmon Nov 29 '20 at 10:53
  • @egreg I do have it. I think it is because the format tries to use bold small caps for the index roman numeral... – Rmano Nov 29 '20 at 11:19
  • @egreg you need to compile twice to get the bold roman numeral in the toc. – Ulrike Fischer Nov 29 '20 at 15:04

A warning is unavoidable, unless much lower level code is used.

The issue is that babel-spanish, by default, wants to use small caps Roman numerals instead of lowercase ones like in English.

However the Latin Modern fonts, contrary to European Modern (the default for the T1 encoding) don't have a boldface small caps font. Thus babel-spanish uses a trick: it fakes the font by using capital letters from the normal boldface font, but at a reduced size (the size corresponding to subscripts).

You have three strategies. The first two strategies require some code to add before \begin{document}.

Strategy 1

Substitute the Latin Modern nonexistent font with the corresponding one in European Modern.

  \global\expandafter\let\csname T1/lmr/bx/sc/10\expandafter\endcsname\the\font

Disadvantage: you need to do this for every font size you need. For the TOC, which is the real problem, just 10 is needed (or 10.95 with the 11pt option, or 12 for the 12pt option).

Strategy 2

Since you know that the faked small caps Roman numerals will be used, avoid the checking business that just produce the annoying warnings.

%% lmodern has no boldface small caps and we know it
%% so we avoid all the warnings related to the faking business

Strategy 3

Use uppercase Roman numerals.


As @Skillmon said, the "problem" is that somewhere you are trying to use a font that the lmodern suite does not have (something bold in a part title maybe? I do not know), so a substitution is done.

If you are happy with the substitution, you can just hide the warning under the carpet. Given that the warning(s) are:

LaTeX Font Warning: Font shape `T1/lmr/bx/sc' undefined
(Font)              using `T1/lmr/bx/n' instead on input line 2.

Package spanish Warning: Replacing `T1/lmr/bx/sc' by 
(spanish)                faked small caps on input line 2.

LaTeX Font Warning: Some font shapes were not available, defaults substituted.

you can use this before your \documentclass:

\WarningFilter{latexfont}{Font shape `T1/lmr/bx/sc'}
\WarningFilter{spanish}{Replacing `T1/lmr/bx/sc'}
% I normally leave that last one alone, as a reminder I am shoving
% things under the carpet, but well...
\WarningFilter{latexfont}{Some font shapes were}

...and hala, no warnings ;-)

(This is cheating, though, so use it sparingly and only if you are sure about it).

On a side note, PGF-Tikz has nothing to do with this!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.