我正在尝试向在 Sharelatex.com 上找到的模板添加目录,但在添加 \tableofcontents 时,出现错误“!LaTeX 错误:这里没有结束的行。”
有人知道哪里出了问题吗?提前谢谢!
\documentclass[11pt,a4paper,oldfontcommands]{book}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{microtype}
\usepackage[dvips]{graphicx}
\usepackage{xcolor}
\usepackage{times}
\usepackage[
breaklinks=true,colorlinks=true,
%linkcolor=blue,urlcolor=blue,citecolor=blue,% PDF VIEW
linkcolor=black,urlcolor=black,citecolor=black,% PRINT
bookmarks=true,bookmarksopenlevel=2]{hyperref}
\usepackage{fix-cm}
\usepackage{xcolor}
\usepackage{titlesec}
\definecolor{gray75}{gray}{0.75}
\newcommand{\hsp}{\hspace{0pt}}
\titleformat{\chapter}[hang]{\flushright
\fontseries{b}\fontsize{80}{100}\selectfont}{\fontseries{b}\fontsize{100}{130}\selectfont \textcolor{gray75}\thechapter\hsp}{0pt}{\\ \Huge\bfseries}[]
%%%---%%%---%%%---%%%---%%%---%%%---%%%---%%%---%%%---%%%---%%%---%%%---%%%
\begin{document}
%%%---%%%---%%%---%%%---%%%---%%%---%%%---%%%---%%%---%%%---%%%---%%%---%%%
% TITLEPAGE
%
% due to variety of titlepage schemes it is probably better to make titlepage manually
%
%%%---%%%---%%%---%%%---%%%---%%%---%%%---%%%---%%%---%%%---%%%---%%%---%%%
\thispagestyle{empty}
{%%%
\sffamily
\centering
\Large
~\vspace{\fill}
{\huge
Thesis title: may be long or short
}
\vspace{2.5cm}
{\LARGE
Your name
}
\vspace{3.5cm}
A thesis submitted in partial fulfillment for the\\
degree of Doctor of Philosophy\\[1em]
in the\\[1em]
Faculty Name\\
University Name
\vspace{3.5cm}
Supervisor: Prof. Joe Doe
\vspace{\fill}
May 2013
%%%
}%%%
\cleardoublepage
%%%---%%%---%%%---%%%---%%%---%%%---%%%---%%%---%%%---%%%---%%%---%%%---%%%
%%%---%%%---%%%---%%%---%%%---%%%---%%%---%%%---%%%---%%%---%%%---%%%---%%%
\tableofcontents
\clearpage
%%%---%%%---%%%---%%%---%%%---%%%---%%%---%%%---%%%---%%%---%%%---%%%---%%%
%%%---%%%---%%%---%%%---%%%---%%%---%%%---%%%---%%%---%%%---%%%---%%%---%%%
\chapter{Introduction}
\section{First section}
\bibliographystyle{unsrt}
\bibliography{references}
\end{document}
答案1
答案2
该错误意味着你使用不当\\
,在这种情况下
{\\ \Huge\bfseries}[]
你不能开始标题带有换行符,正如错误所示,该处没有行可以结束。