4

Polyglossia {french} in Memoir Class. My preferred font is Open Sans. MWE compiled with XeLaTeX:

\documentclass[a4paper,article]{memoir}
\usepackage[demo]{graphicx}
\usepackage{polyglossia}
  \setdefaultlanguage{french}
  \setmainfont{Open Sans}
\begin{document}
  C'est un test pour "small caps": Fig.~\ref{fig:myfigure}.
  \begin{figure}[ht] \centering
    \includegraphics{nothing}
    \caption{c'est ma figure}\label{fig:myfigure}
\end{figure}
\end{document}

- generates warning:

LaTeX Font Warning: Font shape EU1/OpenSans(0)/m/sc' undefined (Font) usingEU1/OpenSans(0)/m/n' instead on input line 10.

The output is perfectly readable, but with normal font for "Fig" in the caption: fallback French caption label in Open Sans

In an attempt to get rid of the warning, and have French-style "Fig" shape, I tried to have small caps rendered in a font that can handle them (like one of the TeX Gyres), but nothing would work on my Arch Linux Tex-Live setup.

Changing the setmainfont line to use TeX Gyre Heros, like this:

\setmainfont[
  Extension=.otf,
  UprightFont= *-regular,
  BoldFont=*-bold,
  ItalicFont=*-italic,
  BoldItalicFont=*-bolditalic,
]{texgyreheros}

- does work:

correct shaped French caption label in TeX Gyre Heros

- but for my document, TeX Gyre Heros is a little heavy.

Is there a way to make the caption use a small-caps-compatible font (ideal), or to not use small-caps at all (thus removing the Warning)?

My various attempts, like \[captionnamefont]{\upshape}, achieved nothing.

2 Answers 2

1

The culprit here is the file gloss-french.ldf which has

\def\figurename{\textsc{Fig.}}

so you can override this using, for example,

\addto\captionsfrench{\def\figurename{Fig.}}  

A complete example:

\documentclass[a4paper,article]{memoir}
\usepackage[demo]{graphicx}
\usepackage{polyglossia}
\setdefaultlanguage{french}
\setmainfont{Open Sans}

\addto\captionsfrench{\def\figurename{Fig.}}  

\begin{document}
  C'est un test pour "small caps": Fig.~\ref{fig:myfigure}.
  \begin{figure}[ht] \centering
    \includegraphics{nothing}
    \caption{c'est ma figure}\label{fig:myfigure}
\end{figure}
\end{document}

enter image description here

The only other part in which small-caps are forced is for the table name, so you might need also

\def\tablename{Tab.}

inside the \addto\captionsfrench

1
  • Ah yes, as can be seen here.
    – joharr
    Mar 4, 2015 at 11:18
6

I don't know whether there is a suitable font for your needs, but if you don't want to use small caps at all, you can add these lines in your preamble:

\usepackage{letltxmacro}
\LetLtxMacro{\scshape}{\upshape}

MWE

\documentclass[a4paper,article]{memoir}
\usepackage[demo]{graphicx}
\usepackage{polyglossia}
  \setdefaultlanguage{french}
  \setmainfont{Open Sans}
\usepackage{letltxmacro}
\LetLtxMacro{\scshape}{\upshape}
\begin{document}
  C'est un test pour "small caps": Fig.~\ref{fig:myfigure}.
  \begin{figure}[ht] \centering
    \includegraphics{nothing}
    \caption{c'est ma figure}\label{fig:myfigure}
\end{figure}
\end{document} 

enter image description here

3
  • Since \textsc internally uses \scshape, it's necessary to redefine only the latter, but it should be better done with \LetLtxMacro (see When to use \LetLtxMacro
    – egreg
    Mar 3, 2015 at 22:45
  • @egreg You're right thanks. Changed the answer accordingly. Mar 3, 2015 at 22:48
  • This answer is possibly more generally helpful, but for my needs Gonzalo Medina's answer seems more succinct.
    – joharr
    Mar 4, 2015 at 11:20

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.