0

I have started to adjust the kaobook class with specific requirements for a project of a book.

First and foremost, I need to change the babel package replaced by the polyglossia package (the book is about phonology and requires many phonetic characters that would take very long to code), and I included the fontspec package. I compile with XeLaTex and it gives this error message:

Undefined control sequence. \frontmatter

Here is the code

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% kaobook --- LaTeX Template --- Version 1.2 (4/1/2020) --- https://www.LaTeXTemplates.com
%
% Authors: Federico Marotta, based on the doctoral thesis of Ken Arroyo Ohori, and on the Tufte-LaTeX class, modified for LaTeX Templates by Vel (vel@latextemplates.com)
%
% License: % CC0 1.0 Universal (see included MANIFEST.md file)
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%----------------------------------------------------------------------------------------
%   PACKAGES AND OTHER DOCUMENT CONFIGURATIONS
%----------------------------------------------------------------------------------------

\documentclass[
    fontsize=12pt, % Base font size
    twoside=true, % Use different layouts for even and odd pages (in particular, if twoside=true, the margin column will be always on the outside)
    %open=any, % If twoside=true, uncomment this to force new chapters to start on any page, not only on right (odd) pages
    %chapterprefix=true, % Uncomment to use the word "Chapter" before chapter numbers everywhere they appear
    %chapterentrydots=true, % Uncomment to output dots from the chapter name to the page number in the table of contents
    numbers=noenddot, % Comment to output dots after chapter numbers; the most common values for this option are: enddot, noenddot and auto (see the KOMAScript documentation for an in-depth explanation)
    %draft=true, % If uncommented, rulers will be added in the header and footer
    %overfullrule=true, % If uncommented, overly long lines will be marked by a black box; useful for correcting spacing problems
]{kaobook}

%\usepackage[frenchb, english]{babel} % Load characters and hyphenation
\usepackage{fontspec}
\setmainfont{Arial}
\usepackage{polyglossia}
\setmainlanguage{english}
\setotherlanguage{french}
\usepackage{styles/mdftheorems}
\graphicspath{{examples/documentation/images/}{images/}} % Paths in which to look for images

\usepackage{xcolor}
\definecolor{bl}{rgb}{0.349, 0.514, 0.690}
\makeindex[columns=3, title=Alphabetical Index, intoc] % Make LaTeX produce the files required to compile the index

\counterwithin*{sidenote}{chapter}

%----------------------------------------------------------------------------------------

\begin{document}


\titlehead{Title}
%\subject{Use this document as a template}

\title[Master Pronunciation]{Master Pronunciation}
\subtitle{Pronunciation Guide}

\author[author]{author}

\date{2020}

\publishers{1\up{st} Edition}



%\include{pages/copyrightpage}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%\KOMAoptions{twoside=semi}
\maketitle
%s\KOMAoptions{twoside=true}
\frontmatter 
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\mainmatter % Denotes the start of the main document content, resets page numbering and uses arabic numbers
\setchapterstyle{kao}

%\include{chapters/1introduction}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\pagelayout{wide} % No margins
\addpart{Discovering }
\pagelayout{margin}

%\include{chapters/2startingwith}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\backmatter

\setchapterstyle{plain} % Output plain chapters from this point onwards

%\printindex % Output the index


\end{document}

I tried to made the same changes (comment the babel package and include the polyglossia / fontspec ones) to the main.tex file of the class and it gave another error:

Undefined control sequence. \IfStringInList{english}{\bbl@loaded}

I'm far from being experienced so I could only conclude that there was an issue using polyglossia instead of babel.

Any help would be highly appreciated to solve this error.

  • 1
    Welcome to TeX.SE! When switching Babel on and off then errors occur frequently because there are Babel commands in the auxiliary file from earlier runs. In a new run the auxiliary file from the previous run is loaded and the commands executed, but when Babel is no longer present the commands are now undefined. To solve this you should delete the .aux file manually after you remove Babel from your source code. Then in the next run a new auxiliary file is generated (which does not contain the problematic commands) and the error will disappear. – Marijn Aug 10 at 12:36
2

Some LaTeX editors occasionally produce unhelpful messages. The actual, full error message from the code in the question is as follows:

! Undefined control sequence.
\@publishers ->1\up 
                    {st} Edition
l.66 \frontmatter

So \frontmatter calls \publishers, which contains the undefined command \up, This is probably intended as a superscript. The proper command for this is \textsuperscript. Possibly \up is some sort of abbreviation macro for \textsuperscript that was copied from some other document where it was also defined, and you copied only the command and not the definition.

If you change the line

\publishers{1\up{st} Edition}

into

\publishers{1\textsuperscript{st} Edition}

then the error disappears.

Result (fonts changed because I don't have Arial):

enter image description here

| improve this answer | |
  • Thank you Marijin for your reply. I deleted the .aux file and unfortunately it produced the same error > Undefined control sequence. \frontmatter – Cedric Aug 10 at 13:00
  • That works perfectly ! So many thanks ! – Cedric Aug 10 at 13:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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