7

I have played around with plain tex for a while now and can't figure out how to get back to justified text after e.g. \raggedright. Can it really be that I have to use \raggedright in a group \begingroup\raggedright...\endgroup in order to restore justified text? There has to be a way to get back the original justifying.

edit: I could get something similar to justified texts by using

\spaceskip3pt plus 2pt minus 1pt

But this is not the original justifying.

2
  • 1
    You can use \show\raggedright to have TeX stop and show what it is defined as. Jul 8 '18 at 7:25
  • @ShreevatsaR Nice thanks, I wasn't aware of it and checked plain.tex for its definition before.
    – nox
    Jul 8 '18 at 7:33
10

Just revert the settings of \raggedright.

\def\justifying{%
  \rightskip=0pt
  \spaceskip=0pt
  \xspaceskip=0pt
  \relax
}

\raggedright

\input knuth

\justifying

\input knuth

\bye

enter image description here

3
  • +1. Using \begingroup and \endgroup to surround the ragged-right material doesn't seem to be such a bad idea after all... :-)
    – Mico
    Jul 8 '18 at 7:00
  • Indeed, but since I am learning, I am trying out things :P Why should I use plain tex nowadays? It's more trying to handle the basics, too.
    – nox
    Jul 8 '18 at 7:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.