Babel 包无法与模板配合使用

Babel 包无法与模板配合使用

我正在使用Legrand 橙皮书模板(您可以从那里下载 tex 文件或在 Overleaf 中打开它)并且我目前正在尝试获取具有西班牙语规范的文档,但是使用\usepackage[spanish]{babel}提供了有关分段的几个错误,所有错误都是缺失的或多余的\endcsname

我认为可能是因为我babel在加载书籍类之后放置了该命令,该书籍类包含在 Legrand Orange Book LaTeX 类中。

MWE 代码:

\documentclass[11pt,a4paper]{LegrandOrangeBook}

\usepackage[spanish]{babel}

\definecolor{ocre}{RGB}{0, 100, 100}

\chapterspaceabove{6.5cm}
\chapterspacebelow{6.75cm}

\usepackage{svg}

\begin{document}


\thispagestyle{empty} 
\begin{tikzpicture}[remember picture, overlay]
    \node [text opacity=1, minimum height=0.2\paperheight, minimum width=\paperwidth, text width=0.8\paperwidth] at (10,-5) {\sffamily 
        {\Huge\bfseries The$\,\,$ document$\,\,$ title\par}
        \vspace{16pt} % Vertical whitespace
        {\LARGE Blablabla\par} % Subtitle
        \vspace{24pt} % Vertical whitespace
        {\huge\bfseries Your$\,\,$ Name\par}
        \vspace{10pt}
        {\LARGE Tutor: }
        }; 
    \end{tikzpicture}
    

\pagestyle{empty} % Disable headers and footers for the following pages
\tableofcontents % Output the table of contents
\pagestyle{fancy} % Enable default headers and footers again
\cleardoublepage % Start the following content on a new page


\chapterspaceabove{6.75cm} 
\chapterspacebelow{7.25cm} 

\chapter{Sectioning Examples}\index{Sectioning}

\section{Section Title}\index{Sectioning!Sections}
Lorem ipsum

\subsection{Subsection Title}\index{Sectioning!Subsections}
Fusce varius orci

\end{document}

为了运行它,您需要输入我之前发布的链接,转到“下载模板代码”并将 LegrandOrangeBook 文件和包含我的 MWE 的 tex 文件放在同一个文件夹中。

答案1

不确定你所做的是否有意义,但至少这个可以编译:

\documentclass[11pt,a4paper]{LegrandOrangeBook}

 \usepackage[spanish]{babel}
 \usepackage{csquotes}      % <<< was missing

 \definecolor{ocre}{RGB}{0, 100, 100}

\chapterspaceabove{6.5cm}
\chapterspacebelow{6.75cm}

% \usepackage{svg} % <<< not needed here

\begin{document}


 \thispagestyle{empty} 
\begin{tikzpicture}[remember picture, overlay]
    \node [text opacity=1, minimum height=0.2\paperheight, minimum width=\paperwidth, text width=0.8\paperwidth] at (10,-5) {\sffamily 
        {\Huge\bfseries The$\,\,$ document$\,\,$ title\par}
        \vspace{16pt} % Vertical whitespace
        {\LARGE Blablabla\par} % Subtitle
        \vspace{24pt} % Vertical whitespace
        {\huge\bfseries Your$\,\,$ Name\par}
        \vspace{10pt}
        {\LARGE Tutor: }
        }; 
    \end{tikzpicture}
    

 \pagestyle{empty} % Disable headers and footers for the following pages
 % !!! trouble ahead
% \tableofcontents % Output the table of contents
 \pagestyle{fancy} % Enable default headers and footers again
 \cleardoublepage % Start the following content on a new page


\chapterspaceabove{6.75cm} 
\chapterspacebelow{7.25cm} 

\chapter{Sectioning Examples}\index{Sectioning}

\section{Section Title}\index{Sectioning!Sections}
Lorem ipsum

\subsection{Subsection Title}\index{Sectioning!Subsections}
Fusce varius orci

\end{document}

程序:

  • 注释掉所有内容,除了一些“hello world”
  • 一步一步取消注释
  • 发现缺少一个包裹
  • 麻烦制造者\tableofcontents

仍存在一个警告或错误,与 documentclass 相关:

Package hyperref Warning: Option `hyperindex' has already been used, 
setting the option has no effect on input line 507.

相关内容