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

Suresh Govindachar via texhax <[email protected]> Wed, 7 Jan 2026 13:58:38 -0800
Newsgroups gmane.comp.tex.texhax
Message-ID <[email protected]>
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
}