3

I have problems when I use small italic capitals with a "non-standard" font weight (here semi-bold).

I tried several things like FontFace={sb}{it}{Font=LinLibertine_RZI_G. ttf, SmallCapsFont={LinLibertine_RZI_G. ttf}, SmallCapsFeatures={RawFeature={+smcp}}}}, but it doesn’t work. I don’t know how to ask Fontspec to use the small semi-bold italic capitals.

Do you have any suggestions?

\documentclass{article}

\usepackage{fontspec}

\setmainfont{Linux Libertine G}[
    FontFace = {sb}{n}{LinLibertine_RZ_G.ttf} ,
    FontFace = {sb}{it}{LinLibertine_RZI_G.ttf},
]

\DeclareOldFontCommand{\sbseries}{\fontseries{sb}\selectfont}{\mathbf}
\DeclareTextFontCommand{\textsb}{\sbseries}

\begin{document}

Hello world. \textsb{Hello world.} \textbf{Hello world.}

\textit{Hello world.} \textit{\textsb{Hello world.}} \textit{\textbf{Hello world.}}

\textsc{Hello world.} \textsb{\textsc{Hello world.}} \textbf{\textsc{Hello world.}}

\textit{\textsc{Hello world.}} \textit{\textsb{\textsc{Hello world.}}} \textit{\textbf{\textsc{Hello world.}}}

\end{document}

enter image description here

EDIT

After Egreg’s answer, here’s my new MWE, But the problem remains :

\documentclass{article}

\usepackage{fontspec}

\setmainfont{Linux Libertine G}[
    BoldFont=LinLibertine_RB_G.ttf,
    BoldItalicFont=LinLibertine_RBI_G.ttf,
    FontFace={sb}{n}{LinLibertine_RZ_G.ttf},
    FontFace={sb}{it}{LinLibertine_RZI_G.ttf},
]

\DeclareRobustCommand{\sbseries}{\fontseries{sb}\selectfont}
\DeclareTextFontCommand{\textsb}{\sbseries}

\begin{document}
\textit{\textsc{Hello world.}} \textit{\textsb{\textsc{Hello world.}}} \textit{\textbf{\textsc{Hello world.}}}
\end{document}
8
  • 1
    It's not clear to me what you're trying to achieve. E.g., are you looking to use semibold rather than (outright) bold as the default font weight for "bold", or do you wish to employ both semibold and bold? Please advise.
    – Mico
    Apr 11, 2021 at 8:52
  • Did you try with \DeclareRobustCommand{\sbseries}{\fontseries{sb}\selectfont}?
    – egreg
    Apr 11, 2021 at 8:55
  • 1
    Hello @Mico, indeed, I use in my document the bold and semi-bold, so I wish I could use the small italic capitals in bold and semi-bold.
    – Bastien
    Apr 11, 2021 at 8:56
  • Hello @egreg, I just tried but it doesn’t seem to work.
    – Bastien
    Apr 11, 2021 at 8:58
  • 1
    I don't have the Linux Libertine G fonts. If they're at all similar to the Linux Libertine O fonts, you may need to re-think the wisdom of using both the semibold and the bold font weights in one and the same document, as the two font weights are sufficiently similar as to make it difficult (or even impossible) for most readers to be able to tell whether a given word is rendered in semibold or bold.
    – Mico
    Apr 11, 2021 at 9:17

1 Answer 1

4

Why shouldn't old font commands such as \rm or \it or \bf used? Because they follow the original LaTeX setup and reset all font features. So if you do \it\bf you just get boldface and not italic.

The command \DeclareOldFontCommand should only be used for compatibility with older documents. If you look in the LaTeX kernel, you'll see that \bfseries is defined with \DeclareRobustCommand.

You have also to declare what bold font you plan to use, if you define semibold.

\documentclass{article}

\usepackage{fontspec}

\setmainfont{Linux Libertine O}[
  BoldFont=* Bold,
  BoldItalicFont=* Bold Italic,
  FontFace = {sb}{n}{* Semibold},
  FontFace = {sb}{it}{* Semibold Italic},
]

\DeclareRobustCommand{\sbseries}{\fontseries{sb}\selectfont}
\DeclareTextFontCommand{\textsb}{\sbseries}

\begin{document}

Hello world. \textsb{Hello world.} \textbf{Hello world.}

\textit{Hello world.} \textit{\textsb{Hello world.}} \textit{\textbf{Hello world.}}

\textsc{Hello world.} \textsb{\textsc{Hello world.}} \textbf{\textsc{Hello world.}}

\textit{\textsc{Hello world.}}
\textit{\textsb{\textsc{Hello world.}}}
\textit{\textbf{\textsc{Hello world.}}}

\end{document}

The fonts have been changed to suit my machine.

enter image description here

If I replace all periods with .\typeout{\fontname\font}, the terminal shows

"Linux Libertine O/OT:script=latn;language=dflt;mapping=tex-text;"
"Linux Libertine O Semibold/OT:script=latn;language=dflt;mapping=tex-text;"
"Linux Libertine O Bold/OT:script=latn;language=dflt;mapping=tex-text;"
"Linux Libertine O Italic/OT:script=latn;language=dflt;mapping=tex-text;"
"Linux Libertine O Semibold Italic/OT:script=latn;language=dflt;mapping=tex-text;"
"Linux Libertine O Bold Italic/OT:script=latn;language=dflt;mapping=tex-text;"
"Linux Libertine O/OT:script=latn;language=dflt;+smcp;mapping=tex-text;"
"Linux Libertine O Semibold/OT:script=latn;language=dflt;+smcp;mapping=tex-text;"
"Linux Libertine O Bold/OT:script=latn;language=dflt;+smcp;mapping=tex-text;"
"Linux Libertine O Italic/OT:script=latn;language=dflt;+smcp;mapping=tex-text;"
"Linux Libertine O Semibold Italic/OT:script=latn;language=dflt;+smcp;mapping=tex-text;"
"Linux Libertine O Bold Italic/OT:script=latn;language=dflt;+smcp;mapping=tex-text;"

which seems to be what you're looking for.

Here's the setup for Libertinus Serif.

\documentclass{article}

\usepackage{fontspec}

\setmainfont{LibertinusSerif}[
  Extension=.otf,
  UprightFont=*-Regular,
  ItalicFont=*-Italic,
  BoldFont=*-Bold,
  BoldItalicFont=*-BoldItalic,
  FontFace = {sb}{n}{*-Semibold},
  FontFace = {sb}{it}{*-SemiboldItalic},
]

\DeclareRobustCommand{\sbseries}{\fontseries{sb}\selectfont}
\DeclareTextFontCommand{\textsb}{\sbseries}

\begin{document}

Hello world\typeout{\fontname\font}.
\textsb{Hello world\typeout{\fontname\font}.}
\textbf{Hello world\typeout{\fontname\font}.}

\textit{Hello world\typeout{\fontname\font}.}
\textit{\textsb{Hello world\typeout{\fontname\font}.}}
\textit{\textbf{Hello world\typeout{\fontname\font}.}}

\textsc{Hello world\typeout{\fontname\font}.}
\textsb{\textsc{Hello world\typeout{\fontname\font}.}}
\textbf{\textsc{Hello world\typeout{\fontname\font}.}}

\textit{\textsc{Hello world\typeout{\fontname\font}.}}
\textit{\textsb{\textsc{Hello world\typeout{\fontname\font}.}}}
\textit{\textbf{\textsc{Hello world\typeout{\fontname\font}.}}}

\end{document}

enter image description here

Just to check what fonts are being used, I added \typeout{\fontname\font} and on the terminal I get

"[LibertinusSerif-Regular.otf]/OT:script=latn;language=dflt;mapping=tex-text;"
"[LibertinusSerif-Semibold.otf]/OT:script=latn;language=dflt;mapping=tex-text;"
"[LibertinusSerif-Bold.otf]/OT:script=latn;language=dflt;mapping=tex-text;"
"[LibertinusSerif-Italic.otf]/OT:script=latn;language=dflt;mapping=tex-text;"
"[LibertinusSerif-SemiboldItalic.otf]/OT:script=latn;language=dflt;mapping=tex-text;"
"[LibertinusSerif-BoldItalic.otf]/OT:script=latn;language=dflt;mapping=tex-text;"
"[LibertinusSerif-Regular.otf]/OT:script=latn;language=dflt;+smcp;mapping=tex-text;"
"[LibertinusSerif-Semibold.otf]/OT:script=latn;language=dflt;+smcp;mapping=tex-text;"
"[LibertinusSerif-Bold.otf]/OT:script=latn;language=dflt;+smcp;mapping=tex-text;"
"[LibertinusSerif-Italic.otf]/OT:script=latn;language=dflt;+smcp;mapping=tex-text;"
"[LibertinusSerif-SemiboldItalic.otf]/OT:script=latn;language=dflt;+smcp;mapping=tex-text;"
"[LibertinusSerif-BoldItalic.otf]/OT:script=latn;language=dflt;+smcp;mapping=tex-text;"

After seeing the output, both in the Linux Libertine and Libertinus serif cases, I believe that using both bold and semibold does not work, because the weights are not distinguishable enough: only if they're next to each other one can spot some difference. You should choose one of them as the boldface font and don't rely on both.

3
  • thank you for your answer, I adapted your preamble to the font I have but the problem persists. So maybe I’ll use Linux Libertine O instead of Linux Libertine G if the problem comes from the font.
    – Bastien
    Apr 11, 2021 at 9:36
  • 1
    @Bastien I'd go for Libertinus, which is maintained and developed.
    – egreg
    Apr 11, 2021 at 9:59
  • 1
    @Bastien I added the setup for Libertinus and also a final comment.
    – egreg
    Apr 11, 2021 at 10:41

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.