1

I am using a specific book template (and .cls file). I want to put a subtitle. When I try to do that, an error is shown at \maketitle, saying "Use of \@icentercr doesn't match its definition. \def " How can I fix this ? Do I have to go to the .cls file and fix it there itself.

\begin{document}
\title{
 Main Title \\ 
      Subtitle
 }

Apologies for not including a mwe, the template I'm working on, I cannot do that.

  • If you're open to other classes, you could use scrbook (see this) or other class. If book is required, then you can use the titling package (see this). Otherwise you could resort to redefining \maketitle. – Phelype Oleinik May 30 '18 at 23:25
  • @PhelypeOleinik, thank you. Neither of the links helps. I can't use the former, since it needs change of the class. The latter changes original positioning of the title. – Eureka May 30 '18 at 23:48
  • What do you mean with "changes the original positioning of the title"? Did you try a) redefining \maketitle? b) using t titling package? Otherwise, we can just guess because it's clearly a problem with your "specific book template", so probably yes, you'll have to change the .cls file. – BlackBird May 31 '18 at 0:04
  • @Joseph, can you elaborate redefining the \maketitle. – Eureka May 31 '18 at 0:07
  • As in \renewcommand{\maketitle}{....} -- find the \maketitle command in your class, and change it (that's more or less what the titling package does). – BlackBird May 31 '18 at 0:10
4

If you must use book and cannot use titling, then you can redefine \maketitle.

I copied the definition from book.cls and added two lines:

    \vskip 1.5em% Added this
    {\Large \@subtitle \par}% and this

right below the title. I also added a wrapper command for adding the subtitle:

\def\subtitle#1{\gdef\@subtitle{#1}}

Without a MWE, this is the best one can do:

enter image description here

\documentclass{book}

\makeatletter
\def\subtitle#1{\gdef\@subtitle{#1}}
\def\maketitle{\begin{titlepage}%
  \let\footnotesize\small
  \let\footnoterule\relax
  \let \footnote \thanks
  \null\vfil
  \vskip 60\p@
  \begin{center}%
    {\LARGE \@title \par}%
    \vskip 1.5em% Added this
    {\Large \@subtitle \par}% and this
    \vskip 3em%
    {\large
     \lineskip .75em%
      \begin{tabular}[t]{c}%
        \@author
      \end{tabular}\par}%
      \vskip 1.5em%
    {\large \@date \par}%       % Set date in \large size.
  \end{center}\par
  \@thanks
  \vfil\null
  \end{titlepage}%
  \setcounter{footnote}{0}%
  \global\let\thanks\relax
  \global\let\maketitle\relax
  \global\let\@thanks\@empty
  \global\let\@author\@empty
  \global\let\@date\@empty
  \global\let\@title\@empty
  \global\let\title\relax
  \global\let\author\relax
  \global\let\date\relax
  \global\let\and\relax
}
\makeatother

\begin{document}

\title{Main Title}

\subtitle{Subtitle}

\author{Me}

\date{\today}

\maketitle

\end{document}

Or, a less messy version with etoolbox's \patchcmd:

\documentclass{book}

\usepackage{etoolbox}

\makeatletter
\def\subtitle#1{\gdef\@subtitle{#1}}
\patchcmd\maketitle
  {{\LARGE \@title \par}}
  {{\LARGE \@title \par}%
   \vskip 1.5em
   {\Large \@subtitle \par}}
\makeatother

\begin{document}

\title{Main Title}

\subtitle{Subtitle}

\author{Me}

\date{\today}

\maketitle

\end{document}
| improve this answer | |

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