1

I am changing the font of my presentation to calibri, but the caption name under a figure (the "Figure" part) isn't changing to calibri, but stays in a serif font. The \setbeamerfont{caption name}{... doesn't seem to work

Here is a mwe but it doesn't reproduce the problem... Maybe it is because I use a style?

\documentclass[aspectratio=169,t]{beamer}
\usepackage[T1]{fontenc}
\usepackage{pgf}

\usefonttheme{professionalfonts}
\RequirePackage{fontspec}
\setmainfont{Calibri}
\setbeamerfont{caption}{family=\sffamily,size=\small}
\setbeamerfont{caption name}{family=\sffamily,size=\small}
\begin{document}

\begin{frame}
\begin{itemize}
  \item list of duck items
\end{itemize}
\begin{figure}
  \centering
  \includegraphics[width=.3\paperwidth, keepaspectratio]{example-image-duck}
  \caption{Duck example}%\label{}
\end{figure}

\end{frame}

\end{document} 

EDIT: Has propose, here is the log on pastebin

  • Unrelated to your problem, but you don't need \centering, figures are centred per default in beamer – user36296 Mar 22 at 16:47
  • See answer post comments for the answer – Simon Mar 22 at 17:32
3

Beamer uses sans serif font, so instead of setting the main font, you need to change the sans font (I replaced the font with papyrus to easier see that it is working)

And as @DavidCarlisle thankfully observed:

don't use \usepackage[T1]{fontenc} with luatex and especially not with xetex

% !TeX TS-program = xelatex

\documentclass[aspectratio=169,t]{beamer}
%\usepackage[T1]{fontenc}
\usepackage{pgf}

\usefonttheme{professionalfonts}
\RequirePackage{fontspec}
\setsansfont{Papyrus}
\setbeamerfont{caption}{family=\sffamily,size=\small}
\setbeamerfont{caption name}{family=\sffamily,size=\small}
\begin{document}

\begin{frame}
\begin{itemize}
  \item list of duck items
\end{itemize}
\begin{figure}
  %\centering
  \includegraphics[width=.3\paperwidth, keepaspectratio]{example-image-duck}
  \caption{Duck example}%\label{}
\end{figure}

\end{frame}

\end{document} 

enter image description here

And with calibri:

 % !TeX TS-program = xelatex

\documentclass[aspectratio=169,t]{beamer}
%\usepackage[T1]{fontenc}
\usepackage{pgf}

\usefonttheme{professionalfonts}
\RequirePackage{fontspec}
\setsansfont{Calibri}
\setbeamerfont{caption}{family=\sffamily,size=\small}
\setbeamerfont{caption name}{family=\sffamily,size=\small}
\begin{document}

\begin{frame}
\begin{itemize}
  \item list of duck items
\end{itemize}
\begin{figure}
  %\centering
  \includegraphics[width=.3\paperwidth, keepaspectratio]{example-image-duck}
  \caption{Duck example}%\label{}
\end{figure}

\end{frame}

\end{document} 

enter image description here

  • From my test on my main file, using \setsansfont{Calibri} changes it to a serif font everywhere... – Simon Mar 22 at 16:51
  • @Simon Can you show your .log file (if it is too long to add to the question, try pastebin.com) – user36296 Mar 22 at 16:56
  • thanks, it has been added – Simon Mar 22 at 16:59
  • @Simon If you look at the warnings in the log, it says that it cannot find the font LaTeX Font Info: Try loading font information for T1+Calibri(0) on input line 105. LaTeX Font Info: No file T1Calibri(0).fd. on input line 105. LaTeX Font Warning: Font shape T1/Calibri(0)/m/n' undefined (Font) using T1/cmr/m/n' instead on input line 105. – user36296 Mar 22 at 17:01
  • 1
    don't use \usepackage[T1]{fontenc} with luatex and especially not with xetex – David Carlisle Mar 22 at 17:30

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.