至于我的论文,我今天问了这里但我仍然无法使用它,因为我需要其他包和命令来修改目录。所以这是完整的最小工作模板。我只想让目录中的章节标题全部大写,如“IV. TEST”。抱歉,太长了。
%!TEX TS-program = pdflatex
\documentclass[fontsize=12pt]{report}
\usepackage{mathptmx}
\usepackage{graphicx}
\usepackage[svgnames]{xcolor}
\usepackage{amssymb}
\usepackage{tocloft}
\usepackage{graphicx}
\usepackage{setspace}
\usepackage{indentfirst}
\usepackage[showframe,paperwidth=8.5in,paperheight=11in,top=1in,textwidth=5.8in,bottom=1in,left=1.25in,right=1.25in,footskip=0.3in]{geometry}% This is the page layout.
\usepackage{titling}
\usepackage{setspace}
\usepackage{afterpage}
\newif\ifintoc
\newcommand*{\PrintChapterTocHeadline}
{\hbox to \linewidth{\textbf{Chapter}\hfill\textbf{Page}}\bigskip
\SetupNextPageOne}
\newcommand*{\SetupNextPageOne}
{\afterpage {\ifintoc\PrintChapterTocHeadline\fi}}
\addtocontents{toc}{\protect\PrintChapterTocHeadline}
\newif\ifinlof
\newcommand*{\PrintChapterLofHeadline}
{\hbox to \linewidth{\textbf{Figure}\hfill\textbf{Page}}\bigskip
\SetupNextPage}
\newcommand*{\SetupNextPage}
{\afterpage {\ifinlof\PrintChapterLofHeadline\fi}}
\addtocontents{lof}{\protect\PrintChapterLofHeadline}
\renewcommand{\contentsname}{\fontsize{16pt}{18pt}\selectfont {\centerline{TABLE OF CONTENTS}}}
\renewcommand{\listfigurename}{\fontsize{16pt}{18pt}\selectfont {\centerline{LIST OF FIGURES}}}
\renewcommand{\cftchapfont}{\bfseries\MakeUppercase}
\makeatletter
\renewcommand*\l@chapter{\@dottedtocline{0}{1em}{2.3em}}
\renewcommand*\l@section{\@dottedtocline{1}{3.3em}{2.3em}}
\renewcommand*\l@subsection{\@dottedtocline{2}{5.6em}{2.3em}}
\renewcommand*\l@subsubsection{\@dottedtocline{3}{7.0em}{4.1em}}
\makeatother \usepackage[pdftex,colorlinks,bookmarksnumbered,citecolor=blue,linkcolor=magenta,menucolor=black,pdftoolbar=false,urlcolor=DeepSkyBlue,pdftitle={Comprehensive Exam},pdfauthor={Thein Htay Oo},pdfsubject={Physics},pdfstartview=Fit,pdfdisplaydoctitle=true,pdfpagelayout=SinglePage]{hyperref}
\usepackage{titlesec}
\makeatletter
\def\ttl@mkchap@i#1#2#3#4#5#6#7{%
\ttl@assign\@tempskipa#3\relax\beforetitleunit
\vspace{-\@tempskipa}%<<<<<< REMOVE THE * AFTER \vspace
\global\@afterindenttrue
\ifcase#5 \global\@afterindentfalse\fi
\ttl@assign\@tempskipb#4\relax\aftertitleunit
\ttl@topmode{\@tempskipb}{%
\ttl@select{#6}{#1}{#2}{#7}}%
\ttl@finmarks % Outside the box!
\@ifundefined{ttlp@#6}{}{\ttlp@write{#6}}}
\makeatother
\usepackage{etoolbox}
\makeatletter
\pretocmd{\@sect}{\singlespacing}{}{}
\pretocmd{\@ssect}{\singlespacing}{}{}
\apptocmd{\@sect}{\doublespacing}{}{}
\apptocmd{\@ssect}{\doublespacing}{}{}
\makeatother
\renewcommand{\thechapter}{\Roman{chapter}}
\renewcommand \thesection{\arabic{chapter}.\arabic{section}}
\renewcommand \thesubsection{\arabic{chapter}.\arabic{section}.\arabic{subsection}}
\renewcommand{\familydefault}{\rmdefault}
\titleformat*{\section}{\singlespacing\fontsize{14}{18}\bfseries\rmfamily}
\titleformat*{\subsection}{\singlespacing\fontsize{12}{14}\bfseries\rmfamily}
\titleformat{\chapter}[display] {\singlespacing\rmfamily\fontsize{16pt}{19pt}\bfseries}
{\MakeUppercase{\chaptertitlename\ \thechapter}\filcenter}{10pt}{\centering\uppercase}
{\fontsize{14pt}{16pt}\filcenter}
\titlespacing*{\chapter}{0pt}{0pt}{30pt}
\doublespacing
\renewcommand\thefigure{\arabic{chapter}.\arabic{figure}}
\begin{document}
\pagenumbering{Roman}
\begin{center}
\topskip0pt
\vspace*{\fill}
ype dedication here, if any. Otherwise, delete this page.
\vspace*{\fill}
\end{center}
\pagebreak
\restoregeometry
\begingroup\intoctrue
\setlength{\cftbeforetoctitleskip}{-2.5em}
\tableofcontents
\endgroup
\begingroup\inloftrue
\newpage
\setlength{\cftbeforeloftitleskip}{-2.5em}
\listoffigures
\endgroup
\restoregeometry
\newpage
\setcounter{page}{1}
\pagenumbering{arabic}
\chapter{test}
\section{Test}
\section{Test}
\chapter{Test}
\section{Test}
\begin{figure}
\caption{ms expected.}
\end{figure}
\begin{figure}
\caption{ms expected.}
\end{figure}
\begin{figure}
\caption{ms expected.}
\end{figure}
\chapter{Test}
\section{Test}
\section{Test}
\section{Test}
\chapter{test}
\section{Test}
\section{Test}
\chapter{Test}
\section{Test}
\chapter{Test}
\section{Test}
\chapter{Test}
\section{Test}
\chapter{Test}
\section{Test}
\chapter{Test}
\section{Test}
\end{document}
答案1
\@chapter
您需要以这种方式重新定义宏(因为您正在加载hyperref
)
\makeatletter
\def\@chapter[#1]#2{\ifnum \c@secnumdepth >\m@ne
\refstepcounter{chapter}%
\typeout{\@chapapp\space\thechapter.}%
\addcontentsline{toc}{chapter}%
{\protect\numberline{\thechapter}\texorpdfstring{\uppercase{#1}}{#1}}%
\else
\addcontentsline{toc}{chapter}{\texorpdfstring{\uppercase{#1}}{#1}}%
\fi
\chaptermark{#1}%
\addtocontents{lof}{\protect\addvspace{10\p@}}%
\addtocontents{lot}{\protect\addvspace{10\p@}}%
\if@twocolumn
\@topnewpage[\@makechapterhead{#2}]%
\else
\@makechapterhead{#2}%
\@afterheading
\fi}
\makeatother
(不那么)最小的例子:
%!TEX TS-program = pdflatex
\documentclass[12pt]{report}
\usepackage{mathptmx}
\usepackage{graphicx}
\usepackage[svgnames]{xcolor}
\usepackage{amssymb}
\usepackage{tocloft}
\usepackage{graphicx}
\usepackage{setspace}
\usepackage{indentfirst}
\usepackage[showframe,paperwidth=8.5in,paperheight=11in,top=1in,textwidth=5.8in,bottom=1in,left=1.25in,right=1.25in,footskip=0.3in]{geometry}% This is the page layout.
\usepackage{titling}
\usepackage{setspace}
\usepackage{afterpage}
\newif\ifintoc
\newcommand*{\PrintChapterTocHeadline}
{\hbox to \linewidth{\textbf{Chapter}\hfill\textbf{Page}}\bigskip
\SetupNextPageOne}
\newcommand*{\SetupNextPageOne}
{\afterpage {\ifintoc\PrintChapterTocHeadline\fi}}
\addtocontents{toc}{\protect\PrintChapterTocHeadline}
\newif\ifinlof
\newcommand*{\PrintChapterLofHeadline}
{\hbox to \linewidth{\textbf{Figure}\hfill\textbf{Page}}\bigskip
\SetupNextPage}
\newcommand*{\SetupNextPage}
{\afterpage {\ifinlof\PrintChapterLofHeadline\fi}}
\addtocontents{lof}{\protect\PrintChapterLofHeadline}
\renewcommand{\contentsname}{\fontsize{16pt}{18pt}\selectfont {\centerline{TABLE OF CONTENTS}}}
\renewcommand{\listfigurename}{\fontsize{16pt}{18pt}\selectfont {\centerline{LIST OF FIGURES}}}
\renewcommand{\cftchapfont}{\bfseries\MakeUppercase}
\makeatletter
\renewcommand*\l@chapter{\@dottedtocline{0}{1em}{2.3em}}
\renewcommand*\l@section{\@dottedtocline{1}{3.3em}{2.3em}}
\renewcommand*\l@subsection{\@dottedtocline{2}{5.6em}{2.3em}}
\renewcommand*\l@subsubsection{\@dottedtocline{3}{7.0em}{4.1em}}
\makeatother \usepackage[pdftex,colorlinks,bookmarksnumbered,citecolor=blue,linkcolor=magenta,menucolor=black,pdftoolbar=false,urlcolor=DeepSkyBlue,pdftitle={Comprehensive Exam},pdfauthor={Thein Htay Oo},pdfsubject={Physics},pdfstartview=Fit,pdfdisplaydoctitle=true,pdfpagelayout=SinglePage]{hyperref}
\usepackage{titlesec}
\makeatletter
\def\ttl@mkchap@i#1#2#3#4#5#6#7{%
\ttl@assign\@tempskipa#3\relax\beforetitleunit
\vspace{-\@tempskipa}%<<<<<< REMOVE THE * AFTER \vspace
\global\@afterindenttrue
\ifcase#5 \global\@afterindentfalse\fi
\ttl@assign\@tempskipb#4\relax\aftertitleunit
\ttl@topmode{\@tempskipb}{%
\ttl@select{#6}{#1}{#2}{#7}}%
\ttl@finmarks % Outside the box!
\@ifundefined{ttlp@#6}{}{\ttlp@write{#6}}}
\makeatother
\usepackage{etoolbox}
\makeatletter
\pretocmd{\@sect}{\singlespacing}{}{}
\pretocmd{\@ssect}{\singlespacing}{}{}
\apptocmd{\@sect}{\doublespacing}{}{}
\apptocmd{\@ssect}{\doublespacing}{}{}
\makeatother
\renewcommand{\thechapter}{\Roman{chapter}}
\renewcommand \thesection{\arabic{chapter}.\arabic{section}}
\renewcommand \thesubsection{\arabic{chapter}.\arabic{section}.\arabic{subsection}}
\renewcommand{\familydefault}{\rmdefault}
\titleformat*{\section}{\singlespacing\fontsize{14}{18}\bfseries\rmfamily}
\titleformat*{\subsection}{\singlespacing\fontsize{12}{14}\bfseries\rmfamily}
\titleformat{\chapter}[display] {\singlespacing\rmfamily\fontsize{16pt}{19pt}\bfseries}
{\MakeUppercase{\chaptertitlename\ \thechapter}\filcenter}{10pt}{\centering\uppercase}
{\fontsize{14pt}{16pt}\filcenter}
\titlespacing*{\chapter}{0pt}{0pt}{30pt}
\doublespacing
\renewcommand\thefigure{\arabic{chapter}.\arabic{figure}}
\makeatletter
\def\@chapter[#1]#2{\ifnum \c@secnumdepth >\m@ne
\refstepcounter{chapter}%
\typeout{\@chapapp\space\thechapter.}%
\addcontentsline{toc}{chapter}%
{\protect\numberline{\thechapter}\texorpdfstring{\uppercase{#1}}{#1}}%
\else
\addcontentsline{toc}{chapter}{\texorpdfstring{\uppercase{#1}}{#1}}%
\fi
\chaptermark{#1}%
\addtocontents{lof}{\protect\addvspace{10\p@}}%
\addtocontents{lot}{\protect\addvspace{10\p@}}%
\if@twocolumn
\@topnewpage[\@makechapterhead{#2}]%
\else
\@makechapterhead{#2}%
\@afterheading
\fi}
\makeatother
\begin{document}
\pagenumbering{Roman}
\begin{center}
\topskip0pt
\vspace*{\fill}
ype dedication here, if any. Otherwise, delete this page.
\vspace*{\fill}
\end{center}
\pagebreak
\restoregeometry
\begingroup\intoctrue
\setlength{\cftbeforetoctitleskip}{-2.5em}
\tableofcontents
\endgroup
\begingroup\inloftrue
\newpage
\setlength{\cftbeforeloftitleskip}{-2.5em}
\listoffigures
\endgroup
\restoregeometry
\newpage
\setcounter{page}{1}
\pagenumbering{arabic}
\chapter{test}
\section{Test}
\section{Test}
\chapter{Test}
\section{Test}
\begin{figure}
\caption{ms expected.}
\end{figure}
\begin{figure}
\caption{ms expected.}
\end{figure}
\begin{figure}
\caption{ms expected.}
\end{figure}
\chapter{Test}
\section{Test}
\section{Test}
\section{Test}
\chapter{test}
\section{Test}
\section{Test}
\chapter{Test}
\section{Test}
\chapter{Test}
\section{Test}
\chapter{Test}
\section{Test}
\chapter{Test}
\section{Test}
\chapter{Test}
\section{Test}
\end{document}
输出(目录):