# [texhax] \halign in terms of macro

Uwe Lück uwe.lueck at web.de
Tue Jul 28 08:19:20 CEST 2009

```[I failed to "reply to all"]

At 00:08 22.07.09, Vafa Khalighi wrote:
>On Wed, Jul 22, 2009 at 3:35 AM, Uwe Lück <uwe.lueck at web.de> wrote:
>>At 10:39 21.07.09, Vafa Khalighi wrote:
>>>Is it possible to define the control sequence \semihalign with macro
>>>programming which behaves exactly like \halign but in its definition
>>>\halign is not used at all.
>>
>>\let\semihalign\halign !?
>>
>>Admittedly, this is not really "macro programming". And \semihalign will
>>behave differently if another macro calls \halign: \semihalign will not
>>feel much being called.
>
>What I meant was defining \semihalin in a way that in its definition
>\halign does not exist all. So in other words, lets assume \halign does
>not exist at all, how would you define \halign in terms of macros?

Donald Arseneau sketched the (informal) complexity of the \halign algorithm
under subject `Alignments and Knuth's uncertainty principle ...' in January
here, see archive. The algorithm was not entirely revealed. It can be
derived from the code underlying \halign. I believe that a very small
fragment of TeX is Turing-complete, excluding primitives for typsetting ...
to define a macro "emulating" \halign in TeX minus \halign measuring,
storing, comparing all the cell widths should suffice and work with \wd and
more general calculating and storing facilities. I expect that dealing with
\hfil and \hfill will be quite complex here. So I believe the answer to
your question, Vafa, is `yes,' but it is not likely that I will ever tell
such a macro emulating \halign.

Donald Arseneau then also wrote that \halign is quite primitive or not very
smart as compared to table interpretation of modern browsers, so why not
emulate by TeX macros such a modern table interpreter instead of \halign?

This reminds me of LuaTeX ...

not really hoping it helps -- Uwe.

```