我使用此代码制作文档。如何删除目录中的标题,但保留标题文档并在“章节”和章节名称之间留出空白?我的代码
\documentclass[12pt,a4paper,twoside,openany]{book}
\usepackage{fouriernc}
\usepackage{amsmath,amssymb,amsthm}
\usepackage[left=2cm,right=2 cm,top=2cm,bottom=2cm]{geometry}
\usepackage{tcolorbox}
\usepackage{enumitem}
\usepackage{tasks}
\usepackage{siunitx}
\usepackage{tikz}
\usepackage{tkz-euclide}
\usepackage{float}
\sisetup{output-decimal-marker={,}}
\usepackage{mathtools}
\DeclarePairedDelimiter\abs{\lvert}{\rvert}%
\usepackage{lipsum}
\usepackage{fancyhdr}
\renewcommand{\chaptermark}[1]{\markboth{#1}{}}
\renewcommand{\sectionmark}[1]{\markright{#1}}
\pagestyle{fancy}
\fancyhf{}
\fancyhead[LE,RO]{\thepage}
\fancyhead[LO]{\itshape\nouppercase{\rightmark}}
\fancyhead[RE]{\itshape\nouppercase{\leftmark}}
\renewcommand{\chaptermark}[1]%
{\markboth{{\it \chaptername\,\thechapter.\ #1}}{}}
\renewcommand{\sectionmark}[1]%
{\markright{\it \thesection.\ #1}}
\lhead[\fancyplain{}{\thepage}]%
{\fancyplain{}{\rightmark}}
\rhead[\fancyplain{}{\leftmark}]%
{\fancyplain{}{\thepage}}
\cfoot{}
\sloppy
\usepackage[titletoc,toc,title]{appendix}
\usepackage{tocloft}
\apptocmd{\appendix}
{\addtocontents{toc}{%
\protect\addtolength\protect\cftchapnumwidth{-\mylength}%
\protect\renewcommand{\protect\cftchappresnum}{Something ~}%
\protect\settowidth\mylength{\bfseries\protect\cftchappresnum\protect\cftchapaftersnum}%
\protect\addtolength\protect\cftchapnumwidth{\mylength}}%
}{}{}
\newlength\mylength
\renewcommand{\cftchapaftersnum}{.}
\renewcommand\cftchappresnum{Chapter~}
\settowidth\mylength{\bfseries\cftchappresnum\cftchapaftersnum}
\addtolength\cftchapnumwidth{\mylength}
\usepackage{hyperref}
\hypersetup{
colorlinks=true,
linkcolor=blue,
,unicode,bookmarksnumbered
}
%\usepackage[linkcolor=blue,colorlinks=true,unicode,bookmarksnumbered]{hyperref}
\begin{document}
\tableofcontents
\chapter{Chapter one}
\section{Something}
\lipsum[1-5]
\chapter{Chapter}
\section{Something}
\lipsum[6-10]
\chapter{Chapter}
\section{Something}
\lipsum[11-15]
\chapter{Chapter}
\section{Something}
\chapter{Chapter}
\section{Something}
\chapter{Chapter}
\section{Something}
\chapter{Chapter}
\section{Something}
\chapter{Chapter}
\section{Something}
\chapter{Chapter}
\section{Something}
\chapter{Chapter}
\section{Something}
\chapter{Chapter}
\section{Something}
\chapter{Chapter}
\section{Something}
\section{Something}
\lipsum[6-10]
\chapter{Chapter}
\section{Something}
\lipsum[11-15]
\chapter{Chapter}
\section{Something}
\chapter{Chapter}
\section{Something}
\chapter{Chapter}
\section{Something}
\chapter{Chapter}
\section{Something}
\chapter{Chapter}
\section{Something}
\chapter{Chapter}
\section{Something}
\chapter{Chapter}
\section{Something}
\chapter{Chapter}
\section{Something}
\chapter{Chapter}
\section{Something}
\end{document}
答案1
\pagestyle{empty}
在 之前 \tableofcontents
和之后使用\pagestyle{fancy}
。至于章节和章节名称之间的间距,在 中添加一个四分音符或半个四分音符\renewcommand{\cftchapaftersnum}
:
\documentclass[12pt,a4paper,twoside,openany]{book}
\usepackage{fouriernc}
\usepackage{amsmath,amssymb,amsthm}
\usepackage[left=2cm,right=2 cm,top=2cm,bottom=2cm]{geometry}
\usepackage{tcolorbox}
\usepackage{enumitem}
\usepackage{tasks}
\usepackage{siunitx}
\usepackage{tikz}
\usepackage{tkz-euclide}
\usepackage{float}
\sisetup{output-decimal-marker={,}}
\usepackage{mathtools}
\DeclarePairedDelimiter\abs{\lvert}{\rvert}%
\usepackage{lipsum}
\usepackage{fancyhdr}
\renewcommand{\chaptermark}[1]{\markboth{#1}{}}
\renewcommand{\sectionmark}[1]{\markright{#1}}
\pagestyle{fancy}
\fancyhf{}
\fancyhead[LE,RO]{\thepage}
\fancyhead[LO]{\itshape\nouppercase{\rightmark}}
\fancyhead[RE]{\itshape\nouppercase{\leftmark}}
\renewcommand{\chaptermark}[1]%
{\markboth{{\it \chaptername\,\thechapter.\ #1}}{}}
\renewcommand{\sectionmark}[1]%
{\markright{\it \thesection.\ #1}}
\lhead[\fancyplain{}{\thepage}]%
{\fancyplain{}{\rightmark}}
\rhead[\fancyplain{}{\leftmark}]%
{\fancyplain{}{\thepage}}
\cfoot{}
\sloppy
\usepackage[titletoc,toc,title]{appendix}
\usepackage{tocloft}
\apptocmd{\appendix}
{\addtocontents{toc}{%
\protect\addtolength\protect\cftchapnumwidth{-\mylength}%
\protect\renewcommand{\protect\cftchappresnum}{Something ~}%
\protect\settowidth\mylength{\bfseries\protect\cftchappresnum\protect\cftchapaftersnum}%
\protect\addtolength\protect\cftchapnumwidth{\mylength}}%
}{}{}
\newlength\mylength
\renewcommand{\cftchapaftersnum}{.\quad}
\renewcommand\cftchappresnum{Chapter~}
\settowidth\mylength{\bfseries\cftchappresnum\cftchapaftersnum}
\addtolength\cftchapnumwidth{\mylength}
\usepackage{hyperref}
\hypersetup{
colorlinks=true,
linkcolor=blue,
,unicode,bookmarksnumbered
}
%\usepackage[linkcolor=blue,colorlinks=true,unicode,bookmarksnumbered]{hyperref}
\begin{document}
\pagestyle{empty}
\tableofcontents
\pagestyle{fancy}
\chapter{Chapter one}
\section{Something}
\lipsum[1-5]
\chapter{Chapter}
\section{Something}
\lipsum[6-10]
\chapter{Chapter}
\section{Something}
\lipsum[11-15]
\chapter{Chapter}
\section{Something}
\chapter{Chapter}
\section{Something}
\chapter{Chapter}
\section{Something}
\chapter{Chapter}
\section{Something}
\chapter{Chapter}
\section{Something}
\chapter{Chapter}
\section{Something}
\chapter{Chapter}
\section{Something}
\chapter{Chapter}
\section{Something}
\chapter{Chapter}
\section{Something}
\section{Something}
\lipsum[6-10]
\chapter{Chapter}
\section{Something}
\lipsum[11-15]
\chapter{Chapter}
\section{Something}
\chapter{Chapter}
\section{Something}
\chapter{Chapter}
\section{Something}
\chapter{Chapter}
\section{Something}
\chapter{Chapter}
\section{Something}
\chapter{Chapter}
\section{Something}
\chapter{Chapter}
\section{Something}
\chapter{Chapter}
\section{Something}
\chapter{Chapter}
\section{Something}
\end{document}