Print

Print


At 20.35 +0100 2001-01-31, Frank Mittelbach 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
>
>\begin{tabular}[t]{..}
>
>will have broken text inside, wouldn't it? or do i overlook something?

There is an \ifmmode in \@inmathwarn, which appears in both \@current@cmd
and \@[log in to unmask] If that isn't fully expandable all text command might be
affected by broken ligatures and kerns.

>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

Simply fiddling with the definition of \ifmmode isn't sufficient for taking
care of all related problems. The small document

\documentclass{article}
\usepackage{array}
\usepackage[T1]{fontenc}

\begin{document}

\begin{tabular}{>{\fontencoding{OT1}\selectfont}l}
  a\\
  \r{a}\\
  \'{a}
\end{tabular}

\end{document}

will try to use the T1 definitions in an OT1 font; the log file contains:
Missing character: There is no ^^e5 in font cmr10!
Missing character: There is no ^^e1 in font cmr10!

Only the first row comes out right.

However, I noticed that a \noexpand\empty will stop the alignment mechanism
from looking any further for an \omit, so it isn't necessary to insert an
actual command to prevent it from scanning any further. Unfortunately a
\noexpand\empty also breaks ligatures (and most likely kerning as well; I
haven't checked) so simply inserting that into e.g. \IeC and \T1-cmd and
friends isn't the solution either.

What I suspect is the right solution is to have \protect set to
\@unexpandable@protect when scanning for \omit and have it reset to
\@typeset@protect in the column template---then the robustness mechanisms
for normal robust commands, text commands, and in the \IeC command
respectively would take care of sorting things out. I doubt this can be
done by patching the \halign primitive, but it could be built into e.g. the
array package.

Lars Hellström