# \labelfont from caption package not working

I am trying to change the font of the label in the caption, but it seems not work. The font is changed in the text of the cation but not in the label This is my preamble:

\documentclass[a4paper,12pt,english,oneside]{report}
\sloppy
\usepackage[paper=a4paper,left=40mm,width=150mm,top=20mm,bottom=40mm]{geometry}
\usepackage{setspace} % This is used in the title page
\usepackage{graphicx}
\usepackage[english]{babel}
\usepackage[colon]{natbib}
\usepackage{color}
\usepackage{fancyhdr}
\usepackage{nomencl}
\usepackage[tableposition=top]{caption}
\captionsetup{font={small}, textfont={sf}, labelfont={bf,sf}}
\usepackage{wrapfig}
\usepackage{float}
\usepackage{semtrans}
\usepackage{gensymb}
\usepackage{colortbl}
\usepackage{array}
\usepackage{hyperref}
\usepackage{wasysym}
\usepackage[T1]{fontenc} %font choice
\usepackage{tgtermes} %font
\usepackage{layouts}
\usepackage{rotating}
\usepackage{fixltx2e}
\usepackage{lscape}
\usepackage{listings}
\usepackage{pdfpages}
\definecolor{lightgray}{rgb}{.9,.9,.9}
\lstset{%frame=tb,
backgroundcolor=\color{lightgray},
aboveskip=3mm,
belowskip=3mm,
showstringspaces=false,
columns=flexible,
basicstyle={\footnotesize\ttfamily},
numbers=none,
numberstyle=\tiny\color{gray},
keywordstyle=\color{blue},
stringstyle=\color{mauve},
breaklines=true,
breakatwhitespace=true
tabsize=3
}

\hypersetup{
bookmarks=true,         % show bookmarks bar?
bookmarksopen=true,
bookmarksnumbered=true,
pdftitle={},    % title
pdfauthor={},     % author
pdfsubject={},   % subject of the document
pdfcreator={},   % creator of the document
citecolor=black,        % color of links to bibliography
filecolor=magenta,      % color of file links
urlcolor=cyan           % color of external links
}


and this what I get back

I would like to have everything in sf.

Any help?

Thanks

G

• (1) Make a minimal example, (2) make an example, you only post preamble, you are much more likely to get help if you post something that can be copied and used without having to add to it. – daleif Jul 2 '14 at 14:09

Here is a much simpler minimal example

\documentclass{report}
\usepackage[T1]{fontenc}
\usepackage{tgtermes}
\begin{document}
\bfseries\sffamily
Test
\end{document}


this example shows that when tgtermes is loaded, there is no bold sans serif. Which is quite odd.

The main problem seems to be that tgtermes sets \bfdefault to b. For sans serif tgtermes falls back to CMSS (computer modern sans serif) but that does not use the b default, but rather the bx.

You can see this from the .log file, I get this when I compile the example above

LaTeX Font Warning: Font shape T1/cmss/b/n' undefined
(Font)              using T1/cmss/m/n' instead on input line 12.


Might be an idea to find a find a more suitable sans serif font and load that package after tgtermes, see http://www.tug.dk/FontCatalogue/sansseriffonts.html

• If I load (even at the beginning) helvet or lmodern, it's OK. You can try TeX-Gyre Heros, a replacement for Helvetica. – Bernard Jul 2 '14 at 14:51
• Hi, it works fine with the minimal example.. the problem is I cannot find why it doesn't work in my preamble. I tried to add packages like float in my minimal example (my test.tex) and none of them seem to bother the formatting. – user1463152 Jul 2 '14 at 15:45

For unknown reasons, tgtermes redefines \bfdefault to b, which is a very disputable choice.

You can simply revert to the standard bx and all will be well, because the font definition files for TeX Gyre Termes do contain a font substitution rule from bx to b.

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

\usepackage[tableposition=top]{caption}
\captionsetup{font={small}, textfont={sf}, labelfont={bf,sf}}

\renewcommand{\bfdefault}{bx}

\begin{document}
Test \textbf{test in bold face} test

\begin{figure}
\centering
\fbox{\rule{0pt}{2cm}\rule{3cm}{0pt}}

\caption{Protein expression}
\end{figure}

\end{document}