13

This question is in some ways similar to Display real apostrophe in parts of a document, but I am now asking about the possibility of performing a specific operation.

I can turn on the typical TeX text mapping of quotes etc. by using fontspec's option Ligatures=TeX. Whereas fontspec allows many of the Ligatures options to be deactivated (cf. fontspec's documentation, table 2), I can't find any way of deactivating an already activated Ligatures=TeX, since there is no option of the sort Ligatures=NoTeX. Does this mean it is not possible to momentarily turn off Ligatures=TeX inside a document?

\documentclass{article}
\usepackage{fontspec}
    \setmainfont[Ligatures=TeX]{Linux Libertine O}
\begin{document}
CA'GT -- {\addfontfeatures{Ligatures=Common}CA'GT}
\end{document}

enter image description here

2 Answers 2

13

You can turn off the mapping by using an empty mapping:

\documentclass{article}
\usepackage{fontspec}
    \setmainfont[Ligatures=TeX]{Linux Libertine O}
\begin{document}
CA'GT -- {\addfontfeatures{Mapping=}CA'GT}
\end{document}

enter image description here

1
  • This solution only works with XeLaTeX and not LuaLaTeX though.
    – Alan Munn
    Mar 20, 2013 at 18:36
8

The Ligatures=TeX doesn't apply a font feature, but rather adds a "mapping"; this is part of the log describing the main font:

. fontspec info: "defining-font"
.
. Font family 'LinuxLibertineO(0)' created for font 'Linux Libertine O' with
. options [Ligatures=TeX].
.
. This font family consists of the following shapes:
.
. * 'normal' with NFSS spec.:
. <->"Linux Libertine O/ICU:script=latn;language=DFLT;mapping=tex-text;"
.
. * 'small caps' with NFSS spec.:
. <->"Linux Libertine O/ICU:script=latn;language=DFLT;mapping=tex-text;+smcp;"
.
. * 'bold' with NFSS spec.:
. <->"Linux Libertine O/B/ICU:script=latn;language=DFLT;mapping=tex-text;"
. [...omitted similar lines...]

While this feature could be turned off, I'd prefer defining a different font family without the option:

\documentclass{article}
\usepackage{fontspec}

\setmainfont[Ligatures=TeX]{Linux Libertine O}
\newfontfamily{\mainnolig}{Linux Libertine O}

\begin{document}

CA'GT -- {\mainnolig CA'GT}

{\itshape CA'GT -- {\mainnolig CA'GT}}

\end{document}

As the example shows, font attributes are preserved, so the effect is the same as what you wanted to get with \addfontfeatures. The chosen name is just to provide the example, use whatever you prefer.

enter image description here

5
  • 3
    You can turn off the mapping by using an empty mapping: {\addfontfeatures{Mapping=}CA'GT --}. Mar 18, 2013 at 13:32
  • @egreg: Yes, that's exactly what I do as well (as suggested by Alan Munn in tex.stackexchange.com/a/99776/9077), but I was curious if there was a way of "turning off" the TeX mapping.
    – Sverre
    Mar 18, 2013 at 13:32
  • @UlrikeFischer: You're right. Do you wanna provide an answer, or should I just add it myself?
    – Sverre
    Mar 18, 2013 at 13:35
  • The choice of name \mainnolig could be a bit confusing to some readers, as the font family will still have the Common ligatures (mostly f-ligatures) enabled. Maybe it's better to call the font family \mainnotexlig? Just a thought.
    – Mico
    Mar 18, 2013 at 13:36
  • @Mico: I agree. My font family is called NoTeX :)
    – Sverre
    Mar 18, 2013 at 13:38

You must log in to answer this question.

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