LaTeX forum ⇒ Graphics, Figures & TablesSmall font glitch in redefining caption label Topic is solved

Information and discussion about graphics, figures & tables in LaTeX documents.
User avatar
Cham
Posts: 813
Joined: Sat Apr 02, 2011 4:06 pm

Small font glitch in redefining caption label

Postby Cham » Wed Dec 06, 2017 9:04 pm

In the book and scrbook classes, I redefined the caption's label using this command in the preamble :
  1. \renewcommand*{\figureformat}{\sffamily\bfseries\figurename~\thefigure}


It's working great, except that I get a new warning in the console (I hate these!) :
LaTeX Font Warning: Font shape `T1/cmss/bx/sc' undefined
(Font) using `T1/cmss/bx/n' instead on input line 15.


So is there a better way in changing the caption's label style, so we don't get these pesky warnings each time there's a figure in the code ? Here's a MWE to mess with :
  1. \RequirePackage[l2tabu,orthodox]{nag}
  2. \documentclass[11pt,twoside,letterpaper,headsepline,footsepline,cleardoublepage=plain,]{scrbook}
  3. \renewcommand*{\figureformat}{\sffamily\bfseries\figurename~\thefigure}
  4. \usepackage[T1]{fontenc}
  5. \usepackage[french]{babel}
  6. \usepackage{graphicx}
  7. \usepackage{subfig}
  8. \usepackage[total={6.25in,10in},left=1.25in,top=0.5in,includehead,includefoot]{geometry}
  9.  
  10. \begin{document}
  11.  
  12. \begin{figure}
  13. \centering
  14. \includegraphics[height=4cm]{example-image-a}
  15. \caption{Some caption text.}
  16. \end{figure}
  17.  
  18. \end{document}


EDIT : Notice that the font substitution appears to be a problem with the command \usepackage[french]{babel}. If I remove it, I don't get any warning.

User avatar
Stefan Kottwitz
Site Admin
Posts: 8523
Joined: Mon Mar 10, 2008 9:44 pm
Location: Hamburg, Germany
Contact:

Postby Stefan Kottwitz » Wed Dec 06, 2017 9:58 pm

The French style changes the figure label to small caps shape. Since there's no bold small caps in the default font, it's ignored and a warning is issued. You can see the figure labels changing when you temporarily switch to a font that provides bold small caps, such as:

\usepackage{kpfonts}

Stefan
Site admin

User avatar
Cham
Posts: 813
Joined: Sat Apr 02, 2011 4:06 pm

Postby Cham » Wed Dec 06, 2017 10:08 pm

So you suggest that I simply ignore these pesky font substitution messages ?

User avatar
Stefan Kottwitz
Site Admin
Posts: 8523
Joined: Mon Mar 10, 2008 9:44 pm
Location: Hamburg, Germany
Contact:

Postby Stefan Kottwitz » Wed Dec 06, 2017 10:53 pm

You can switch off that behavior:

  1. \usepackage[french]{babel}
  2. \frenchbsetup{SmallCapsFigTabCaptions=false}


Stefan
Site admin

User avatar
Cham
Posts: 813
Joined: Sat Apr 02, 2011 4:06 pm

Postby Cham » Wed Dec 06, 2017 11:34 pm

I fixed the font issue (I don't know exactly how) by adding options to the subfig package :
  1. \usepackage{subfig}
  2. \captionsetup{figurename=Figure,margin=1in,format=hang,font=small,format=plain,labelfont={bf,up,sf},textfont={up}}
  3. \captionsetup[subfigure]{margin=0cm,font=small,format=plain,labelfont={bf,up},textfont={up}}
  4. \captionsetup[table]{name=Table,labelfont={bf,up}}


Return to “Graphics, Figures & Tables”

Who is online

Users browsing this forum: No registered users and 6 guests