kaobook 类的问题

kaobook 类的问题

我已经开始根据一本书的项目的具体要求来调整kaobook课程。

首先,我需要将 babel 包替换为 polyglossia 包(这本书是关于语音学的,需要很多语音字符,编码起来会花很长时间),并且我包含了 fontspec 包。我使用 XeLaTex 进行编译,它给出了以下错误消息:

未定义控制序列。\frontmatter

以下是代码

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 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 ([email protected])
%
% 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}

我尝试对该类的 main.tex 文件进行相同的更改(注释 babel 包并包含 polyglossia / fontspec 包),但出现了另一个错误:

未定义控制序列。\IfStringInList{english}{\bbl@loaded}

我的经验还不够丰富,所以我只能得出这样的结论:使用 polyglossia 而不是 babel 存在问题。

任何能解决此错误的帮助都将不胜感激。

答案1

某些 LaTeX 编辑器偶尔会生成无用的消息。问题代码中实际的完整错误消息如下:

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

因此\frontmatter调用\publishers,其中包含未定义的命令\up,这可能是用作上标。此命令的正确命令是\textsuperscript。可能\up是某种缩写宏,\textsuperscript它是从其他文档中复制而来,该文档也已定义,而您仅复制了命令,而不是定义。

如果你改变线路

\publishers{1\up{st} Edition}

进入

\publishers{1\textsuperscript{st} Edition}

然后错误就消失。

结果(由于我没有 Arial,所以字体发生了变化):

在此处输入图片描述

相关内容