At the time TeX was written there wasn't too many text editors with brace-matching features to catch a }
you forgot somewhere, so Knuth build some ways of checking if you forgot a }
before the a macro tried to grab the rest of the input file as argument. Apart from David's favourite, \outer
, a macro can also be short or long.
A short macro can be defined as simply as:
\def\test#1{(#1)}
but then if you forget a }
:
\test{a % missing } here
boom!}
TeX will raise that exact same error:
Runaway argument?
{a
! Paragraph ended before \test was complete.
<to be read again>
\par
l.3
?
The same macro call would not raise that error if you defined \test
as a long macro:
\long\def\test#1{(#1)}
However TeX's scanner does not look for something that means a paragraph break, it just looks for a \par
token, so LaTeX (and also plain TeX) provides you with \endgraf
, which is a copy of \par
defined as:
\let\endgraf=\par
You could also trick TeX by using \csname par\endcsname
instead, or something else that would hide the \par
token.
LaTeX's \newcommand
defines a long macro by default, so if you do \newcommand\test[1]{(#1)}
, the example above will work. \tkzTabLine
, however, is defined with \newcommand*
, which does a short \def
(perhaps there's a good reason for who wrote that package to make it short; I didn't check).
Just for completeness, if you are defining the macro yourself and you are using xparse
, then you need the +
modifier to make the argument long, like in:
\NewDocumentCommand \test {+m} {(#1)}
\endgraf
instead of\par
(they are the same thing, just different names).\par
do not work, and what is the difference with\endgraph
?\par
.\par
(a blank line) is not allowed in many constructs as a means of avoiding missing closing delimiters wrecking an entire document, an error is thrown at the end of the paragraph.}
in the argument of a macro (for example, define\def\test#1{(#1)}
and then use\test{a\par b}
or\test{a<newline><newline>b}
, and then try\long\def\test#1{(#1)}
).\tkzTabLine
is defined as a short macro (that is, without the\long
prefix), so using\par
as the argument is an error.\endgraf
is the same thing as\par
(defined with\let\endgraf=\par
), but it has a different name, so it's okay.