10

In my document \bfseries is defined to select the "semibold" shape, however the typewriter family (beramono) does not have a "semibold" shape. So I receive a warning:

LaTeX Font Warning: Font shape `T1/fvm/sb/n' undefined
(Font)              using `T1/fvm/m/n' instead on input line 250.

I tried the solution discussed here by using the follwoing command to declare a new font shape for typewriter family.

\DeclareFontShape{T1}{fvm}{sb}{n}{<->ssub*fvm/b/n}{}

or

\DeclareFontShape{\encodingdefault}{\ttdefault}{sb}{n}{<->ssub*\ttdefault/b/n}{}

And for both commands I received the follwoing error:

! LaTeX Error: Font family `T1+fvm' unknown.

A working example is:

\documentclass{report}
\usepackage[T1]{fontenc}

\usepackage[oldstyle,semibold,type1]{libertine}
\usepackage[scaled=.85]{beramono}% typewriter font 

\DeclareFontShape{T1}{fvm}{sb}{n}{<->ssub * fvm/b/n}{}

\begin{document}

\ttfamily\bfseries Hello World!

\end{document}
5
  • You have to issue an appropriate \DeclareFontFamily command before any \DeclareFontShape related to it.
    – egreg
    Jan 30, 2013 at 9:58
  • @egreg, the font familiy is available in the documnet. I thought it should be declared by the package beramono. If I go to declare the font family, I should also declare the bold shape and maybe different sizes fot it. Is there an easy way to copy bold shape as semi-bold?
    – Aydin
    Jan 30, 2013 at 10:52
  • The \DeclareFontFamily command is in the .fd file that's not read until some text has to be typeset with a font from that family. Can you add a minimal working example (MWE)?
    – egreg
    Jan 30, 2013 at 10:55
  • @Aydin You can just load the .fd file with \input before issuing your \DeclareFontShape. Jan 30, 2013 at 10:59
  • @StephanLehmke, thanks alot, adding .fd solved the problem.
    – Aydin
    Jan 30, 2013 at 11:41

2 Answers 2

8

LaTeX needs to see a \DeclareFontFamily declaration before a \DeclareFontShape command can be issued.

A simple way out is to add

\sbox0{\ttfamily X}

after \usepackage[<options>]{beramono}, which will cause the corresponding .fd file to be read in, which contains the appropriate \DeclareFontFamily command.

1
  • 4
    It is not necessary to use a box. A simple \ttfamily or (if you fear side effects) a local {\ttfamily} is enough to trigger the loading of the fd-file. Jan 30, 2013 at 14:39
4

Thanks to egreg and Stephan, loading the .fd file before \DeclareFontShape solved the problem.

\documentclass{report}
\usepackage[T1]{fontenc}

\usepackage[oldstyle,semibold,type1]{libertine}
\usepackage[scaled=.85]{beramono}% typewriter font 

\makeatletter
\input{t1fvm.fd}
\makeatother

\DeclareFontShape{T1}{fvm}{sb}{n}{<->ssub * fvm/b/n}{}

\begin{document}

\ttfamily\bfseries Hello World!

\end{document}
2
  • 1
    You can force the loading also with \sbox0{\ttfamily X}
    – egreg
    Jan 30, 2013 at 11:48
  • @egreg, thanks. I will do so, as it's more general.
    – Aydin
    Jan 30, 2013 at 12:00

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .