2

I've tried to define a new Document section, called tomo ("volume" in English) at the upper level of the amsmath part document section like this:

\documentclass[12pt,italian]{amsbook}

\newcounter{tomo}
\renewcommand\thetomo          {\roman{tomo}}
\let\tomorunhead\tomorunhead
\def\tomoname{tomo}
\def\tomo{\cleardoublepage \thispagestyle{empty}%
  \null\vfil  \markboth{}{}\secdef\@tomo\@tomo}
\def\@tomo[#1]#2{%
  \ifnum \c@secnumdepth >-2\relax \refstepcounter{tomo}%
    \addcontentsline{toc}{tomo}{\tomoname\ \thetomo.
    \protect\enspace\protect\noindent#1}%
  \else
    \addcontentsline{toc}{tomo}{#1}\fi
  \begingroup\centering
  \ifnum \c@secnumdepth >-2\relax
       {\fontsize{\@xviipt}{22}\bfseries
     \tomoname\ \thetomo} \vskip 20\p@ \fi
  \fontsize{\@xxpt}{25}\bfseries
      #1\vfil\vfil\endgroup \newpage\thispagestyle{empty}}

\def\@stomo#1{\addcontentsline{toc}{tomo}{\protect\noindent#1}%
  \begingroup\centering
  \fontsize{\@xxpt}{25}\bfseries
     #1\vfil\vfil\endgroup \newpage\thispagestyle{empty}}
\def\tomorunhead#1#2#3{%
  \@ifnotempty{#2}{\uppercase{#1 #2}\@ifnotempty{#3}{. }}%
  \def\@tempa{#3}%
  \ifx\@empty\@tempa\else\uppercasenonmath\@tempa\@tempa\fi}
\def\l@tomo{\@tocline{-1}{12pt plus2pt}{0pt}{}{\bfseries}}
\let\toctomo\tocsection

\begin{document}

\tomo{example}
\part{ciao}
\chapter{test}

\end{document}

But at compile time, it returned me the following error:

! Use of \@ doesn't match its definition.
\@xdblarg #1#2->#1[
               {#2}]{#2}
l.36     \tomo
          {example}

I've been using the amsbook class to define the following extension. Where am I wrong?

By the way, I didn't use the volumes package, as it won't add the tomo in my table of contents.

jackb
  • 518
  • 2
    You have to write your code inside \makeatletter ... \makeatother since you're using @ on command names. – Sigur Jul 29 '13 at 15:03
  • 1
    Surround the code between \makeatletter and \makeatother. See http://tex.stackexchange.com/questions/8351/what-do-makeatletter-and-makeatother-do – egreg Jul 29 '13 at 15:04
  • Thanks to you both: I must study a lot more TeX, I suppose! :) – jackb Jul 29 '13 at 15:07
  • @jackb, I've been studying TeX since 1999. Every day I discover something new. Go ahead, you'll love it. – Sigur Jul 29 '13 at 15:09

1 Answers1

1

Surround the code between \makeatletter and \makeatother.

See What do \makeatletter and \makeatother do?