I would like to ignore \par commands in a predefined LaTeX file. I simply tried:


but this does not work as \par is ending the paragraph within the \renewcommand command.

! Paragraph ended before \renew@command was complete.

Is there a way to do this?

  • 3
    Welcome to TeX.SE. And congratulations to have found a way to shoot yourself into your foot with this idea ;-) Sorry!
    – user31729
    Nov 8, 2017 at 17:50
  • 2
    This seems like it could go wrong in many different ways. Why are you wanting to redefine \par?
    – Teepeemm
    Nov 8, 2017 at 17:58
  • 2
    Maybe it is better to do a search and replace with your editor. You can also run a script to do that (sed, ...). Not everything has to be done within TeX. And redefining \par seems like a particularly risky idea.
    – moewe
    Nov 8, 2017 at 18:02
  • 2
    I'd say it is more dangerous at the TeX level than to fix the input that causes the unwanted .tex code.
    – moewe
    Nov 8, 2017 at 18:21
  • 3
    You can do \def\par{}; then wait until TeX exits from some infinite loop. :-) Really, it's a very dangerous thing to do, because in several occasions TeX inserts \par automatically and in such circumstances it may not exit from the loop.
    – egreg
    Nov 8, 2017 at 18:22

2 Answers 2


You can easily redefine \par:


But it is only safe to do this in very controlled contexts, for example:

This document will not terminate and you will need to kill the process






  • Is there a way to completely un-hardcode things from TeX? Or is somehow \par (or some other thing) entirely hardcodded?
    – Manuel
    Nov 8, 2017 at 20:04
  • @Manuel many aspects of \par are hardcoded, (so that the behaviour can be customised) when tex needs to end a paragraph it does not (normally) use the primitive end-of-para action it simply inserts \par (as it does at a blank line) so this allows you to define \par to do interesting things, but if (as here) those things do not include ending a paragraph then things can easily go wrong, here it sees \hrule so needs to get out of hmode, so inserts a \par then it sees \hrule so inserts a \par then.. Nov 8, 2017 at 20:51
  • So in TeX there's no way to tell TeX to never use an explicit \par and rather use its meaning (or \engraf or an alternative)? Are there more things that are hardcoded into the program?
    – Manuel
    Nov 8, 2017 at 20:56
  • 3
    @Manuel as far as I can think \par is the only command name that can not be changed any other primitive you can save the primitive under another name then redefine the original name to be anything (or make it undefined) but tex itself inserts \par tokens Nov 8, 2017 at 20:57

The best course could be to redefine \par inside a group. For example

\newenvironment{specialpar}{\def\par{\ \P\ }}{\endgraf}

And then that way you can do


\usepackage{kantlipsum} % for this example

\newenvironment{specialpar}{\def\par{\ \P\ }}{\endgraf}


  Whatever you want, but knowing that \texttt{\string\par} is a special thing in here,
  so your input must be controlled. \par
  This. \par
  That. \par
  And many other things, but beware of errors.

  Another paragraph.

  And yet another.



PS: note that if you pile a lot of things in the same “TeX paragraph” (that is, before adding the original \par or \engraf for instance) this is piling in memory and makes TeX work much more (the program kind of breathes each time he processes a proper paragraph).

You must log in to answer this question.

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