[XeTeX] Long dash "--" in Latex

Ross Moore ross at maths.mq.edu.au
Fri Jul 2 10:24:54 CEST 2004

On 02/07/2004, at 5:30 PM, Bruno Voisin wrote:

> Le 2 juil. 04, à 03:56, Musa Furber a écrit :
>> It seems beneficial to provide some sort of compatibility for some of 
>> the more common LaTeX ligatures, such as `, ``, ', '', -, --, and 
>> ---.
> But then you would also have to provide compatibility for accents like 
> \'e = é, and quotes ` = ‘, ' = ’, etc., and \S = §, and probably many 
> more like these, and it would end up like reinventing the wheel, isn't 
> it?

Yes and no.

Yes, in the sense that for new manuscripts, you might as well use the 
keyboard inputs
that are available to you, and clearly will work since it's Apple's own 
structures that are being used.

No, in the sense of compatibility; both for
   a.  older manuscripts that you may want to reuse with new fonts;
   b.  collaborative work with others, not using a Mac or XeTeX.

LaTeX already has the mechanism to handle accents, according to the
font-encoding. I've written previous posts about how to do this.
For special characters like \S \$ etc. which use a macro-definition,
then adapting these for the font-encoding shouldn't be difficult.

It's much harder to adapt the ligature mechanism, since this is
something that doesn't use macros.
However, with \- already defined as a 'optional hyphen', there
is a real possibility to overload it and use  \-- and \--- to get
the endash and emdash respectively. This is viable since \-- doesn't
make much sense as an optional hyphen followed by a real one
(--- in English, that is; what about other languages ???).

Then \- could be redefined to "look ahead" at the next token
and give the optional hyphen when it isn't another '-'.
When it *is* another '-', then gobble it up, and look ahead again
to decide between the endash or emdash.

Now to get compatibility, you would just scan the input-source
for -- , using a Find/Replace to make \-- as needed.

Other ligatures may not be so easy to work-around.
There are tricks that can be done using the \catcode ,
which is how Babel tends to work. This begs the need
for compatibility with other packages, and being careful
about the order in which various packages are loaded.



> Bruno Voisin
> _______________________________________________
> XeTeX mailing list
> postmaster at tug.org
> http://tug.org/mailman/listinfo/xetex
Ross Moore                                         ross at maths.mq.edu.au
Mathematics Department                             office: E7A-419
Macquarie University                               tel: +61 +2 9850 8955
Sydney, Australia                                  fax: +61 +2 9850 8114

More information about the XeTeX mailing list