\obeycr & \restorecr

The \obeycr command makes a return in the input file (‘^^M’, internally) the same as \\, followed by \relax. So each new line in the input will also be a new line in the output. The \restorecr command restores normal line-breaking behavior.

This is not the way to show verbatim text or computer code. Use verbatim (see verbatim) instead.

With LaTeX’s usual defaults, this

aaa
bbb

\obeycr
ccc
ddd
   eee

\restorecr
fff
ggg

hhh
iii

produces output like this.

  aaa bbb
  ccc
ddd
eee

fff ggg
  hhh iii

The indents are paragraph indents.

© 2007–2018 Karl Berry
Public Domain Software
http://latexref.xyz/_005cobeycr-_0026-_005crestorecr.html