3

What are the diffences and are there drawbacks involved in replacing \setmainfont{erewhon} by \usepackage{erewon}?

In the first case there is no bold small caps, but there are in the second. This is a serious advantage, but are there any drawbacks?

Should one use \usepackage{erewon} without optional arguments? If so, should it be loaded after or before? It makes apparently no differences to the mwe output.

\documentclass{article}

    \RequirePackage{fontspec}
%       \setmainfont{Erewhon}[
%           Extension=.otf,
%           UprightFont=*-Regular,
%           ItalicFont=*-Italic,
%           BoldFont=*-Bold,
%           BoldItalicFont=*-BoldItalic,
%           SlantedFont=*-RegularSlanted,
%           BoldSlantedFont=*-BoldSlanted,
%           SmallCapsFont=*-Regular,
%           SmallCapsFeatures={Letters=SmallCaps}
%           ]

% or
\usepackage{erewhon}

 \setsansfont{texgyreheros}[
        Scale=MatchLowercase,% or MatchUppercase
        Extension=.otf,
        UprightFont=*-regular,
        ItalicFont=*-italic,
        BoldFont=*-bold,
        BoldItalicFont=*-bolditalic,
        ]


\begin{document}

\textbf{Exercice}

\textbf{\textsc{Exercice}}

\textsc{\textbf{Exercice}}

\textbf{\scshape Exercice}

\textbf{\textsl{Exercice}}

\textbf{\textit{Exercice}}

\textsc{Exercice}

\end{document}
4
  • One can take off SmallCapsFont=*-SmallCaps, it's useless (no difference) but without SmallCapsFont=*-Regular the error message is The font "Erewhon-SmallCaps" cannot be found..
    – Tarass
    Aug 11, 2015 at 12:04
  • Initialy I had a problem with slanted lookink like italics, egreg gave me the solution here tex.stackexchange.com/questions/212357/… (I forgot to delete a line) and it works until I found that the bold small caps were not bold ... If I use the easy declaration without any optional arguments I still have the slanted-italic problem but no bold small caps problem. How to solve the two problems a once ?
    – Tarass
    Aug 11, 2015 at 12:22
  • Something is really screwy. I can get the bold small-caps to be bold and small-caps by modifying erewhon.fontspec but the bold sc font is then also slanted or italic (not sure which)!
    – cfr
    Aug 11, 2015 at 13:19
  • I notice that too,
    – Tarass
    Aug 11, 2015 at 13:22

2 Answers 2

2

I assume you're using LuaLaTeX.

An advantage of running \usepackage{erewhon} is that it lets you generate not only "regular" (i.e., upright) smallcaps but also bold smallcaps, slanted smallcaps, and bold-slanted smallcaps. (I'll let others weigh in on the subject of whether it's in fact a good idea to have these additional font shape and weight combinations...)

enter image description here

\documentclass{article}
\usepackage{booktabs,fontspec}

\usepackage{erewhon}

\begin{document}
\noindent
\begin{tabular}{@{}lll@{}}
\toprule
Font Shape & \multicolumn{2}{c}{Font Weight}\\
\cmidrule(l){2-3}
  & normal & bold\\
\midrule
upright (Roman)   & Exercise           & \textbf{Exercise}\\
slanted           & \textsl{Exercise}  & \textbf{\textsl{Exercise}}\\
italic            & \textit{Exercise}  & \textbf{\textit{Exercise}}\\
upright smallcaps & \textsc{Exercise}  & \textbf{\textsc{Exercise}}\\
slanted smallcaps & \textsl{\textsc{Exercise}} & \textsl{\textbf{\textsc{Exercise}}}\\
\bottomrule
\end{tabular}
\end{document}

For comparison, if the single-line statement \usepackage{erewhon} is replaced with

\setmainfont{Erewhon}[
   SlantedFont    = *-RegularSlanted,
   BoldSlantedFont= *-BoldSlanted]

where the two options enable the font's two slanted font faces, one unexpectedly gets only slanted and slanted-bold smallcaps, i.e, no more upright and upright-bold smallcaps:

enter image description here

A serious disadvantage of going the \usepackage{erewhon} route is that you are bound to obtain incomprehensible and fatal error messages when doing something as simple as embedding the table above in a table environment and trying to provide a caption via \caption.

4
  • The disadvantage is that is sets the font encoding to T1 and that so you can't use an ß, or other fonts loaded by fontspec. Aug 11, 2015 at 13:32
  • @UlrikeFischer - I hadn't quite finished writing my answer when you posted your comment. :-) You've mentioned one of the problems of the \usepackage{erewhon} method. Another, potentially even more serious problem, is the inability to create a \caption without generating a fatal error with associated message, "Command \nobreakspace unavailable in encoding T1".
    – Mico
    Aug 11, 2015 at 13:41
  • It would be easy to add the command for T1 encoding, but as itreveals the underlying problem that the whole document is using the wrong fontencoding and that more problems are to be expected I don't think that it is worth the time. Aug 11, 2015 at 13:45
  • 1
    @Tarass - you should really accept Ulrike's answer, since she shows how one may get all four small-caps font shapes without incurring the severe problems that arise from loading the erewhon package.
    – Mico
    Aug 11, 2015 at 14:11
5

You shouldn't use the package with lualatex and xelatex. It uses the wrong font encodings for this engines.

If I got it right from your various questions your problem is that you want to set the slanted font and that this disturbs the small caps. This is imho a bug in fontspec and I made a report: https://github.com/wspr/fontspec/issues/209.

You can get around this bug by resetting the small caps font (the example is for lualatex, xelatex needs perhaps a slightly difference syntax):

\documentclass{article}

\RequirePackage{fontspec,fontaxes}

\setmainfont{Erewhon}[
  SlantedFont=*-RegularSlanted,
  BoldSlantedFont=*-BoldSlanted,
]

\normalfont\makeatletter

\DeclareFontShape{\f@encoding}{\f@family}{m}{sc}%
     {%
     <->"Erewhon:mode=node;script=latn;language=DFLT;+tlig;+trep;+smcp"
      }{}

\DeclareFontShape{\f@encoding}{\f@family}{bx}{sc}%
     {%
     <->"Erewhon-Bold:mode=node;script=latn;language=DFLT;+tlig;+trep;+smcp"
      }{}

\DeclareFontShape{\f@encoding}{\f@family}{m}{scsl}%
     {%
     <->"Erewhon-RegularSlanted:mode=node;script=latn;language=DFLT;+tlig;+trep;+smcp"
      }{}

\DeclareFontShape{\f@encoding}{\f@family}{bx}{scsl}%
     {%
     <->"Erewhon-BoldSlanted:mode=node;script=latn;language=DFLT;+tlig;+trep;+smcp"
      }{}

\makeatother
\begin{document}
abc {\itshape abc \bfseries abc} {\slshape abc \bfseries abc}

\textbf{Exercise}

\textbf{\textsc{Exercise}}

{\slshape\scshape Abc \bfseries Abc} %need fontaxes

{\fontshape{scsl}\selectfont Abc \bfseries Abc} %works always

\textsc{Exercise}

\end{document}

enter image description here

(Edited to show how to get slanted small caps too)

3
  • The extra code "restores" the upright and bold-upright smallcap font faces but loses the slanted and bold-slanted smallcap font faces. Is that intentional?
    – Mico
    Aug 11, 2015 at 13:44
  • 1
    @Mico you can add definitions for them too. I will update the answer. Aug 11, 2015 at 14:03
  • Thanks for updating your answer to allow the use of all four smallcap variants. Feel free to "borrow" the table from my answer to show all ten shape/weight combinations in action. :-)
    – Mico
    Aug 11, 2015 at 14:35

You must log in to answer this question.

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