3

I switched my working document from pdfLaTeX to XeLaTeX. I have a problem with the font, because now Computer Modern Roman doesn't display bold, italic and small caps text (it works only in one page if I say \usefont{T1}{cmr}{m}{n}\selectfont).

Ex in my images caption, I've said in preamble labelfont={sc,color=blue}, textfont={small,it}, labelsep=endash what is working except for it and sc. And \textit, \textbf, \textsc are not working in all the document :

enter image description here

This is a MWE :

%%Classe du document
\documentclass[11pt,oneside]{book}

\usepackage[labelfont={sc,color=blue}, textfont={small,it}, labelsep=endash]{caption}
\usepackage{subcaption}

\usepackage[cm-default]{fontspec}
\usepackage{xunicode}
\DeclareTextCommandDefault{\nobreakspace}{\leavevmode\nobreak\ } 

%%Pour insérer des images
\usepackage{graphicx} 

%%Le document est en français
\usepackage{polyglossia}
\setdefaultlanguage{french}

\usepackage{cmlgc}

\begin{document}
{\huge\textsc{Sans la liberté de blâmer, il n'est point d'éloge flatteur. }}

\begin{figure}
\includegraphics{image.png}
\caption{Beaumarchais}
\end{figure}

\end{document}
  • 1
    do not use T1 and fontenc encoding with xetex – David Carlisle Jan 9 '16 at 23:29
  • @DavidCarlisle ok, I tried but it didn't changed anything... – PMC1234 Jan 9 '16 at 23:31
  • 1
    similarly you don't want all those \usefont{T1}... T1 is a legacy 8bit encoding it removes all the features of xetex if you use that, you may as well stay with pdftex. – David Carlisle Jan 9 '16 at 23:31
  • unrelated but book does not have an article option what do you intend it to do? – David Carlisle Jan 9 '16 at 23:32
  • 1
    hmm I get loads of warnings like LaTeX Font Warning: Font shape `EU1/fcm/m/it' undefined (Font) using EU1/fcm/m/n' instead on input line 24.` which says that latex can not do italic so will use normal shape instead. where did fcm family come from?? Is that part of the french setup? I'll look... – David Carlisle Jan 10 '16 at 0:00
2

It looks like cmlgc package is not compatible with Unicode fonts as used by xetex, if I remove that the font warnings go and you get small caps output

enter image description here

\documentclass[11pt,oneside]{book}

\usepackage[labelfont={sc,color=blue}, textfont={small,it}, labelsep=endash]{caption}
\usepackage{subcaption}

\usepackage{fontspec}

\DeclareTextCommandDefault{\nobreakspace}{\leavevmode\nobreak\ } 

%%Pour insérer des images
\usepackage{graphicx} 

%%Le document est en français
\usepackage{polyglossia}
\setdefaultlanguage{french}

%\usepackage{cmlgc}

\begin{document}
{\huge\textsc{Sans la liberté de blâmer, il n'est point d'éloge flatteur. }}

\begin{figure}
\includegraphics{image.png}
\caption{Beaumarchais}
\end{figure}

\end{document}

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.