The \obeylines command tells TeX to preserve line endings, which is useful for poetry and various other things. I can limit the effect of \obeylines by wrapping it in a scope, like so:

    We obey, and end up on separate lines.
    We obey.
We disobey, and end up on the same line.
We disobey.

This is practically always the way to go, or newlines breaking up formatting code will break up more than that. But, out of curiosity: is there also a command that resets TeX's handling of line endings? Googling for \disobeylines turned up some roll-your-own implementations, but I'm curious whether Donald Knuth wrote an antidote into Plain TeX itself, too.

  • 1
    No, there's no "official" one. Knuth recommends to use it in a group.
    – egreg
    May 25, 2012 at 14:41

1 Answer 1


The definition of \obeylines is

% In \obeylines, we say `\let^^M=\par' instead of `\def^^M{\par}'
% since this allows, for example, `\let\par=\cr \obeylines \halign{...'
{\catcode`\^^M=\active % these lines must end with %
  \gdef\obeylines{\catcode`\^^M\active \let^^M\par}%
  \global\let^^M\par} % this is in case ^^M appears in a \write

So you can try:

\def\disobeylines{\catcode`\^^M=5 }

The example:

\def\disobeylines{\catcode`\^^M=5 }

    We obey, and end up on separate lines.
    We obey.
We disobey, and end up on the same line.
We disobey.



As egreg pointed out in his comment, Donald Knuth doesn't provide any \disobeylines. In the TeXBook at page 94 the command \obeylines is introduced with the following paragraph:

You may have several consecutive lines of input for which you want the output to appear line-for-line in the same way. One solution is to type \par at the end of each input line; but that’s somewhat of a nuisance, so plain TeX provides the abbreviation \obeylines, which causes each end-of-line in the input to be like \par. After you say \obeylines you will get one line of output per line of input, unless an input line ends with % or unless it is so long that it must be broken. For example, you probably want to use \obeylines if you are typesetting a poem. Be sure to enclose \obeylines in a group, unless you want this "poetry mode" to continue to the end of your document.

  • or better \def\disobeylines{\catcode ‘\^^M=5 } May 25, 2012 at 14:33
  • @DavidCarlisle: Do you mean the space? May 25, 2012 at 14:35
  • 4
    yes otherwise \disobeylines 1 is a good number... doesn't do what you want May 25, 2012 at 14:43
  • @DavidCarlisle: Indeed -- every time I forget this case. May 25, 2012 at 14:44
  • 1
    @Gaussler I wrote the truth, but not the whole truth, added more of the plain tex context for the definition. Nov 21, 2023 at 9:16

You must log in to answer this question.

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