我创建了一个 cls 文件,以便制作我自己的文档样式。一切都运行良好,但是,当我有一些代码以便用不同的语言编写时(参见 cls 文件),它就不再起作用了。您有什么想法吗?
这是一个基本的例子:
\documentclass{Internship_Report}
\usepackage{multirow}
\usepackage{longtable}
\usepackage{lscape}
\usepackage{makecell}
\usepackage{tabularx}
\usepackage{color}
\usepackage{xcolor}
\usepackage{colortbl}
\usepackage{fancyhdr}
\usepackage{enumitem}
\usepackage[breaklinks,hidelinks]{hyperref}
\begin{document}
\begin{center}
\huge{\bfseries{Acknowledgements}}
\vspace{0.3cm}
\end{center}
\chineseLanguage{非常感谢您} M; \<شكرًا لك أيها> ; \greekLanguage{Σας ευχαριστώ πoulos} and V
\tableofcontents
\listoffigures
\newpage
\listoftables
\newpage
\chapter{Chap 1}
\chapter{Chap 2}
\end{document}
这里是 cls 文件:
\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{Internship_Report}[2022/06/02 - Internship Report]
\LoadClass[11pt,twoside]{report}
\RequirePackage{appendix}
\RequirePackage{fancyhdr}
\RequirePackage[toc,acronym]{glossaries}
\RequirePackage{caption}
\RequirePackage{graphicx}
\RequirePackage[titles]{tocloft}
\RequirePackage{biblatex}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Geometry
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\RequirePackage{calc}
\RequirePackage[a4paper,top=3.5cm,bottom=2.5cm,outer=1in,inner=1.5in]{geometry}
%\RequirePackage{showframe}
\setlength{\headheight}{13.59999pt}
\setlength{\parindent}{0em}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Chapter / Section / Appendix
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\RequirePackage{fmtcount}
\makeatletter
\def\@makechapterhead#1{%
\vspace*{-23\p@}%
{\parindent \z@ \raggedright \normalfont
\ifnum \c@secnumdepth >\m@ne
\thispagestyle{fancy} \huge\bfseries \thechapter.\space % Change the size of the chapter title
%\huge\bfseries \@chapapp\space \thechapter
\fi
\interlinepenalty\@M
\huge \bfseries #1\par\nobreak %\Huge \bfseries #1\par\nobreak
\vskip 40\p@
}}
\newcommand\appendix@chapter[1]{%
\addtocontents{toc}{\protect\setcounter{tocdepth}{0}}
\refstepcounter{chapter}%
\def\app@ct{Appendix \@Alph\c@chapter: #1}
\orig@chapter*{\thispagestyle{fancy}\vspace*{-70\p@} \huge\bfseries \app@ct} % Change the size of the chapter title
\markboth{\MakeUppercase{\app@ct}}{\MakeUppercase{\app@ct}}
\addcontentsline{toc}{chapter}{\normalsize\bfseries\app@ct}%
}
\let\orig@chapter\chapter
\g@addto@macro\appendix{\let\chapter\appendix@chapter}
\newcommand\unappendix{\par
\setcounter{apdxsection}{\value{section}}%
\setcounter{section}{\value{savesection}}%
\setcounter{subsection}{0}%
\gdef\thesection{\@arabic\c@section}}
\patchcmd{\@makechapterhead} {\vskip 40}{\vskip 20}{}{}
\patchcmd{\@makeschapterhead}{\vskip 40}{\vskip 20}{}{}
\DeclareRobustCommand{\csr}{\textsc{\acrfull{ac:csr}}}
\DeclareRobustCommand{\rlc}{\acrshort{ac:rlc}}
\DeclareRobustCommand{\sdu}{\acrshort{ac:sdu}}
\renewcommand\paragraph{\@startsection{paragraph}{4}{\z@}%
{3.25ex \@plus1ex \@minus.2ex}%
{1.5ex \@plus .2ex}%
{\normalfont\normalsize\bfseries}}
\renewcommand\subparagraph{\@startsection{subparagraph}{5}{\parindent}%
{3.25ex \@plus1ex \@minus .2ex}%
{1.5ex \@plus .2ex}%
{\normalfont\normalsize\bfseries}}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Table of Contents
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\setcounter{secnumdepth}{5}
\setlength{\cftbeforechapskip}{6pt}
\makeatother
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Hearder / Footer
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\renewcommand{\chaptermark}[1]{\markboth{\uppercase{\thechapter.~ #1}}{}}
\pagestyle{fancy}
\fancypagestyle{main}{
\fancyhf{}
\fancyhead[LE]{\thepage}
\fancyhead[RE]{\leftmark}
\fancyhead[LO]{\leftmark}
\fancyhead[RO]{\thepage}
\fancyfoot[LE]{}
\fancyfoot[RO]{}
\fancyfoot[LO]{}
\fancyheadoffset{0cm}
\renewcommand{\headrulewidth}{1pt}
}
\fancypagestyle{PageNum}{%
\fancyfoot{}
\fancyhf{}
\fancyhead[LE]{\thepage}
\fancyhead[RE]{}
\fancyhead[LO]{}
\fancyhead[RO]{\thepage}
\fancyfoot[LE]{}
\fancyfoot[RO]{}
\fancyfoot[LO]{}
\fancyheadoffset{0cm}
\renewcommand{\headrulewidth}{0pt}
}
\newcommand{\BlankPageNum}{
\newpage
\thispagestyle{PageNum}
\mbox{}
\newpage
}
\newcommand{\BlankPage}{
\newpage
\thispagestyle{empty}
\mbox{}
\newpage
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Foreign Languages
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\RequirePackage[LAE,LFE,T1]{fontenc}
\RequirePackage[greek,main=english]{babel}
\RequirePackage{CJKutf8}
\RequirePackage{arabtex}
\RequirePackage{utf8}
\newcommand{\greekLanguage}[1]{\selectlanguage{greek}#1\selectlanguage{english}}
\newcommand{\chineseLanguage}[1]{\begin{CJK*}{UTF8}{gbsn}#1\end{CJK*}}
\newcommand{\arabicLanguage}[1]{\setarab \fullvocalize \transtrue \arabtrue
\begin{RLtext}#1\end{RLtext}}
\setcode{utf8}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Contents / Figures / Tables / Bibliography Acronyms names
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\renewcommand\contentsname{\vspace{-2.55cm} \centering \huge\bfseries Table of Contents}
\renewcommand\listfigurename{\vspace{-2.55cm} \centering \huge\bfseries List of Figures}
\renewcommand\listtablename{\vspace{-2.55cm} \centering \huge\bfseries List of Tables}
\renewcommand*{\acronymname}{List of Abbreviations}