5

I've already tried Use of \scshape or \textsc in beamer \institute fix with \rmfamily in the MWE below, but it doesn't work - I've seen A problem with \textsc as well, but I don't think I should load fontenc now that I'm using fontspec with xelatex.

This is the output I get - the centered text below the section should be smallcaps, but isn't (note, however, that the section heading/title does indeed show smallcaps, as intended):

test.png

Here is the MWE:

\documentclass[letterpaper,12pt]{article}

% \typeout{ == \the\paperwidth / \the\paperheight ==}
% \typeout{ == \the\pdfpagewidth / \the\pdfpageheight ==}
\pdfpagewidth=\paperwidth \pdfpageheight=\paperheight

\usepackage{fontspec}
\defaultfontfeatures{Ligatures=TeX}
\setmainfont{Junicode}

\makeatletter
\renewcommand{\section}{\@startsection
{section}%                   % the name
{1}%                         % the level
{\z@}%                       % the indent / 0mm
{-\baselineskip}%            % the before skip / -3.5ex \@plus -1ex \@minus -.2ex
{0.5\baselineskip}%          % the after skip / 2.3ex \@plus .2ex
{\centering\normalsize\scshape}} % the style
\makeatother


\usepackage{lipsum}
\usepackage{tikz}


\begin{document}

\section*{A test of section small-caps}

\begin{center}
\textbf{\rmfamily \textsc{Something written without small-caps}}
\end{center}

  \lipsum[1]

\end{document}

Any suggestions on how to get the small-caps running here?

Many thanks in advance for any answers,
Cheers!

2 Answers 2

4

The problem is that your font does not define a bold small-caps. If you use a font with a bold small-caps such as Minion Pro, it will work:

Demo with Minion Pro

5
  • 4
    I'd note that bold small caps doesn't seem a good idea, in general: small caps and boldface are different ways to emphasize something and double emphasis is almost like shouting in the face of the reader.
    – egreg
    May 16, 2012 at 11:38
  • Many thanks for that @mforbes - never thought that would have been a problem :) @egreg - just trying to replicate a design I got... Btw, would there be an easy way to tell fontspec to take the uppercase shapes from the bold font, scale them say 50%, and use them for smallcaps lowercase (even if that is typographically inappropriate?).. Many thanks again - cheers!
    – sdaau
    May 16, 2012 at 11:52
  • 1
    @sdaau There's a question just about this, whose answers show that scaling capital letters for emulating small caps is not a good idea.
    – egreg
    May 16, 2012 at 11:58
  • Fantastic, @egreg, many thanks for that link; exactly what I needed to know! Cheers!
    – sdaau
    May 16, 2012 at 12:05
  • @egreg: Although I share your opinion I want to say that doubled or tripled emphasis can be use to diferentiate layers / nesting levels. E.g. first level headline are bigger, bold and sans, second level headlines are bold and sans too but not bigger.
    – Tobi
    May 16, 2012 at 15:55
6

After the conclusions in previous post (deleted, now here); I finally managed to find a cheatery so that \bfseries\scshape will result with the normal small caps, but 'fake bolded', using the option of fontspec; and without complaining (and preserving capital letters).

The trick is to issue a call to \fontspec requesting Junicode (regular) in fake bold (this will create a new font family, Junicode(1)) after the initial \setmainfont (which creates a new font family, Junicode(0)). Then, using the Latex2e command \DeclareFontShape we can map bold smallcaps of Junicode(0) (which don't exist); to smallcaps of fakebold Junicode(1) (which do).

You can track down the correct syntax for \DeclareFontShape by observing the warnings generated without it, which for me were:

LaTeX Font Warning: Font shape `EU1/Junicode(0)/bx/sc' undefined
(Font)              using `EU1/Junicode(0)/bx/n' instead on input line 37.

This is the result of the example code:

test.png

... and this is the code, compiled with xelatex test.tex:

\documentclass[letterpaper,12pt]{article}

% \typeout{ == \the\paperwidth / \the\paperheight ==}
% \typeout{ == \the\pdfpagewidth / \the\pdfpageheight ==}
\pdfpagewidth=\paperwidth \pdfpageheight=\paperheight

\usepackage{fontspec}

\defaultfontfeatures{Ligatures=TeX}
\setmainfont{Junicode}

% each \setmainfont / fontspec command creates a new Junicode(X) font
% here we are at Junicode(0)
% create Junicode(1) with fake bold
\fontspec[FakeBold=2.5]{Junicode}

% map Junicode(0)/bx/sc (bold smallcaps) to Junicode(1)/m/sc (normal smallcaps of fake bold)
\DeclareFontShape{EU1}{Junicode(0)}{bx}{sc}{<->ssub * Junicode(1)/m/sc}{}

\makeatletter
\newcommand{\showfont}{Encoding: \f@encoding{},
  Family: \f@family{},
  Series: \f@series{},
  Shape: \f@shape{},
  Size: \f@size{}
}
\makeatother



\begin{document}

  {\scshape \showfont Aa}

  {\fontspec[Letters=SmallCaps]{Junicode} \showfont Aa}

  {\bfseries\scshape \showfont Aa}

\end{document}

Well, hope this helps someone,
Cheers!


EDIT: Just wanted to note that this code can also be compiled by lualatex (if you have the needed packages installed); however, one difference is that lualatex cannot understand OpenType options like 'FakeBold':

.................................................
. fontspec info: "defining-font"
. 
. Font family 'Junicode(0)' created for font 'Junicode' with options
. [Ligatures=TeX,Scale=1.0].
. 
. This font family consists of the following shapes:
.................................................
luaotfload | load font: font family='junicode', subfamily='regular' found: /usr
/share/fonts/truetype/ttf-junicode/Junicode-Regular.ttf
fontspec: script 'latn' exists in font 'JunicodeRegular'
*************************************************
* fontspec warning: "fakebold-only-xetex"
* 
* The "FakeBold" and "AutoFakeBold" options are only available with XeLaTeX.
* Option ignored.
*************************************************

On the other hand, xelatex seems to embed a separate font in the PDF for each new "font family" instantiated when new options (like 'FakeBold') are requested - from a similar example I'm working on:

$ pdffonts test.pdf
name                                 type              emb sub uni object ID
------------------------------------ ----------------- --- --- --- ---------
WOHRES+Junicode-Regular              CID TrueType      yes yes yes      6  0
ZNKKUV+Junicode-Italic               CID TrueType      yes yes yes     18  0
HHUNME+Junicode-Bold                 CID TrueType      yes yes yes     23  0
YSORBG+Junicode-Regular              CID TrueType      yes yes yes     50  0
GDUQPQ+Junicode-Regular              CID TrueType      yes yes yes     64  0
MLJVAZ+Junicode-Regular              CID TrueType      yes yes yes     72  0
CHJXWV+Junicode-Regular              CID TrueType      yes yes yes     74  0

... while lualatex, on the same .tex source (the one warning about 'FakeBold') will seemingly "compact" all the embedded fonts in the PDF:

$ pdffonts test.pdf
name                                 type              emb sub uni object ID
------------------------------------ ----------------- --- --- --- ---------
VVMOBU+Junicode-Regular              CID TrueType      yes yes yes     39  0
QEUPWF+Junicode-Italic               CID TrueType      yes yes yes     53  0
VJZORW+Junicode-Bold                 CID TrueType      yes yes yes     58  0

You must log in to answer this question.

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