# two t characters next to each other form one tt glyph

I am using xelatex and linux libertine font. When I write in my text something that contains two t characters next to each other, such as "rotten", it changes these two ts into one tt character. It displays fine in PDF, but it is impossible to copy that or search for that in pdf.

How can I make it just simple two t characters next to each other?

• Does tex.stackexchange.com/q/4397/15925 help? – Andrew Swann Jan 8 '14 at 19:06
• unfortunately it works only in pdftex – George Jan 8 '14 at 19:06
• I think I might have found a solution, I added \setmainfont[Ligatures={NoCommon, TeX} and I can now search for tt – George Jan 8 '14 at 19:09
• How about ro{t}{t}en, to avoid the ligature? Even ro{t}ten should work. – Steven B. Segletes Jan 8 '14 at 19:10
• @StevenB.Segletes using {t} doesn't always work under tex/pdftex either (it depends on details of linebreaking) early editions of the TeXbook suggested that but it was chnaged to suggest using \kern – David Carlisle Jan 9 '14 at 0:43

Disable the Ligatures:

\documentclass{article}
\usepackage{fontspec}
\usepackage{polyglossia}
\setmainlanguage{english}
\setmainfont[Ligatures={NoCommon}]{Linux Libertine O}
\begin{document}

\Huge rotten

\end{document}
• This will also inhibit probably wanted ligatures, such as fi, fl, ffi and ffl. – egreg Jan 8 '14 at 20:40
• that is obvious ... – user2478 Jan 8 '14 at 20:49
• Maybe not for everybody. – egreg Jan 8 '14 at 20:50

If XeLaTeX is the only format that satisfies your typesetting needs -- in particular, if you can't use LuaLaTeX -- you have two options for suppressing the tt ligature while not also turning off all "common" ligatures entirely:

• Insert what TeX calls an implicit kern (of zero width) between the two t characters:

rot\kern0pt ten  % note: no space between "\kern" and "0pt"

• Insert what TeX calls an explicit kern (also of zero width) between the two t characters:

rot\/ten, rot\kern 0pt ten  % note the space between "\kern" and "0pt"

The "italic correction" \/ is a type of explicit kern. By the way, the italic correction method will not give a satisfactory result if the word in question is, in fact, typeset in italics.

Note that this will have to be done separately for each and every instance of "tt".

Final note/comment: The fact that words containing the tt ligature can't be searched in the pdf file if it's compiled via XeLaTeX could be a bug in the implementation of Linux Libertine O under XeLaTeX. First, words that contain the more common "Common" (pun intended) ligatures ff, fi, fl, and ffl are, in fact, searchable if the document is compiled via XeLaTeX. Second, the font family Palatino nova also features the tt ligature. When I compile the MWE below with Palatino nova instead of Linux Libertine O, I encounter no difficulties searching for words that contain the tt ligature (or, for that matter, words that contain the ff, fi, fl, ffi, and ffl ligatures).

% !TEX TS-program = xelatex
\documentclass{article}
\usepackage{fontspec}
\setmainfont[Ligatures={TeX,Common}]{Linux Libertine O}
\begin{document}
implicit kern (\verb+rot\kern0pt ten+): rot\kern0pt ten \& \emph{rot\kern0pt ten}

explicit kern (\verb+rot\/ten+): rot\/ten \& \emph{rot\/ten}

\verb+ro{t}{t}en, rot{}ten+: ro{t}{t}en, rot{}ten --- tt ligature still there!)
\end{document}
• Thank you for the explanation, luckily I don't need any ligatures (or at least for now) so for now I will just go with <code>ligatures=nocommon</code> – George Jan 8 '14 at 19:34
• @George - By disabling all common ligatures, you risk getting inferior typographic results for words that contain the character groups ff, fi, fl, ffi, and ffl. – Mico Jan 8 '14 at 19:35
• @Mico Of course if XeLaTeX actually can't keep texts with ligatures searchable then you basically have to decide whether you want ligatures or a PDF that you can search. Manually disabling one ligature means you have one ugly word and one that you can search for. Often you don't know in advance what specific word you will be searching for. – Christian Jan 8 '14 at 19:51
• @Christian - I'm afraid my answer may not have been as clear as I meant it to be: When using Linux Libertine O as the main text font, XeLaTeX currently does allow searches for words that contain the ligatures ff, fi, fl, ffi, and ffl -- but not for words that contain the tt ligature. I honestly don't know if this is a bug in the font's specification or XeLaTeX (or both...). – Mico Jan 8 '14 at 20:26
• your comments % note: no space between "\kern" and "0pt" seem to imply that there is a difference if you put a space after \kern but there is none, that space would never be tokenised, as it follows a command name, so it will not affect anything. (also an implicit kern is one implicitly added by the font metrics \kern and \/ make explicit kerns (as they are explicit in the markup) (not that these terminology quibbles affect the answer) – David Carlisle Jan 8 '14 at 23:48

If you just want to disable the tt ligature without disabling the others and don't want to manually add a kern each time, you can use the xetex charclass mechanism.

I don't seem to have the font so I disabled ff in arial instead, also I inserted a 10pt kern rather than 0pt, to make it more obvious.

Note in the second line ff is separated but the fi ligature works,

\documentclass{article}
\usepackage{fontspec}
\setmainfont{Arial}

\begin{document}
\showoutput

ffoo difficult safe

\XeTeXinterchartokenstate=1
\newXeTeXintercharclass\fchar
\XeTeXcharclassf=\fchar
\XeTeXinterchartoks\fchar\fchar{\kern10pt}

ffoo difficult safe

\end{document}

So for your problem it becomes

\documentclass{article}
\usepackage{fontspec}
\setmainfont[Ligatures={TeX}]{Linux Libertine O}
\XeTeXinterchartokenstate=1
\newXeTeXintercharclass\tchar
\XeTeXcharclasst=\tchar
\XeTeXinterchartoks\tchar\tchar{\kern0pt}

\begin{document}
rotten fisticuffs
\end{document}

• This is a great alternative to the selnolig package for XeLaTeX. It could also be an alternative answer to this question. – Manuel Jan 9 '14 at 1:05