3

Here is a minimal version of what I am trying to compile:

\documentclass{book}

\begin{document}

\title{La vie au XXI\textsuperscript{e} si`ecle}

\subtitle{La vie au XXI\textsuperscript{e} si`ecle}

\maketitle

\end{document}

The command I type is pdflatex mydocument.

The weird thing is that the title works exactly as expected, but the subtitle does not : \textsuperscript triggers the dreaded error message ! Undefined control sequence. Unfortunately, I do need a superscript in the subtitle. How to achieve this?

I am using pdflatex, version: TeX Live 2019/Debian.

Zoyd
  • 135
  • 1
    Welcome to TeX.SE. It's the \subtitle directive, not the \superscript directive inside the argument of \subtitle, that causing the error message. (To verify this assertion, simply replace \subtitle{La vie au XXI\textsuperscript{e} si\ecle}with\subtitle{La vie au XXIe si`ecle}and recompile.) The basicbookdocument class does not define a macro called\subtitle. Do you maybe need to load a package in order to define\subtitle`? – Mico May 30 '21 at 08:09
  • 1
    Are you certain the undefined control sequence is due to \textsuperscript? As far as I remember, ther is no \subtitle in a regular book class, so I would suspect something like \subtitle{text} to result in the same error message. – leandriis May 30 '21 at 08:09
  • Oh, thanks. I had no idea that a book was not supposed to have a subtitle according to the LaTeX packages… Weird, some books do have a subtitle. I’ll just do it some other way, then. – Zoyd May 30 '21 at 08:26
  • 1
    The issue is not whether some books have subtitles. The issue is how to enter the subtitle information when using the book document class. – Mico May 30 '21 at 08:46
  • 1
    Subtitle with the \maketitle page? contains some information on how you can add a subtitle to your book. – leandriis May 30 '21 at 08:55

1 Answers1

3

As some of the comments have already pointed out, the basic book document class does not offer a macro called \subtitle.

A general observation: When working with the book document class, the basic LaTeX \title, \author, and \date commands may not be sufficiently rich/flexible for you, i.e., they may not let you generate an elaborate title page. If that's the case for your document, do look into using various LaTeX packages that provide lots of extra flexibility.

If you don't want to go that route and simply wish to insert the subtitle string in a font that's slightly smaller than that of the main title string, you may do so by employing the code, shown below, that generates the following screenshot.

enter image description here

\documentclass[french]{book}
\usepackage{babel}

\usepackage{iftex} \ifpdftex \usepackage[T1]{fontenc} \usepackage{cfr-lm} % or: "\usepackage{lmodern}" \else \usepackage{fontspec} \setmainfont{Latin Modern Roman}[Numbers=OldStyle] \fi

\begin{document} \frontmatter

% Default relative font size for argument of \title: "\LARGE" \title{La vie au XXI\textsuperscript{e} siècle\[1\baselineskip] \Large % or "\large" % switch to a smaller relative font size La vie au XXI\textsuperscript{e} siècle} % subtitle \author{Moi} \date{\today} \maketitle

\clearpage % remainder of document

\end{document}

Mico
  • 506,678