[XeTeX] typesetting hyphen in xelatex

Zdenek Wagner zdenek.wagner at gmail.com
Wed Dec 19 18:34:00 CET 2012


2012/12/19 Philip TAYLOR <P.Taylor at rhul.ac.uk>:
> I don't speak LaTeX, Sasi, but this hybrid approach
> seems to work :
>
> \documentclass {minimal}
> \font \bodyfont = "Arial Unicode MS:mapping=tex-text"
> \begin {document}
> \bodyfont
> Number range : 80--95
>
> Em-dash : used to set off --- parenthetical -- clauses
>
> ``Smart quotes''
> \end {document}
>
Philip is absolutely right. I will just add one note.

In classical TeX -- and --- work because they are defined as ligatures
in the TFM files. OpenType fonts in XeTeX do not use TFM. The same
feature could be implemented via GSUB but I am afraid that OpenType
fonts do not generally define such TeX specific features. In LaTeX
(using the fontspec package) you have three possibilities:

1. \addfontfeatures{Mapping=tex-text} – this adds TeX like ligatures
(ie --, --- ``, '') to the current font till the end of the current
group

2. \setmainfont[Mapping=tex-text]{fontname} – this adds the TeX like
ligatures to the main font (similarly for other fonts, see the
fontspec manual)

3. \defaultfontfeatures{Mapping=tex-text} – this adds the TeX like
ligatures to all fonts declared later on

If you still get them wrong, it may signal an error in the font used.
Try to use the font in a WYSIWYG application yusing the very same font
and look what you see if you copy&paste the following two lines (I
have both dashes on my keyboard)

-- = –
--- = —

आशा कि अब सब ठीक होगा।

> Philip Taylor
> --------
> Sasi Kumar wrote:
>> Thank you for both suggestions.So sorry. I did try both separately, but still did not succeed. I couldn't get either the smart quotes or the long dash. Am willing to study any document that is available online if that would help. The reason I am insisting on this is that I am preparing a document for publication and I would like it to look as "authentic" as I can.
>>
>> Thanks for the help and sorry for the trouble.
>>
>> Best regards,
>> Sasi
>
>
> --------------------------------------------------
> Subscriptions, Archive, and List information, etc.:
>   http://tug.org/mailman/listinfo/xetex



-- 
Zdeněk Wagner
http://hroch486.icpf.cas.cz/wagner/
http://icebearsoft.euweb.cz



More information about the XeTeX mailing list