1

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}

(see https://www.overleaf.com/latex/templates/virginia-tech-etd-template/cpqhbscstfrx )

3

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.