first of all sorry if the question seems repetitive: I have tried to find a solution in previously asked questions but none of the hints provided seems to work for me.
Here is my situation. I am writing a new class to typeset my thesis (and hopefully help other students who would like to use LaTeX instead of Hangul) by customizing the memoir package.
Everything ran smoothly until I became stuck in this: I have a number of custom commands that define variables which are then output by the command \prelims
(see code below).
\newcommand*{\supervisor}[1]{\gdef\KNUsupervisor{#1}}
\newcommand*{\department}[1]{\gdef\KNUdepartment{#1}}
\newcommand*{\major}[1]{\gdef\KNUmajor{#1}}
\newcommand*{\degree}[1]{\gdef\KNUdegree{#1}}
%%% \asbtractEN
\newcommand*{\abstractEN}[1]
{
\gdef\KNUabstractEN
{
{
\begin{center}
\@title
\vspace{1em}
\@author
\vspace{1em}
School of \KNUdepartment \\
Major in \KNUmajor \\
The Graduate School \\
(Supervised by Professor \KNUsupervisor)
\end{center}
\vspace{2em}
(Abstract)
\vspace{1em}
\mbox{#1}
}
}
}
\newcommand{\prelims}{
\frontmatter
\tableofcontents \newpage
\listoffigures \newpage
\listoftables \newpage
\cleardoublepage
\phantomsection
\addcontentsline{toc}{chapter}{Abstract}
\KNUabstractEN
\mainmatter
\setcounter{secnumdepth}{2}
}
My problem is that when specifying an abstract consisting of multiple paragraphs, such as
\abstractEN{
Par1
Par2
}
the compiler kindly spits at me with the "usual" Paragraph ended before \abstractEN was complete.
I have tried putting the argument in a separate block, in a box, and even in a minipage, but the error persists.
Any helpful soul around?
P.S. Any errors in English in the abstract command are strictly required by our University's template -.-
Best Answer
In TeX terminology, this is because your commands are not defined as
\long
so do not permit paragraph breaks in their arguments, because you have defined them with\newcommand*
instead of\newcommand
.If using
\def
and variants to define commands that take arguments (and want them to accept paragraph breaks also), one needs to use the\long
prefix. Andrew Swann pointed out that you use\gdef
so should be aware of this, but none of the commands defined with\gdef
in your example appear to take arguments, so do not require this.Solution: Remove the
*
from\newcommand*{\abstractEN}
.See What's the difference between
\newcommand
and\newcommand*
? The answers to that question explain why the non-\long
form can be useful.