TeX - LaTeX Asked on May 13, 2021
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?
ProvidesClass{test}[2021/03/22 v0.1 Test class]
% Set up basic geometry
LoadClass[10pt,a4paper,parskip=half]{scrartcl}
% Define title
lettest@maketitlemaketitle
renewcommand{maketitle}{
twocolumn[
test@maketitle
large%
begin{center}{%
bfseries abstractnamevspace{-0.7em}vspace{z@}%
}end{center}%
@abstract%
vspace{3.0em}%
]
thispagestyle{empty}
}
% Change title command
renewcommand{@maketitle}{%
begin{center}%
letfootnotethanks%
{%
Largebfseries%
expandafteruppercaseexpandafter{@title}%
par%
}%
vskip 1.5em%
{%
Largelineskip .5em%
begin{tabular}[t]{c}%
@author%
end{tabular}%
par%
}%
vskip 1em%
{%
large@date%
}%
end{center}%
parvskip 1.5em%
}
% Renew abstract command to store the abstract
renewcommand{abstract}[1]{
def@abstract{#1}
}
documentclass{test}
usepackage{lipsum}
title{MWE}
author{raedma}
begin{document}
maketitle
begin{abstract}
lipsum[1]
end{abstract}
section{Introduction}
lipsum[1]
end{document}
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
.
Correct answer by egreg on May 13, 2021
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP