我正在尝试配置章节标题的外观。到目前为止,它们看起来符合我的要求。但是,有一些错误。
我的所有都\chapter
遇到了这些错误:
Illegal unit of measure (pt inserted). \chapter{Remediation experiment} Illegal unit of measure (pt inserted). \chapter{Remediation experiment} Illegal unit of measure (pt inserted). \chapter{Remediation experiment} Missing number, treated as zero. \chapter{Remediation experiment} Missing number, treated as zero. \chapter{Remediation experiment} Missing number, treated as zero. \chapter{Remediation experiment}
这是我的代码
\documentclass[a4paper,12pt]{report}
\usepackage{titlesec}
\titleformat{\chapter}[display]
{\normalfont\Large\raggedleft\bfseries}
{\chaptertitlename\ \thechapter}
{ \vspace{1ex}
\titlerule[2pt]%
\vspace{2ex}%
}{}
\titlespacing*{\chapter} {}{-60pt}{20pt} %% adjust these numbers
\usepackage{natbib}
\bibliographystyle{apalike}
\usepackage{glossaries}
\setacronymstyle{long-short}
\begin{document}
\title{Proposal for PhD project}
\author{XXX}
\maketitle
\newpage
\pagenumbering{roman}
\tableofcontents
\newpage
\pagenumbering{arabic}
\chapter{Introduction}
答案1
- 该命令的第五个参数
titleformat
必须是距离,而不是某些乳胶命令 - 命令的第二个参数
\titlespacing
不能为空
!
\documentclass[a4paper,12pt]{report}
\usepackage{titlesec}
\titleformat{\chapter}[display]
{\normalfont\Large\raggedleft\bfseries}
{\chaptertitlename\ \thechapter}
{1ex}
{ \titlerule[2pt]%
\vspace{2ex}%
}
\titlespacing*{\chapter} {0pt}{-60pt}{20pt} %% adjust these numbers
\usepackage{natbib}
\bibliographystyle{apalike}
\usepackage{glossaries}
\setacronymstyle{long-short}
\begin{document}
\title{Proposal for PhD project}
\author{XXX}
\maketitle
\newpage
\pagenumbering{roman}
\tableofcontents
\newpage
\pagenumbering{arabic}
\chapter{Introduction}
\end{document}