LATEX-L Archives

Mailing list for the LaTeX3 project


Options: Use Forum View

Use Monospaced Font
Show Text Part by Default
Condense Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Mailing list for the LaTeX3 project <[log in to unmask]>
Vladimir Volovich <[log in to unmask]>
Mon, 20 Jan 2003 00:43:23 +0100
Mailing list for the LaTeX3 project <[log in to unmask]>
text/plain (161 lines)

following up an old email... :) but this is related closely to your recent email
on "LICR objects in math"

On Wed, 31 Jan 2001 20:35:31 +0100, Frank Mittelbach
<[log in to unmask]> wrote:

>I wrote:
> > do you mind outlining the solution in a few sentences? how do you want
> > to be able to find out that you are not in math but will be once
> > something (eg tha actual letter) triggered the \halign u part without
> > actually triggering it (with something like \relax which kills
> > ligaturing)?
>but by now i got a chance to looked at it. quite a nice idea but i don't think
>it is fully correct yet. you change \if@mmode at each \halign thus an \halign
>that doesn't generate math mode cells will have this setting throughout, eg
>something like
>will have broken text inside, wouldn't it? or do i overlook something?

no, it would not have broken text, because \halign is redefined in the
following way:


and \if@mmode@ is defined like this:

so when you have \begin{tabular}[t]{..}, then the FIRST character inside the
will execute \if@mmode@ which will reset \if@mmode to just \ifmmode, thus
preserving all ligatures!

i.e., each cell will at the beginning have \if@mmode defined as
\reset@if@mmode \ifmmode, but after the first inputenc-generated letter,
it will go to \ifmmode.

here's an example:


\makeatletter \showboxdepth\maxdimen \showboxbreadth\maxdimen \tracingonline1
\setbox0=\hbox{^^c7^^c4 ^^c7^^c4 ^^c7{}^^c4}

^^c7^^c4 ^^c7^^c4 ^^c7{}^^c4
^^c7^^c4 ^^c7^^c4 ^^c7{}^^c4


>assuming that the analysis is right, what follows is that instead of changing
>\halign internally you would have to change those uses of \halign where it is
>needed (only) and that cuts through all existing macros and isn't transparent
>ie you can't simply get it done by a single package or inclusion of code in
>the kernel you actually have to change every second use of \halign

there exists a SMALL probability that the kern will be broken only ONCE (for the
two characters) in the cell, but that can hallen only once per cell.
This will happen if the cell contents meets all these conditions:
1) there is a combination of 7-bit character followed
   by 8-bit character, and there's a kern for them in a TFM file.
   (note that for cyrillic texts, this is very rare - the word either consists
   of all cyrillic letters, or all latin ones, not moxed - and there's usually
   no kerning between cyrillic and latin letters)
2) there were no 8-bit characters in this cell before, i.e.
   such 8-bit character preceeded by 7-bit one is the first occurrence of
   8-bit char in the cell (kerns between all other characters in this cell
   will be OK).

> > the approach used in the mathtext package proved to be stable enough:
> > i know a lot of people do use it for `transparent' cyrillic letters in
> > math, and i did not hear about bug for a long time now. the mechanism
>you don't see the problem unless you look closely at kerning and ligatures
>(and you use fonts that have them) but it may be the case that this is
>sufficiently rare with the type of characters it is used so far. with latin
>fonts i guess this would become far more visible.

well, you are correct, - for latin fonts, there's usually a kern between
V and \'A, so so if the cell would include
some ascii letters ... V\'A other text
then the kern between V\'A would have been lost - but only for these two letters
in the cell - not any other!

this is demonstrated by the following example:


\makeatletter \showboxdepth\maxdimen \showboxbreadth\maxdimen \tracingonline1
\setbox0=\hbox{V^^c1 V^^c1 V{}^^c1}

V^^c1 V^^c1 V{}^^c1
V^^c1 V^^c1 V{}^^c1


you'll see the kern lost for the first V\'A combination in the cell,
but not for the second (and not for any other letter pairs in the cell).
(if it was a combination of accented letter PRECEEDING the non-accented
letter, then the kern would not have been lost)

I used
in the above example because the mathtext package redefines only
the \DeclareTextSymbol command, but not the composite commands like \'A
(which were not needed for cyrillic, but can be supported too).

Well, the above example shows that there is indeed a possible problem with latin
texts - in some situations one kern in a cell may be lost.

But, i see a solution to this: we can redefine A FEW internal LaTeX commands
which build preambles for alignments to insert \reset@if@mmode in the
before the "#" - i.e. to make sure that \if@mmode will be reset to \ifmmode
before the first character in a cell is executed.

There are only a very small number of places where latex has (or builds)
the alignment preambles, so the changes would not be big...

(but for cyrillic letters, this is probably not needed at all, as mentioned