Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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?

share|improve this question
1  
Does tex.stackexchange.com/q/4397/15925 help? –  Andrew Swann Jan 8 at 19:06
    
unfortunately it works only in pdftex –  George Jan 8 at 19:06
2  
I think I might have found a solution, I added \setmainfont[Ligatures={NoCommon, TeX} and I can now search for tt –  George Jan 8 at 19:09
1  
How about ro{t}{t}en, to avoid the ligature? Even ro{t}ten should work. –  Steven B. Segletes Jan 8 at 19:10
1  
@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 at 0:43
show 3 more comments

3 Answers 3

up vote 3 down vote accepted

Disable the Ligatures:

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

\Huge rotten

\end{document}
share|improve this answer
3  
This will also inhibit probably wanted ligatures, such as fi, fl, ffi and ffl. –  egreg Jan 8 at 20:40
1  
that is obvious ... –  Herbert Jan 8 at 20:49
3  
Maybe not for everybody. –  egreg Jan 8 at 20:50
add comment

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).

enter image description here

% !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}
share|improve this answer
    
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 at 19:34
3  
@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 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 at 19:51
1  
@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 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 at 23:48
show 3 more comments

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.

enter image description here

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
\XeTeXcharclass`f=\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
\XeTeXcharclass`t=\tchar
\XeTeXinterchartoks\tchar\tchar{\kern0pt}

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

enter image description here

share|improve this answer
1  
This is a great alternative to the selnolig package for XeLaTeX. It could also be an alternative answer to this question. –  Manuel Jan 9 at 1:05
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.