[XeTeX] fontspec v1.7

Ross Moore ross at ics.mq.edu.au
Thu Jun 23 13:16:21 CEST 2005


On 23/06/2005, at 5:58 PM, Hans Hagen wrote:

> Will Robertson wrote:
>
>> Ross Moore wrote:
>>
>>> how shall we proceed to implement mathematics
>>> properly ?
>>>
>>> Indeed, what does *properly* actually mean now ?
>>>
>> I would suggest that *properly* means that a unicode maths font  
>> can be set up in XeTeX to typeset maths in a maths environment, up  
>> to the level of writing in the literal glyphs if that is desired  
>> (but control sequences in general would be easier).
>> There are many problems with this, the biggest, as I see it, being  
>> that TeX needs all those extra font dimensions that unicode fonts  
>> simply lack, as far as I am aware. But if I recall correctly,  
>> Michael Downes wrote a package that dealt with maths doing all of  
>> the spacing explicitly, so it's at least possible in theory. (breqn?)
>> But this is a further reaching goal. The problem started with  
>> fontspec doing bad things with maths, and this is something that  
>> needs to be fixed.

>> First: do we actually want \mathrm to take the font of the text?

Not necessarily; indeed, probably not.

>> If so, then we simply need to remove the Knuthian assumptions that  
>> the maths font can take various accents and analphabetics from the  
>> text font and replace those definitions with fixed references to  
>> glyphs in a similarly old-fashioned font. So, if no other maths  
>> fonts are loaded, then the maths accents should be defined in  
>> terms of Computer Modern, and probably similarly with euler.  
>> lucbmath I haven't yet looked through but I'm sure that  
>> situation's similar.
>> Do we agree so far? For now, maths is strictly legacy, and the  
>> maths font packages need to be patched in XeLaTeX to reflect this.  
>> Beyond this I really don't know enough of the details to comment,  
>> yet...
>>
>
> there is work in progress (was discussed at eurotex) to come to a  
> new math font specification; will take some time;
>
> somehow i feel that the assumption that determining from the glyphs  
> how spacing should look (i.e. is sin a function name (roman) or is  
> it a multiplication of three variables) is not doable

Certainly it is not doable from the glyphs alone; but if you take  
into account
that we are inside math-mode, and that an upright font is being used,  
then
you can deduce what is intended.

> and comparable to assuming that using a greek character means that  
> we're typesetting greek (or making xetex trigger german hyphenation  
> due to an ediaeresis in the text stream). The fact that that a  
> symbol (glygh) has to do with math does ot imply that math is  
> involved.

Agreed.
But there is the following fact.

The Code2001 font has "Alphanumeric Mathematical Symbols",
which include math-italic, upright, bold, and bold-italic
variants.

XeTeX *can* typeset with these --- contrary to what I said in
a previous message. You need to use combining pairs.

For example, the 'a' as in $a$ is obtained using:
      \char"D835\char"DC4E

Other available forms are:

\char"D835\char"DC4E  %  math-italic
\char"D835\char"DC1A  %  bold upright
\char"D835\char"DC82  %  bold italic  ( \mathbf )
\char"D835\char"DCB6  %  script  ( \mathcal )
\char"D835\char"DCEA  %  script bold
\char"D835\char"DD1E  %  fraktur
\char"D835\char"DD52  %  double-struck  ( \mathbb )
\char"D835\char"DD86  %  bold fraktur
\char"D835\char"DDBA  %  upright sans-serif
\char"D835\char"DDEE  %  bold upright sans-serif
\char"D835\char"DE22  %  italic sans-serif
\char"D835\char"DE56  %  bold italic sans-serif
\char"D835\char"DE8A  %  mono-spaced

Presumably there is a standard that determines these code-points.
(I'm sure  bb  can tell me what it is.)

It would not be unreasonable to have XeTeX supply these code-points
when in math-mode, provided there is a font available to support them
(such as Code2001).

However, XeTeX would still need to supply the correct spacing for
mathematics, just as TeX does already.


Note that there is no  math-upright (of medium weight).
Thus  \mathrm  would use ordinary characters, with their usual spacing.
This need *not* be the normal text-font for the document
    (e.g., use Code2000  when math is in  Code2001 , say).
Of course \text is different from \mathrm , being really a temporary
escape out of math-mode, back into text-mode.
(Authors need to be educated to respect this distinction!)



How do accents get applied ?

There are no combining characters such as "0307  and "0308 in Code2001.
But there are such in Code2000 (and other fonts, of course). So I don't
see it being reasonable to expect the math-accents to be placed by the
font itself. It'll have to be done either within XeTeX itself, or by
fudging it in macros (e.g. something like Bruno's attempt).



But there is another aspect as well, namely:
   how does one search for mathematical expressions in the PDF ?

For example, search for instances of  sin x  (as from  $\sin x$ ).

Clearly the user enters plain text into the search-text box;
but the engine must be smart enough to match  \char"D835\char"D...
forms as above.

Alternatively there could be some hidden fields containing plain
text that are somehow related to the visible glyphs. Searching
then takes place within these hidden fields, with found matches
being indicated in the visible parts.
(I implemented such a scheme in JavaScript, for TUG2002 in India.)



Hans, how do the above ideas compare with the discussions at EuroTeX ?


Cheers,

     Ross


>
> Hans
>
>
> -----------------------------------------------------------------
>                                           Hans Hagen | PRAGMA ADE
>               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
>      tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com
>                                              | www.pragma-pod.nl
> -----------------------------------------------------------------
>
> _______________________________________________
> 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  2109                            fax: +61 +2 9850 8114
------------------------------------------------------------------------




More information about the XeTeX mailing list