1

I found that this MWE, compiled with pdflatex provide what I need:

\documentclass[a4paper]{article}   
\usepackage[T1]{fontenc}   
\begin{document}
\begin{center}
{\bfseries\scshape Bold Small Caps}
\end{center}
\end{document} 

I also pointed out that the combination \scshape and \bfseres works only with \usepackage[T1]{fontenc} option. Now I would like to get the same result using XeLaTeX but of course I cannot use fontenc package. I do not know how to do with fontspec

thank you

12
  • Replace \usepackage[T1]{fontenc} with \usepackage{fontspec} and use a font which has bold smallcaps, e.g. \setmainfont{CMU Serif}. Dec 14, 2016 at 14:50
  • I tried as you said. The point is it cannot find CMU Serif, and that I would like to use the default font, which I like so much.
    – MaPo
    Dec 14, 2016 at 14:53
  • Unfortunately, there are no bold smallcaps in Latin Modern Roman. Dec 14, 2016 at 14:59
  • So why with \usepackage[T1]{fontenc} those font were available? Is it impossible to have them using XeLaTeX?
    – MaPo
    Dec 14, 2016 at 15:01
  • \usepackage[T1]{fontenc} in pdfLaTeX selects the cm-super fonts. Unfortunately, T1 encoded fonts have the wrong mapping to be used with XeLaTeX. If in any way possible, you should use CMU Serif which is a slightly modified version of cm-super but with correct mapping. Dec 14, 2016 at 15:19

2 Answers 2

6

Luatex (or rather the luaotfload Lua module) has its own font searching code which is naturally kpathsearch-aware and will find system fonts and fonts in texlive both by filename and by the internal font name such as CMU Serif.

xetex uses the system font cache (fc-cache on linux and cygwin, and I think comes with a local copy of fc-cache on windows) it can find system and texlive fonts by filename but can only find fonts by font name if they are known to the system (eg via fc-cache).

You could load CMU Serif by filename

\setmainfont{cmunrm.otf}

For some fonts that is no problem and a convenient way to load fonts but the disadvantage of loading by filename is that fontspec can then not automatically infer variants such as bold and small caps, these can be specified individually to fontspec but for a large collection like CMU that is a pain.

Easier is to make the fonts available to the system, so xetex can load them by name. For example on my windows/cygwin setup I can just drag copies to c:/windows/fonts, on a Mac you could install the fonts in /Library/Fonts.

Or on systems using fc-cache you can tell fc-cache to look in the texlive directories. If you save a file that looks like

<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
  <dir>/usr/local/texlive/2016/texmf-dist/fonts/opentype</dir>
</fontconfig>

as

/etc/fonts/conf.d/09-texlive.conf

then run

sudo fc-cache -fsv

xetex will find the fonts.

The config file is a version of the file supplied in texlive as

/fonts/conf/texlive-fontconfig.conf

but restricted to opentype (the original had two extra lines for truetype and type1)

After all those preliminaries

\documentclass[a4paper]{article}   
\usepackage{fontspec} 
\setmainfont{CMU Serif}
%\setmainfont{cmunrm.otf}
\begin{document}
\begin{center}


{\bfseries Bold }

{\scshape Small Caps}

{\bfseries\scshape Bold Small Caps}
\end{center}
\end{document} 

produces

enter image description here

(Thanks to egreg for help with some of the details here)

6
  • FontConfig is not used on Mac, though. There you will need to make the fonts available to the system the usual Mac way (whatever it is, my Mac knowledge is very limited). Dec 15, 2016 at 5:48
  • @KhaledHosny thanks I update the wording a bit. Dec 15, 2016 at 9:11
  • Thank you so much. This works! I had some problem because of MathJax installed some fonts that interfere with the standard ones and so fc-cache was confused. So I removed MJ and the installed it again after fc-chace. Otherwise I guess I should have done some manual workaround...
    – MaPo
    Dec 15, 2016 at 14:24
  • @DavidCarlisle The solution code doesn't work for me, even though I have CMU Serif installed. I get the error Font shape 'TU/CMUSerif(0)/b/sc' undefined using 'TU/CMUSerif(0)/b/n' instead on input line 13. However it works fine when I use \usepackage[T1]{fontenc}. Mar 14, 2021 at 5:13
  • @simplejack your coments here tex.stackexchange.com/questions/587223/… imply th efont is not installed? Mar 14, 2021 at 11:09
0

Try this!!!!

\documentclass[10pt]{article}    
\usepackage{libertine}    
%\usepackage{mathpazo}    
%\usepackage{newtxtext}    
%\usepackage{charter}    
%\usepackage{kpfonts}    
%\usepackage{fourier}    
%\usepackage[garamond]{mathdesign}    
%\usepackage{pxfonts}    
\begin{document}    
\bfseries\scshape Rhubarb Rhubarb    
\end{document}

enter image description here

1
  • I'm using XeLaTeX, so I should pass thorugh fontspec
    – MaPo
    Dec 14, 2016 at 15:06

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .