结论:

结论:
\documentclass[11pt, a4paper, oneside]{Thesis} % Paper size, default font size and one-sided paper
\setcounter{tocdepth}{5}
\setcounter{secnumdepth}{4}
\usepackage{longtable}
\usepackage{wrapfig}
\usepackage{lscape}
\usepackage{rotating}
\usepackage{graphicx}
\usepackage{caption}
\usepackage{amsmath}
\usepackage{enumitem}
\usepackage[english]{babel}
\usepackage{titlesec}

\renewcommand\raggedchapter{\centering}

\RedeclareSectionCommand[
  beforeskip=.25\baselineskip,
  afterskip=1sp plus -1sp minus 1sp
]{chapter}

\RedeclareSectionCommand[
  beforeskip=3.5ex plus 1ex minus .2ex,
  afterskip=1sp plus -1sp minus 1sp
]{section}

\RedeclareSectionCommands[
  afterskip=-1em,
  indent=2em
]{subsection,subsubsection,paragraph}

\renewcommand{\sectioncatchphraseformat}[4]{%
  \hskip #2#3#4.%
}


\usepackage{tabularx,booktabs}
% for better rules in the table
% prints author names as small caps
\usepackage{algorithm}
\usepackage{tabularx}
\usepackage{ragged2e}
\usepackage{longtable}            
\newcolumntype{R}{>{\RaggedRight\let\newline\\\arraybackslash\hspace{0pt}}X}
\usepackage{pdflscape}
\usepackage{ltablex}
\usepackage{algpseudocode,caption}
\newcolumntype{C}{>{\centering\arraybackslash}X} % centered version of "X" type
\setlength{\extrarowheight}{1pt}
%\usepackage{subcaption} %incompatible with subfig
\graphicspath{{Pictures/}} % Specifies the directory where pictures are stored
\usepackage[numbers,sort&compress]{natbib} % Use the natbib reference package - read up on this to edit the reference style; if you want text (e.g. Smith et al., 2012) for the in-text references (instead of numbers), remove 'numbers' v

\hypersetup{urlcolor=black, colorlinks=true} % Colors hyperlinks in blue - change to black if annoyingv`    
\title{\ttitle} % Defines the thesis title - don't touch this

顺便说一句:该课程Thesis来自这个 github 使用类ecsthesis.cls

答案1

这里的问题是你混淆了两件事:

  1. 您使用的课​​程ecsthesis.cls基于book.cls您在以下行中看到的课程

    \def\baseclass{book}
    

    在课堂上。

  2. 您使用的命令\RedeclareSectionCommand[未在类中定义book.cls,而是在 KOMA-Script 类中定义。您尝试重新定义的scrbook.cls命令也是如此...\raggedchapter

这两点都是你收到错误消息的原因

! LaTeX Error: Command \raggedchapter undefined.

See the LaTeX manual or LaTeX Companion for explanation.
Type  H <return>  for immediate help.
 ...                                              

l.18 \renewcommand\raggedchapter
                                {\centering}
Try typing  <return>  to proceed.
If that doesn't work, type  X <return>  to quit.

! Undefined control sequence.
l.20 \RedeclareSectionCommand
                             [
The control sequence at the end of the top line
of your error message was never \def'ed. If you have
misspelled it (e.g., `\hobx'), type `I' and the correct
spelling (e.g., `I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined.

这个课程ecsthesis非常古老,我认为它已经过时了,你应该避免使用它(或者必须使用它,因为你的教授告诉你了?)

课堂上scrbook做了很多新的定义,我相信你很难scrbook在课堂上完成工作ecsthesis

看来您的文档需要一种 APA 样式,那么为什么不使用apa6.cls为此目的编写的类呢(@moewe 在评论中已经提到过)。

结论:

使用另一个类来代替过时的类ecsthesis.cls来获得所需的结果。如果您想使用命令,\RedeclareSectionCommand[请尝试使用类scrbook。如果您需要 apa 样式,请尝试类apa6.cls(两者均参见 ctan)。

相关内容