Re: Plain TeX: Aligning to an earlier centered line's ends

Suresh Govindachar <[email protected]> Thu, 8 Jan 2026 09:49:26 -0800
Newsgroups gmane.comp.tex.texhax
Message-ID <[email protected]>
On Thu Jan 8 00:33:25 CET 2026 Jim Diamond wrote:
 > On Wed, Jan  7, 2026 at 13:58 (-0800), Suresh Govindachar via texhax 
wrote:
 >
 >> On 1/7/2026 6:17 AM, Suresh Govindachar wrote:
 >>> Hello,
 >
 >>> A page has a centered line (via "\centerline{}"): "Left end of
 >>> a centered line; its right end."
 >
 >>> The line below that, "Aligned to L", needs to be left-aligned to
 >>> "L" of the centered line.
 >
 >>> The line below that, "Aligned to period.", needs to be
 >>> right-aligned to "." of the centered line.
 >
 >>> How exactly to achieve this (create a hbox to the size of the
 >>> centered line, center this hbox, insert the text inside this
 >>> hbox with hss on the right for left-alignment and hss on the
 >>> left for right alignment)?
 >
 >> \setbox0=\hbox{Left end of a centered line; its right end.}
 >> \centerline{\copy0}
 >
 >> \vskip1in
 >> \hbox to \hsize{%
 >>   \hss
 >>   \hbox to \wd0{%
 >> Aligned to L\hss
 >>   }%
 >>   \hss
 >> }
 >
 >> \vskip1.5in
 >> \hbox to \hsize{%
 >>   \hss
 >>   \hbox to \wd0{%
 >>     \hss Aligned to period.
 >>   }%
 >>   \hss
 >> }
 >
 > Hi Suresh,
 >
 > you may have already seen the nice \halign solution someone posted
 > (sorry to the poster, I deleted the message after reading it).
 >
 > But if you don't want to use that for some reason, you can
 > simplify your solution above (which I think has a space after
 > "Aligned to period." anyway) by using \centerline{}.  Here is
 > something like your solution, without the \vskips.
 >
 > \setbox0=\hbox{Left end of a centered line; its right end.}
 > \centerline{\copy0}
 > \centerline{\hbox to \wd0{Aligned to L\hss}}
 > \centerline{\hbox to \wd0{\hss Aligned to period.}}
 >
 > Cheers.

The usage is for a title page of a book, and I could not figure out
how to control the vertical layout with David Carlisle's \halign
approach.

Thanks for the simplification (and spotting the potential bug of an
unintended space).