# Macro: Storage and usage of abstract content does not work in cls

I got handed a cls to use for in a document which produces an ! Undefined control sequence error when used with pdfTeX, Version 3.141592653-2.6-1.40.22 (MiKTeX 21.3)

! Undefined control sequence.
\@maketitle ...ace {\z@ }}\end {center}\@abstract
\vspace {3.0em}\par \vskip...


I tried narrowing the problem down and created a simplified cls and a corresponding MWE.

The creator of the class seems to try to grab the content of the abstract and store it for use in a modified maketitle command. The approach is similar to the one described here.

I tried several approaches but was unable to fix the error. Any ideas?

## cls

\ProvidesClass{test}[2021/03/22 v0.1 Test class]

% Set up basic geometry

% Define title
\let\test@maketitle\maketitle
\renewcommand{\maketitle}{
\twocolumn[
\test@maketitle
\large%
\begin{center}{%
\bfseries \abstractname\vspace{-0.7em}\vspace{\z@}%
}\end{center}%
\@abstract%
\vspace{3.0em}%
]
\thispagestyle{empty}
}

% Change title command
\renewcommand{\@maketitle}{%
\begin{center}%
\let\footnote\thanks%
{%
\Large\bfseries%
\expandafter\uppercase\expandafter{\@title}%
\par%
}%
\vskip 1.5em%
{%
\Large\lineskip .5em%
\begin{tabular}[t]{c}%
\@author%
\end{tabular}%
\par%
}%
\vskip 1em%
{%
\large\@date%
}%
\end{center}%
\par\vskip 1.5em%
}

% Renew abstract command to store the abstract
\renewcommand{\abstract}[1]{
\def\@abstract{#1}
}


## MWE

\documentclass{test}

\usepackage{lipsum}

\title{MWE}
\author{raedma}

\begin{document}

\maketitle

\begin{abstract}
\lipsum[1]
\end{abstract}

\section{Introduction}
\lipsum[1]

\end{document}

• you have redefined \abstract to work like \author with syntax \abstract{my abstract here} so it saves the definition for use later, but you have used it as an environment, in a form where it is typeset directly. You need to delete the definition or use the new vesrion in the document Mar 22, 2021 at 17:01
• Ask the person who made this to fix it. They seem to assume that users write their abstract as \abstract{text} which is seldomly the case, most use \begin/end{abstract} in which case they need something like the environ package to grab the contents. Mar 22, 2021 at 17:04

Since \@abstract is used by \maketitle, you need to type the abstract before \maketitle and in the form

\abstract{This is the text of the abstract}


So the following code should work.

\documentclass{test}

\usepackage{lipsum}

\title{MWE}
\author{raedma}
\abstract{\lipsum[1]}

\begin{document}

\maketitle

\section{Introduction}
\lipsum[1]

\end{document}


The class might do better and, as part of \maketitle, redefine \abstract to issue an error message or a warning about the correct syntax and position of \abstract.