setcounter{secnumdepth}{3} 在 \documentclass{book} 中不起作用

setcounter{secnumdepth}{3} 在 \documentclass{book} 中不起作用

book我正在用文档类编写论文,在 中\mainmatter,我尝试设置使用\setcounter{secnumdepth}{3},这意味着所有章节、小节和小节都将被编号。然而,在生成的 pdf 文件中,我的小节打印的深度与章节相同,即 section 1.2.3不会显示,但1.2会。

我将非常感激任何帮助,因为我已经被困了大约 4 天!

以下是代码:

\documentclass[12pt]{UIdahoMastersThesis}

% --------------------------------------------------------------------------
% Packages (the class file already imports several. Importing twice usually doesn't hurt, just keep in mind for debugging)
\usepackage[latin1]{inputenc}
\usepackage[printonlyused]{acronym} % Use [nolist,nohyperlinks] to not write list of acronyms and not put hyperlinks to entries in list.
% ** Add any packages you want to use here **
\renewcommand\footnoterule{}

\makeatletter  % ** DO NOT REMOVE THIS ** (Actually, remove it, compile, and enjoy the stream of errors. Its beautiful :) )



% --------------------------------------------------------------------------
% Thesis Information
\title{Fundamental Limits of Multiuser Optical Wireless Communications With and Without Secrecy Constraints}
\author{Morteza Soltani}
\thesisdegree{Doctor of Philosophy}  % e.g Master of Science, Master of Engineering, etc.
\major{Electrical Engineering}  % e.g Computer Science, Computer Engineering, etc.
\advisor{Zouheir Rezki, Ph.D.}  % Make sure title of names matches CoGS format requirements!
\cmone{Arupjyoti Bhuyan, Ph.D.}  % First committee member (Alphabetical order by last name, if I recall correctly)
\cmtwo{Somantika Datta, Ph.D.}  % Second committee member
\cmthree{Dennis Sullivan, Ph.D.}% Third committee member
\deptadmin{Joseph Law, Ph.D.}  % Department administrator or chair
\graddate{May, 2020}  % Graduation date, e.g May, 2017
% --------------------------------------------------------------------------


% Line spacing. The University of Idaho requires thesis formatting to be 1.5-2.0. In LaTeX 1.3=1.5, 1.6=2.0.
\linespread{1.6}

% Defines section counter for frontmatter. This way section number does not appear in the TOC for frontmatter sections
%
\setcounter{secnumdepth}{0}
%%
%%% Sets what level of sections show up in the table of contents. 0 = sections, 1 = subsections, 2 = subsubsections, etc.
\setcounter{tocdepth}{1}


% Configure the PDF output (Most of this is optional, it just adds metadata to the PDF)
\usepackage[% pdftex
pdfauthor=\author,
pdftitle=\title,
pdfsubject={Example subject},
pdfkeywords={keyword1;keyword2;etc},
pdfproducer={ShareLatex},  % e.g ShareLatex
pdfcreator={pdflatex},
pdfprintscaling={AppDefault}]
{hyperref}

% Configure hyperlinks
\hypersetup{
    colorlinks=true, %set true if you want colored links
    linktoc=all,     %set to all if you want both sections and subsections linked
    linkcolor=black,  %choose some color if you want links to stand out
    citecolor=black,
    urlcolor=black,
}


% Changes default indenting in list of figures to 0 
%\makeatletter
\renewcommand*\l@figure{\@dottedtocline{1}{0em}{2.3em}}% Default: 1.5em/2.3em
\let\l@table\l@figure
%\makeatother

% Where to look for images 
% (https://en.wikibooks.org/wiki/LaTeX/Importing_Graphics#Graphics_storage)
% \graphicspath{ {./Figures/} }

% Uncomment to set default style for Listings to be code (Code style is defined in .cls file)
% \lstset{style=code}


% -------------------------------------------------------------------------
\begin{document}

\frontmatter

\titleformat{\chapter}[block]{\scshape\LARGE}{\centering\chaptertitlename\  \thechapter:}{1ex}{\centering}{}
    \titlespacing{\chapter}{0pt}{-40pt}{20pt}

\titleformat{\section}[hang]{\scshape\Large}{\thesection}{1ex}{}
    \titlespacing{\section}{0pt}{0pt}{10pt}
%   \titlespacing*{\section}{0pt}{-50pt}{40pt}

\titleformat{\subsection}[hang]{\scshape\large}{\thesection}{1ex}{}
    \titlespacing{\subsection}{0pt}{0pt}{10pt}
%   \titlespacing*{\subsection}{0pt}{-50pt}{40pt}


% -------------------------------------------------------------------------
% -- Title Page --
\thesistitlepage


% --------------------------------------------------------------------------
% -- Authorization to Submit Thesis --
\frontmattersection{Authorization to Submit Dissertation}
\authorizationpage
\newpage

\mainmatter  % Starts the content part of the thesis
%\setsecnumdepth{subsection}

\setcounter{secnumdepth}{3}  % Sets depth section numbers go to. 

答案1

我不知道你的论文文档类中有什么;它可能会忽略\secnumdepth。这尤其正确,因为它使用单独的命令来配置分段。但是,这:

\titleformat{\subsection}[hang]{\scshape\large}{\thesection}{1ex}{}
    \titlespacing{\subsection}{0pt}{0pt}{10pt}

看起来不对。您似乎将其用作\thesection子节的编号。

相关内容