10

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. Commented Jul 8, 2018 at 7:25
  • @ShreevatsaR Nice thanks, I wasn't aware of it and checked plain.tex for its definition before.
    – nox
    Commented Jul 8, 2018 at 7:33

1 Answer 1

12

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
    +1. Using \begingroup and \endgroup to surround the ragged-right material doesn't seem to be such a bad idea after all... :-)
    – Mico
    Commented Jul 8, 2018 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
    Commented Jul 8, 2018 at 7:02
  • @nox, see tex.stackexchange.com/questions/7278/reasons-to-use-plain-tex
    – lhf
    Commented Jul 8, 2018 at 11:57

You must log in to answer this question.

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