8

I have a weird problem. I want to indent a \halign, but it seems no matter what I try, it just does not like to be indented! Things I've tried:

text
\indent\halign{&#\hfil\cr
  foo& bar\cr
  baz\cr}
\bye

and

text
\hbox to\parindent{\hfil}\halign{...

and

text

\indent\halign{...

and

text
\hskip\parindent\halign{...

and

text
\hglue\parindent\halign{...

And variations of these. How can this command be so stubborn?

Note that I know a way to make it indented:

text
\tabskip\parindent\halign{...

but I don't want to use that because it will affect \noaligned \hrules and such.

1 Answer 1

13

\halign is vertical mode material, so either you need to put the space into the alignment rows (using tabskip glue or by putting space into the preamble for the first column) or (if you don't mind stopping page breaking) put the whole alignment into a \vbox then use

\leavevmode\vbox{\halign.....

In which case it would get the normal parindent indentation, which is more or less LaTeX's tabular environment.

2
  • I got bit by the vertical mode yet again! sigh when will I learn. Thanks!
    – morbusg
    Commented Feb 20, 2012 at 10:19
  • More precisely, \halign is a <vertical command> (TeXbook, p. 286), so its appearance ends horizontal mode by adding a \par token.
    – egreg
    Commented Feb 20, 2012 at 10:29

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .