# A center environment for plain TeX

In TeX, one can center a single line of text with \centerline. How would one implement a center justification environment for a single long line of text in plain TeX without the addition of any packages. That is, the first line of TeX should justify to the center. Any wrapping text should also justify to the center.

-
Welcome to TeX.sx! – Marco Daniel Aug 29 '12 at 9:36
Thank you, egreg. This answers my question. – C j Aug 29 '12 at 11:56

\def\startcenter{%
\par
\begingroup
\leftskip=0pt plus 1fil
\rightskip=\leftskip
\parindent=0pt
\parfillskip=0pt
}
\def\stopcenter{%
\par
\endgroup
}
\long\def\centerpars#1{\startcenter#1\stopcenter}


You can now choose between

\startcenter
Some text to be centered
\stopcenter


and

\centerpars{Some text to be centered}


An empty line in the text will end the line.

-
Thank you, egreg. This answers my question. – C j Aug 29 '12 at 11:55