# Suppression of a ligature in XeLaTeX

I'm trying to reproduce an old book with XeLaTeX, and it has the ct ligature but not the st ligature. The Ligatures=Rare option seems to turn either both on or off. Is there a way to select which ligatures to use in XeLaTeX? I am using the Adobe Caslon Pro OTF fonts. I know the microtype package may be able to do this but it is not supported by XeLaTeX. Any help is appreciated.

Another question I have is, is it possible to change ligature options midway through a document? Or perhaps temporarily change the ligatures for one occasion?

-

This is possible using Mico's selnolig package. It is not yet on CTAN, but its beta version, which I would call stable, is available on GitHub. selnolig requires the document to be compiled with lualatex, but that wouldn't keep you from using your fonts; indeed, it is pretty similar to xelatex in usage.

(Btw, microtype is available for LuaTeX -- most of its functions -- but it cannot selectively deactivate ligatures. That's why selnolig was created.)

In this MWE, I load selnolig without either of its language options (it can deal with German and English), so it only gets rid of ligatures where I tell it to with \nolig rules. Since I don't have the Adobe Caslon Pro OTF fonts, I used Linux Libertine, which has the ⟨st⟩ and ⟨ct⟩ ligatures in its Historical set.

\documentclass{article}
\usepackage{fontspec}
\defaultfontfeatures{Ligatures={Historical}}
\setmainfont{Linux Libertine O}
\usepackage{selnolig}
\nolig{st}{s|t}
\begin{document}
best pact
\end{document}


Just as a comparison, here's the output without selnolig:

selnolig's main purpose is to automatically suppress ligatures across morpheme boundaries in German and English texts. Its documentation explains all about how to use it (and how to use lualatex, if you'd like some pointers there).

-
Yes! Thank you for that information. Worked flawlessly. –  Neo Dec 11 '12 at 22:07

@doncherry has already addressed your main question. I'll take a stab at your second set of questions:

Another question I have is, is it possible to change ligature options midway through a document? Or perhaps temporarily change the ligatures for one occasion?

You're not very specific as to which of potentially very many ligature-related options you're looking to change, so my answer has to be quite broad. I think your best bet is to use the \newfontfamily command of the fontspec package to set up a "new" font (which could be the same as that set by \setmainfont...) and some font-related options. For instance, you could have the following setup in your document's preamble:

\usepackage{fontspec}


You could then issue the commands

\bgroup
\acptemp
...
\egroup


inside the document's body to switch to a setup with all ligatures disabled within the scope of \bgroup ... \egroup -- while keeping the same basic font.

-
Sorry about the vague question. What I meant was, say I would like to enable the st ligature for a particular page, but keep it disabled for the rest of the document. Is there a way to achieve this? –  Neo Dec 12 '12 at 17:36
@Neo: Thanks for providing this clarification. The selnolig package currently works on an entire document; there's no option (yet!) to disable its operation for a certain range. For now, I'd suggest that you replace all instances of st with \mbox{st} to "hide" in the document's passage of interest. Doing so will "hide" the st character pair from the \nolig{st}{s|t} command. A bit kludgy, I'm afraid. :-( –  Mico Dec 12 '12 at 17:48
Thank you for your reply. Since it's only about a page it's not a lot of work. I have tried your package and it works great. Again, thanks for all the work and help! –  Neo Dec 12 '12 at 18:18
@Neo - I've gone ahead and created the macros \selnoligon and \selnoligoff. As their names suggest, they serve to switch selnolig's macros on and off. (The default switch setting is, unsurprisingly, \selnoligon.) I've uploaded the files affected to the GitHub site; be sure to download both selnolig.sty as well as selnolig.lua. The user guide now features a subsection to mention this new functionality. –  Mico Dec 12 '12 at 19:28
Thank you very much for this feature. –  Neo Dec 12 '12 at 20:14