3

I'm caught in the crossfire between an author and a publisher with an unpleasant sty file :-) The publisher redefines \normalsize to be 9.5pt and changes the math sizes correspondingly. Using lmodern this is not a problem for most symbols, but there are issues with bbm and mathrsfs. The code

\documentclass{article}

\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage{mathrsfs,bbm}

\makeatletter
% taken from the sty file I must use
\renewcommand\normalsize{%
   \@setfontsize\normalsize{9.5}{13}%
   \abovedisplayskip9.5\p@\@plus2\p@\@minus5\p@
   \abovedisplayshortskip\z@\@plus3\p@
   \belowdisplayshortskip6\p@\@plus3\p@\@minus3\p@
   \belowdisplayskip\abovedisplayskip
   \let\@listi\@listI}
\DeclareMathSizes{9.5}{9.5}{\@viipt}{\@vpt}
\makeatother

\begin{document}

Hello world $\mathbbm{N}$, $\mathscr{B}$

\end{document}

returns the understandable warnings

LaTeX Font Warning: Font shape `U/rsfs/m/n' in size <9.5> not available
(Font)              size <9> substituted on input line 22.


LaTeX Font Warning: Font shape `U/bbm/m/n' in size <9.5> not available
(Font)              size <9> substituted on input line 22.


LaTeX Font Warning: Size substitutions with differences
(Font)              up to 0.5pt have occurred.

Assuming that I cannot change the font and considering that optically both \mathbbm{N} and $\mathscr{B} look fine (the difference between 9pt and 9.5pt isn't overwhelming), is there a way to tell TeX to use the 9pt size for \mathbbm and \mathscr? Or is there a way to suppress the warnings for these two math alphabets?

campa
  • 31,130

1 Answers1

5

You could use the following “second-layer” patch:

\documentclass{article}

\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage{mathrsfs,bbm}

\makeatletter

% taken from the sty file I must use
\renewcommand\normalsize{%
   \@setfontsize\normalsize{9.5}{13}%
   \abovedisplayskip9.5\p@\@plus2\p@\@minus5\p@
   \abovedisplayshortskip\z@\@plus3\p@
   \belowdisplayshortskip6\p@\@plus3\p@\@minus3\p@
   \belowdisplayskip\abovedisplayskip
   \let\@listi\@listI}
\DeclareMathSizes{9.5}{9.5}{\@viipt}{\@vpt}

\makeatother

% further patch:
% Adapted from "ursfs.fd":
\DeclareFontFamily{U}{rsfs}{\skewchar\font127 }
\DeclareFontShape{U}{rsfs}{m}{n}{%
   < -6> rsfs5
   <6-8> rsfs7
   <8- > rsfs10
}{}

% Adapted from "ubbm.fd":
\DeclareFontFamily{U}{bbm}{}
\DeclareFontShape{U}{bbm}{m}{n}
   {  <5> <6> <7> <8> <9> <10> <12> gen * bbm
      <9.5> bbm9 % <<< ADDED
      <10.95> bbm10%
      <14.4>  bbm12%
      <17.28><20.74><24.88> bbm17}{}
\DeclareFontShape{U}{bbm}{m}{sl}
   {  <5> <6> <7> bbmsl8%
      <8> <9> <10> <12> gen * bbmsl
      <9.5> bbmsl9 % <<< ADDED
      <10.95> bbmsl10%
      <14.4> <17.28> <20.74> <24.88> bbmsl12}{}
\DeclareFontShape{U}{bbm}{bx}{n}
   {  <5> <6> <7> <8> <9> <10> <12> gen * bbmbx
      <9.5> bbmbx9 % <<< ADDED
      <10.95> bbmbx10%
      <14.4> <17.28> <20.74> <24.88> bbmbx12}{}
\DeclareFontShape{U}{bbm}{bx}{sl}
   {  <5> <6> <7> <8> <9>
      <9.5> % <<< ADDED
      <10> <10.95> <12> <14.4> <17.28>%
      <20.74> <24.88> bbmbxsl10}{}
\DeclareFontShape{U}{bbm}{b}{n}
   {  <5> <6> <7> <8> <9>
      <9.5> % <<< ADDED
      <10> <10.95> <12> <14.4> <17.28>%
      <20.74> <24.88> bbmb10}{}



\begin{document}

Hello world $\mathbbm{N}$, $\mathscr{B}$

\Huge

Hello world $\mathbbm{N}$, $\mathscr{B}$

\footnotesize

Hello world $\mathbbm{N}$, $\mathscr{B}$

\end{document}

Note, however, that I cannot find any mention of the bbm fonts in my pdftex.map file, and indeed, when I compile your example, pdftex uses PK fonts (bbm9.600pk) for characters drawn from that font. This means that an outline version of those fonts is not available, so the use of the trick shown above entails the creation, run-time, of new PK fonts for the every new size that is actually used.

GuM
  • 21,558
  • Sorry to nag (I never really understood how LaTeX handles fonts): I tried and it works also without adding the line <9.5> bbm9 but just adding <9.5> between <9> and <10> (I hope you understand what I mean). Is it the same? – campa Jan 19 '18 at 16:28
  • 1
    @campa: Not quite: if you say <9.5>bbm9 <10.95>bbm10, the 9-points font bbm9 will be used for a size request of 9.5 points, scaling it up a tiny bit; on the other hand, if you say <9.5> <10.95>bbm10, the 10-points font bbm10 (the same being used for a request of 10.95 points) will be used for a size request of 9.5 points, scaling it down a tiny bit. You can take your pick: both alternatives are perfectly viable. – GuM Jan 20 '18 at 00:16
  • Thanks for the info, but that's not yet quite what I'd like to know: I meant to place it in the first line between <9> and <10>, the one with gen * bbm. What would that do? – campa Jan 22 '18 at 08:33
  • 1
    @campa: I did suspect that you could mean that, but actually is does not what you may expect and works, as it were, “by accident”: the NFSS (New Font Selection Scheme) documentation says that fractionary sizes like 9.5 should not be used with the gen function, since a TFM file name like bbm9.5.tfm is not allowed. It turns out the bbm9.tfm it used and scaled at 9.5 all the same, but I wouldn’t rely on this and I would not recommend your solution. – GuM Jan 22 '18 at 23:28