Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss
Groups keyboard shortcuts have been updated
Dismiss
See shortcuts

I'm devious: "Interwoven alignment preables are not allowed"

31 views
Skip to first unread message

Morten Welinder

unread,
Aug 24, 1996, 3:00:00 AM8/24/96
to

Any shorter way (token-wise) to generate this?

Morten

% TeX it and look in the log, then in the TeXbook.
\halign{#\global\futurelet\foo\relax\cr\cr}
\halign{#\cr\foo}

David Carlisle

unread,
Aug 28, 1996, 3:00:00 AM8/28/96
to te...@tyr.diku.dk

> Any shorter way (token-wise) to generate this?

> % TeX it and look in the log, then in the TeXbook.


> \halign{#\global\futurelet\foo\relax\cr\cr}
> \halign{#\cr\foo}

Not devious enough...


\halign{#\futurelet\foo\foo\cr\cr


David

(This is a very sad thread:-)

Andreas Schwab

unread,
Aug 30, 1996, 3:00:00 AM8/30/96
to

David Carlisle writes:

|>> Any shorter way (token-wise) to generate this?

|>> % TeX it and look in the log, then in the TeXbook.
|>> \halign{#\global\futurelet\foo\relax\cr\cr}
|>> \halign{#\cr\foo}

|> Not devious enough...

|> \halign{#\futurelet\foo\foo\cr\cr

Beat this ;-)

\scrollmode \halign \valign \cr\cr
--
Andreas Schwab "And now for something
sch...@issan.informatik.uni-dortmund.de completely different"

David Carlisle

unread,
Aug 31, 1996, 3:00:00 AM8/31/96
to 1996 11: 57:38 +0200

> Beat this ;-)

> \scrollmode \halign \valign \cr\cr

I could claim that you've cheated by using scrollmode to get past earlier
errors, but that would be sour grapes, so OK I doff my cap to you. You win.

As the TeXBook says

People usually work with \TeX\ at least a year before they find their first
application for |\valign|;....

David

Andreas Schwab

unread,
Sep 2, 1996, 3:00:00 AM9/2/96
to

David Carlisle writes:

|>> Beat this ;-)

|>> \scrollmode \halign \valign \cr\cr

|> I could claim that you've cheated by using scrollmode to get past earlier
|> errors, but that would be sour grapes, so OK I doff my cap to you. You win.

Here's another solution that doesn't need the \scrollmode, only one token
longer:

\halign{\valign#\cr\cr

|> As the TeXBook says

|> People usually work with \TeX\ at least a year before they find their first
|> application for |\valign|;....

So for what else than provoking this error is \valign applicable? ;-)

Mark Wooding

unread,
Sep 4, 1996, 3:00:00 AM9/4/96
to

Andreas Schwab <sch...@lamothe.informatik.uni-dortmund.de> wrote:

> David Carlisle writes:
>
> |> As the TeXBook says
> |>
> |> People usually work with \TeX\ at least a year before they find
> |> their first application for |\valign|;....
>
> So for what else than provoking this error is \valign applicable? ;-)

For doing nasty hacky tables, I think. Here's an example of one I did
earlier (it's actually a table of encoding-specific control sequences,
but that's not terribly important). Sorry it's a little big...

% Now for the actual table. The two columns are essentially independent,
% although they get ruled up as an entity. In particular, horizontal rules
% in one column shouldn't affect the spacing in the other. The horizontal
% rules should have some extra vertical space around them, however. The
% two columns are also approximately the same height, and I'd like to even
% them out. I could play with boxes and measure things out tediously, but
% I can get TeX to do the work if I use a \valign. Each column in the
% \valign is an \halign, which makes life a little more interesting.

% TeX gets a little nasty about me putting the \halign directly into the
% preamble of the \valign, so I'll have to put it into a separate macro.

% [reading this now, I guess this is a workaround for the `interwoven
% preambles' error, but I've forgotten if this really is the case.]

\def\subalign{%
\halign\bgroup% % Then start a table in the column
\bigstrut% % Insert a strut for nice spacing
\quad% % Put some space on the left hand side
\example##\xx% % Then do the example text.
\hfil% % Space out the thing on the left
&% % Start a new column
\quad% % Add some more space here
\qex##\xx% % Describe the alternative name
\unskip% % If nothing there, gobble the quad space!
\hfil% % Pad out with inifinite glue
\quad% % And leave space on the right hand side
\cr% % End of the alignment.
}

\hbox to\hsize{\hfil\vbox{

\hbox{%
\valign{%
\hrule\vskip1\ruleglue% % Add a rule and some vertical space
% (The 1 suppresses the glue's stretch)
\subalign % Do the main table thing here
#% % Insert the \valign text here
\vskip1\ruleglue\hrule% % Insert some more glue and a final rule
\cr% % That's all there is here
%
\omit\leaders\vrule\vfil\cr % On the left hand side, there's a rule
%
% [items -- snip]
%
\egroup\cr
%
\omit\leaders\vrule\vfil\cr % A vertical rule between columns
%
% [items -- snip]
%
\egroup\cr
%
\omit\leaders\vrule\vfil\cr % A final vertical rule
%
}}% One for the \valign, one for the \hbox

% Attach a footnote

\medskip
\hbox{*\enspace Not available in the OT1 encoding}

}\hfil}

% Done!
--
[mdw]

`When our backs are against the wall, we shall turn and fight.'
-- John Major


David Carlisle

unread,
Sep 5, 1996, 3:00:00 AM9/5/96
to m...@excessus.demon.co.uk

mdw> ....

Trust you to spoil this thread by posting TeX code that produces output.

David


Michael Downes

unread,
Sep 8, 1996, 3:00:00 AM9/8/96
to

Andreas Schwab (sch...@lamothe.informatik.uni-dortmund.de) writes:

> So for what else than provoking this error is \valign applicable? ;-)

There are two sorts of applications for which I have used \valign:

1. Printing sequences of cells vertically when the natural input order
is `horizontal'.

For example, I did a table to compare letters of the alphabet as typeset
in different fonts, with this arrangement:

A A A A A . . .
B B B B B . . .
C C C C C . . .
D D D D D . . .
. . . . .
. . . . .
. . . . .

Each column using a different font. With \valign you can write a macro
that takes a font command as its argument:

\def\fontcol#1{#1A& #1B& #1C& ... \cr}

And then adding or deleting columns is very easy.

A transposition of the above arrangement would have been too wide for
portrait-oriented paper because of the type size being used; note also
that it is slightly easier to distribute the letters evenly in a
vertical direction---if the type size is constant---because you can just
use \baselineskip; in the transposed version you'd need to worry about
finding the widest letter among all those being printed and set all the
others in a box of that width.

2. Aligning cell contents vertically.

With \halign you can center, left-align, or right-align cell contents
within their column, even with indeterminate column widths (calculated
by TeX), and therefore for left-to-right or right-to-left text it is
much more commonly applicable than \valign (anyone out there using
\valign with Japanese text?). But even with LR or RL text you may find
some kinds of tables where cell widths are predictable and it is more
useful to have easy control over the vertical positioning of cell
contents within their row. I found \valign useful for this reason not
long ago when printing a table of match scores for a volleyball league.

For what it's worth :-)

Michael Downes
m...@ams.org

0 new messages