我已经使用 titlesec 包设置了标题样式,但是此代码现在在目录页上的“内容”标题旁边显示一个零。我该如何删除它?我还想知道如何用罗马数字对目录前的页面进行编号(封面页除外)。
\documentclass[12pt]{report}
\usepackage{graphicx}
\usepackage{tikz}
\usepackage{float}
\usepackage{soul}
\usepackage{fontspec}
\usepackage{titlesec}
\usepackage[a4paper,width=150mm,top=25mm,bottom=25mm,bindingoffset=6mm]{geometry}
\setmainfont{Calibri}
\titleformat{\chapter}[display]
{\normalfont\bfseries}{}{0pt}{\Huge\thechapter.\quad}
\begin{document}
\begin{titlepage}
\begin{center}
\vspace*{1cm}
{\LARGE \textbf{Thesis title}}
\vspace{1cm}
{\Large subtitle}
\vspace{1.5cm}
\includegraphics[width=0.4\textwidth]{universitylogo.png}
\vspace{1cm}
Bachelor's Thesis
\vspace{1cm}
subtitle
\vspace{0.5cm}
semester year
\vspace{1cm}
{\Large name}
\end{center}
\end{titlepage}
\noindent \hspace{-0.5cm}\includegraphics[width=0.4\textwidth]{universitylogo}
\vspace{0.5cm}
\noindent degree \hspace{5.4cm} Abstract
\vspace{1cm}
\noindent Author: \hspace{0.8cm} name \hspace{6.7cm} Year 2021
\vspace{0.5cm}
\noindent Subject: \hspace{0.7cm} thesis title
\vspace{0.5cm}
\noindent Supervisors: \hspace{0.0cm} supervisor name
\noindent\rule{\linewidth}{0.4pt}
\vspace{0.5cm}
\noindent text
\newpage
\begin{center}
\vspace*{1cm}
{\Huge \textbf{Acknowledgments, Dedication, and Declaration}}
\end{center}
\vspace{1cm}
\noindent {\large \textbf{Acknowledgments:}}
\newline thanks
\vspace{1cm}
\noindent {\large \textbf{Dedication:}}
\newline
To my \textbf{thanks}
\vspace{1cm}
\noindent {\large \textbf{Declaration:}}
\newline
declaration
\tableofcontents
\chapter{chapter1}
\input{chapterlocation/chapter1.tex}
\chapter{chapter2}
\input{chapterlocation/chapter2.tex}
\chapter{chapter3}
\input{chapterlocation/chapter3.tex}
\end{document}
答案1
使用block
模式而不是display
并将适当参数中的数字设置为\titleformat
。
\documentclass[12pt]{report}
\usepackage[
a4paper,
width=150mm,
top=25mm,
bottom=25mm,
bindingoffset=6mm,
showframe, % to see the boundaries
]{geometry}
\usepackage{titlesec}
\titleformat{\chapter}[block]
{\normalfont\bfseries\Huge}
{\thechapter.}
{1em}
{}
\begin{document}
\tableofcontents
\chapter{Introduction}
\end{document}
删除showframe
生产版本的选项。我只包括了真正需要的内容。
答案2
正如@Bernard 所说,我添加了这一行;
\titleformat{name=\chapter, numberless}[display]{\normalfont\bfseries}{}{0pt}{\Huge}