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.

The Amazon Kindle has a default font which features small caps and ligatures, but not ligatures for small caps. For this reason, when it sees ligatures (even common ones, such as "ff"), it renders them in lowcase instead, which is ugly.

I wouldn't like to disable ligatures for everything, but having lowcase letters in the middle of a small caps word is ugly.

Is there a way (preferably using .4ht files) to disable ligatures in small caps?

Is there maybe a way to disable small caps for a given environment/string?

Edit:

Apparently, this is a generic problem with CSS and font-variant: small-caps as I get the same result in my browser.

Edit 2:

CSS3 adds a font-variant-ligatures setting to enable different kind of ligatures using OTF fonts. When using small caps with this setting, ligatures are automatically disabled, just as with LaTeX. However, not a lot of browsers implement it, and calibre's ebook-convert, which I use, does not seem to support it either.

Edit 3:

My problem with TeX4HT comes from the fact that I have redefined \textsc for Tex4HT:

% Reconfigure small caps
\NewConfigure{textsc}{2}
\renewcommand\textsc[1]{%
\a:textsc#1\b:textsc
}
\Configure{textsc}{\Tg<span class="small-caps">}{\Tg</span>}
\Css{span.small-caps{
font-variant:small-caps;
}}

The reason for doing so is that TeX4HT's default converts all letters to uppercase and creates one <span> tag per character, which is heavy, ugly, and does not produce real small-caps (although it does prevent ligatures, since all letters are enclosed in <span> tags). So I'd rather use a cleaner approach, by disabling ligatures in TeX and using one <span> element only, without changing letters to uppercase.

Also, I run TeX4HT with htlatex doc.tex 'ebook.cfg,xhtml,charset=utf-8' ' -cunihtf -utf8 -cvalidate'

share|improve this question
    
see us.generation-nt.com/answer/… –  michal.h21 Aug 6 '12 at 11:22
    
but I cannot get it to work –  michal.h21 Aug 6 '12 at 11:22
    
@michal.h21: this is to disable all ligatures anyway, but I only want to disable them in small caps. –  ℝaphink Aug 6 '12 at 11:28
    
How are the small caps made in you document? A minimal document \documentclass{article} \begin{document} \textsc{sufficient} \end{document} run through htlatex has no ligatures. –  Andrew Swann Aug 8 '12 at 9:54
    
Oh! I just understood why htlatex produces one <span> node per letter… I found the produced document ugly (also, not really small caps), so I redefined \textsc in my .4ht in order to have a single <span> tag… –  ℝaphink Aug 8 '12 at 10:41

2 Answers 2

up vote 7 down vote accepted

You might make use of the following code to suppress character level <span> node creation:

\Configure{htf}{4}{+}{}{}{}{}{}{}{}

so that you will get:

<span class="cmcsc-10">sufficient</span>

which is the default behavior when character level <span> node is suppressed.

share|improve this answer

I don't know if microtype is compatible with tex4ht, but microtype can disable ligature, both for fonts and individually. See section 8 in the manual.

The code would be something like:

\usepackage[protrusion=false}{microtype}
\DisableLigatures[ff,ffi,fj,fi]{encoding = *, family = sc* }

Disclaimer: Untested!

share|improve this answer
    
It sounds like a good idea. Unfortunately, it doesn't work. I've tried adding to to <myclass>.4ht and <mysettings>.cfg and it won't do anything… –  ℝaphink Aug 6 '12 at 9:37
    
Perhaps you can run the html-file tex4ht produce through a search and replace filter: search "ligature" replace "the letters"? –  Sveinung Aug 6 '12 at 10:45
    
Did you try microtype with protrusion=false tex4ht produces .dvi-files, doesn’t it?. microtype is mainly for .pdf. –  Sveinung Aug 6 '12 at 11:06
    
The search and replace is what I've been doing so far, using sed in a post-build script. I'd rather get rid of that if possible. –  ℝaphink Aug 6 '12 at 11:25
    
From the documentation of microtype it seems to be compatible with tex4ht. The source has hooks with reference to tex4ht (see the entry in the manuals index). I have to admit that I do not have the necessary skills to sort out how to get the two packages to interact, if possible. –  Sveinung Aug 6 '12 at 11:55

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.