Acknowledgements outside of document environment

How do I add an acknowledgements section (maybe not specifically \section) outside of (before) my document environment?

in my .cls, there is

\def\@acknowledge{}
...
\def\acknowledge#1{\booltrue{@ack} \gdef\@acknowledge{#1}}
...
\def\ackpage{
\chapter*{Acknowledgments}
\@acknowledge
\newpage
}


but it seems that I find problems when I put newlines in the \acknowledge{folks in here}

When you use \def the default behaviour of TeX is to not allow paragraph breaks, as a mechanism to check for missing braces or other errors in the code.

You have a few options:

If you can modify the .cls you can make TeX allow paragraph breaks by making \acknowledge a \long macro:

\long\def\acknowledge#1{\booltrue{@ack}\gdef\@acknowledge{#1}}


then it will allow a \par token in the argument.

Or you can use LaTeX syntax and use \newcommand which, by default, allows paragraph breaks:

\newcommand{\acknowledge}[1]{\booltrue{@ack}\gdef\@acknowledge{#1}}


Or, if you prefer, you can use the environ package and make acknowledge look more like an environment:

\usepackage{environ}
\NewEnviron{acknowledge}{%
\booltrue{@ack}%
\global\let\@acknowledge\BODY}


the environ package stores the contents of the environment in \BODY, then you just have to copy it to \@acknowledge with \let. This allows paragraph breaks by default.

If you cannot change the .cls, then you can bypass TeX's check and use \endgraf instead of \par or a new line. For example, if you had:

\acknowledge{%
folks in

here}


(which is the same as \acknowledge{folks in \par here}) you can use:

\acknowledge{folks in\endgraf here}


then TeX will not know there is a paragraph break there.

• What a comprehensive answer. Thanks so much! – Michael Jul 4 '18 at 14:14