如何解决子节的编号失败,带有自己的.cls
不幸的是,我想尽一切办法获得各小节的编号。
\documentclass[a4paper,10pt,openright]{unibe-msc}
...
\setcounter{secnumdepth}{3} %numbering 3 levels also subsubsections,\setcounter{section}{3}
\setcounter{tocdepth}{2} % Visiblity depth in TableOfContent
该小节以下列代码出现在目录和文档中,但没有编号(请参见图片)。章节编号神秘地起作用。
简单的乳胶测试,例如使用\documentclass[a4paper,10pt]{scrartcl}
时,小节编号可以正常工作。
系统:
- MacTex 2020
- MacOS Catalina
- texmaker
简化的测试文件(scrartcl VS unibe-msc):
%\documentclass[a4paper,10pt] {scrartcl}
\documentclass[a4paper,openright]{unibe-msc}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\begin{document}
\tableofcontents
\section{Section}
\subsection{Test Numbering of Subsection with own class}
\end{document}
unibe-msc.cls:
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% This is unibe-msc document class file.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Date: 10/28/2009
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\NeedsTeXFormat{LaTeX2e}[2001/01/01]
\ProvidesClass{unibe-msc}
[2009/10/28 v2.1 Document Class for UniBE MSc Theses]
\newif\if@uthesis@electronic \@uthesis@electronicfalse
\DeclareOption{electronic}{\@uthesis@electronictrue}
\def\@uthesis@setpapersize@afour{%
\setstocksize{297mm}{210mm}
\settrimmedsize{297mm}{210mm}{*}
\settypeblocksize{49pc}{33pc}{*}}
\def\@uthesis@setpapersize@gfive{%
\if@uthesis@electronic
\setstocksize{239mm}{169mm}
\settrimmedsize{239mm}{169mm}{*}
\ifpdf
\else
\special{papersize=169mm,239mm}
\fi
\else
\setstocksize{297mm}{210mm}
\settrimmedsize{239mm}{169mm}{*}
\setlength{\trimtop}{\stockheight}
\addtolength{\trimtop}{-\paperheight}
\setlength{\trimtop}{0.5\trimtop}
\setlength{\trimedge}{\stockwidth}
\addtolength{\trimedge}{-\paperwidth}
\ifpdf
\AtBeginDocument{%
\setlength{\pdfpagewidth}{\stockwidth}
\setlength{\pdfpageheight}{\stockheight}}
\fi
\fi
\settypeblocksize{43pc}{30pc}{*}}
\DeclareOption{g5paper}{\def\uthesis@trimmedsize{gfive}}
\DeclareOption{a3paper}{\OptionNotUsed}
\DeclareOption{a4paper}{\def\uthesis@trimmedsize{afour}}
\DeclareOption{a6paper}{\OptionNotUsed}
\DeclareOption{a5paper}{\OptionNotUsed}
\DeclareOption{b3paper}{\OptionNotUsed}
\DeclareOption{b4paper}{\OptionNotUsed}
\DeclareOption{b5paper}{\OptionNotUsed}
\DeclareOption{b6paper}{\OptionNotUsed}
\DeclareOption{letterpaper}{\OptionNotUsed}
\DeclareOption{legalpaper}{\OptionNotUsed}
\DeclareOption{executivepaper}{\OptionNotUsed}
\DeclareOption{ebook}{\OptionNotUsed}
\DeclareOption{landscape}{\OptionNotUsed}
\DeclareOption*{\PassOptionsToClass{\CurrentOption}{memoir}}
\ExecuteOptions{g5paper}
\ProcessOptions\relax
\LoadClass[a4paper]{memoir}
\AtBeginDocument{\RequirePackage{graphics}}
\@nameuse{@uthesis@setpapersize@\uthesis@trimmedsize}
\setlrmargins{*}{*}{*}
\setulmargins{*}{*}{*}
\checkandfixthelayout
\def\subtitle{\gdef\thesubtitle}
\def\frontsignature{\gdef\thefrontsignature}
\def\unibelogo{\gdef\theunibelogo}
\def\htilogo{\gdef\thehtilogo}
\def\place{\gdef\theplace}
\def\faculty{\gdef\thefaculty}
\def\affiliation{\gdef\theaffiliation}
\def\examiner{\gdef\theexaminer}
\def\discipline{\gdef\thediscipline}
\def\supervisor{\gdef\thesupervisor}
\def\origin{\gdef\theorigin}
\let\thesubtitle\relax
\let\theunibelogo\relax
\let\thehtilogo\relax
\let\theplace\relax
\let\thefaculty\relax
\let\theaffiliation\relax
\let\thediscipline\relax
\let\thesupervisor\relax
\let\theorigin\relax
\def\maketitle{%
\begingroup
%\sffamily
\pagestyle{empty}
\renewcommand*{\thepage}{title-\arabic{page}}
\vspace*{-30mm}
\noindent
\scaleBox{0.84}{\includegraphics{\thehtilogo}} \hfill
\scaleBox{0.35}{\includegraphics{\theunibelogo}}
\parBox[b][0.65\textheight]{\textwidth}{\centering\noindent
\vskip1.5cm %2cm default
{\large\mdseries \thefaculty \par \thediscipline}\par
\vskip0.7cm %1cm default
\Large\mdseries\thesubtitle\par
\vskip1.5cm %2cm default
\huge\bfseries\thetitle\par
\vskip2cm %2cm default
\large\mdseries by
\vskip1.6cm %2cm default
\LARGE\bfseries\theauthor %\par\vfill
\vskip0.5cm %1cm default
\large\mdseries of \theorigin\par\vfill
}
\vfill\noindent
\parBox[b]{\textwidth}{\centering\noindent
\large\mdseries Supervisors \\ \thesupervisor\par
\vskip0.7cm %1cm default
\large\mdseries Institutions \\ \vskip0.1cm \theaffiliation\par
\vskip0.7cm %1cm default
\large\mdseries examiners \\ \theexaminer
\vskip0.7cm %1cm default
\large\mdseries\thefrontsignature\\
{\color{red}This report is confidential.} %{\tiny(Delete this statement in the file ``unibe-msc.cls'' if the report is not confidential.)}
}
\cleardoublepage
\endgroup
}
\endinput
解决方法
您的课程基于回忆录,因此您可以使用
\documentclass[a4paper,10pt,openright]{unibe-msc}
\maxtocdepth{subsection}
\setsecnumdepth{subsection}
\begin{document}
\tableofcontents
\section{Section}
\subsection{Test Numbering of Subsection with own class}
\end{document}
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。