20

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.

1

1 Answer 1

30
\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.

0

You must log in to answer this question.

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