# How to include paragraph break in command argument?

Here is my MWE:

\documentclass{article}

\setlength{\parindent}{0pt}
\setlength{\parskip}{3pt}

\begin{document}

Here is the first paragraph.

Here is the second.

\newcommand*{\testing}[1]{#1}

\testing{\par Here is the third.\par Here is the fourth.}

\end{document}


The output looks correct in this case:

However, I have a compiler error:

Runaway argument?

! Paragraph ended before \testing was complete


I've tried using \\\\ instead of \par, but it creates incorrect space between the paragraphs.

How can I define multiple paragraphs in a command argument and have it come out formatted just as though I had typed those paragraphs in directly?

• Have you tried with \newcommand{\testing}[1]{#1} (no star)? – Mensch Jun 14 at 2:57
• @Kurt Oh, damn - I forgot to try that. And indeed it works. Thanks! – me-- Jun 14 at 3:01
• I have to wonder, what did you want the * to do? – David Carlisle Jun 14 at 6:59
• If a macro is not defined in terms of \long, the token \par is not allowed inside that macro's arguments—this is regardless \par's meaning/regardless \par's definition. \newcommand*, i.e., the starred variant, tells LaTeX explicitly to define the command not in terms of \long. As the \long-mechanism is only about the token \par itself and not about meanings of whatsoever tokens you can do: \testing{\csname par\endcsname Here is the third.\csname par\endcsname Here is the fourth.} or \let\parcopy=\par \testing{\parcopy Here is the third.\parcopy Here is the fourth.} – Ulrich Diez Jun 14 at 10:25

Command \newcommand*{\testing}[1]{#1} (the starred version!) does simply not allow an \par in code #1.

If you need \par use command \newcommand{\testing}[1]{#1} (no star) instead, it is defined to allow \pars ...

See the corrected code

\documentclass{article}

\setlength{\parindent}{0pt}
\setlength{\parskip}{3pt}

\begin{document}

Here is the first paragraph.

Here is the second.

\newcommand{\testing}[1]{#1} % <======================================== no star

\testing{\par Here is the third.\par Here is the fourth.}

\end{document}


and its with no errors compiled result: