隐藏页面和目录中的章节名称

隐藏页面和目录中的章节名称

我正在尝试为我的硕士论文创建一个包含著名物理学家名言的页面。为此,我使用了命令unchapter,该命令按照我的意愿从页面中删除了章节标题,但将此页面添加到了目录中。我希望章节标题不出现在页面上,但我还想在目录中隐藏此章节。我该怎么做?论文组织在几个文件中,这些文件在主文件中“调用”。我将在此处放置与此问题相关的章节的摘录。此外,在写有名言的页面之前和之后,必须有一个空白页。与名言相对应的章节“Dedicação”不应出现在目录中。我该如何隐藏它?

汇集所有章节的文件:

\documentclass[11pt]{book}
\pagenumbering{gobble} 

% Packages
\usepackage[a4paper,left=2.5cm,right=2.5cm,top=4cm,bottom=4.9cm]{geometry}
\renewcommand{\baselinestretch}{1.15}
\usepackage{graphicx,kantlipsum,setspace}
\usepackage{caption}
\captionsetup[table]{font={stretch=1,footnotesize}, labelfont=bf}
\captionsetup[figure]{font={stretch=1,footnotesize}, labelfont=bf}
\usepackage[font=bf]{caption}
\usepackage{mathrsfs}
\usepackage{slashed}
\usepackage{rotating}
\usepackage{indentfirst}
\usepackage{textcomp}
\usepackage{makecell}
\usepackage{mathtools,float,geometry}
\usepackage{booktabs,array,tabularx,threeparttablex}
\usepackage[portuguese]{babel}
\usepackage{subfig}
\usepackage[version=4]{mhchem}
\usepackage{comment}
\usepackage{float}
\usepackage{catoptions}
\usepackage{graphicx}
\usepackage{bm}
\usepackage{adjustbox}
\usepackage{cite}
\usepackage{caption}
\usepackage{fontspec}
\usepackage{cite}
\usepackage{afterpage}  % blank pages
\usepackage{multirow}  % table
\usepackage{xpatch}  % table
\usepackage{tabu}  % table
\usepackage{hhline}  % cell color does not overlap cell line
\usepackage{fancyhdr}  % headers
\usepackage{breakcites}  % references do not go though margins
\usepackage{sectsty}  % change chapter title size
\setcounter{tocdepth}{3}  % four level contents
\setcounter{secnumdepth}{3}  % numbered four level contents
\usepackage{amsfonts}  % math
\usepackage{amsmath}  % math
\usepackage[nottoc,notlof,notlot]{tocbibind}
\usepackage{hyperref}  % references
\usepackage{lmodern}
\usepackage{lipsum}
\usepackage{fixmath}
\usepackage{scalerel}
\newlength\bshft
\bshft=.18pt\relax
\def\fakebold#1{\ThisStyle{\ooalign{$\SavedStyle#1$\cr%
  \kern-\bshft$\SavedStyle#1$\cr%
  \kern\bshft$\SavedStyle#1$}}}
\newlength\longest
\makeatletter
\newcommand{\unchapter}[1]{%
  \begingroup
  \let\@makechapterhead\@gobble % make \@makechapterhead do nothing
  \chapter{#1}
  \endgroup
}
\makeatother
\usepackage{tcolorbox}
\usepackage{amssymb}
\tcbuselibrary{theorems}

\newtcbtheorem
  []% init options
  {definição}% name
  {Definição}% title
  {%
    colback=gray!5,
    colframe=gray!20!gray,
    fonttitle=\bfseries,
  }% options
  {def}% prefix

\hypersetup{
   colorlinks=true,
   linkcolor=black,
   filecolor=black,
   citecolor=black,
   urlcolor=black,
   bookmarksopen=true,
   linktocpage=true,
   pdfpagemode=UseOutlines,
   pdfstartpage=1
}

\newcommand\blankpage{
    \null
    \thispagestyle{empty}
    \addtocounter{page}{-1}
    \newpage}

\let\origdoublepage\cleardoublepage
\newcommand{\clearemptydoublepage}{%
  \clearpage
  {\pagestyle{empty}\origdoublepage}%
}

\geometry{footskip=1.2cm}

\begin{document}
\begingroup

\newgeometry{left=3cm, right=3cm, top=1cm, bottom=1.2cm}
\renewcommand{\baselinestretch}{1.9}

\include{parts/capa_definitiva}

\afterpage{\blankpage} %comentar para tirar paginas em branco

\endgroup

% Preamble for Thesis
\setmainfont{Times New Roman}
\newgeometry{left=2.5cm,right=2.5cm,top=2.5cm,bottom=2.5cm}
\renewcommand{\baselinestretch}{1.15}
\pagenumbering{Roman}
\pagestyle{plain}
\let\cleardoublepage\clearemptydoublepage  % hide blank pages numbers + headers

\include{parts/agradecimentos}

\include{parts/dedicacao}

\include{parts/contents}

\include{parts/list_of_figures}

\afterpage{\blankpage} %comentar para tirar paginas em branco

% After Introductory Pages
\pagenumbering{arabic}
\pagestyle{fancy}
\newgeometry{left=2.5cm,right=2.5cm,top=2.5cm,bottom=2.5cm,headsep=1cm}
\setlength{\headheight}{14pt} 

\chaptertitlefont{\Huge} % to fit chapter title to one line
\chapternumberfont{\Huge} 

\include{parts/introducao}

\end{document}

名为“Dedicação”的文件,其中包含以下名言:

\unchapter{Dedicação}
\clearpage
\vspace*{\fill}
\begin{quotation}
\textit{``Remember to look up at the stars and not down at your feet. Try to make sense of what you see and wonder about what makes the universe exist. Be curious. And however difficult life may seem, there is always something you can do and succeed at. It matters that you don't just give up.''}

\medskip
\raggedleft
\textbf{Stephen Hawking}
\end{quotation}

\vspace*{\fill}

目录: 在此处输入图片描述

答案1

我认为你使用了错误的方法。请考虑使用以下模板来插入献词:

\documentclass{book}

\begin{document}

\tableofcontents

\clearpage
\begingroup
\pagestyle{empty}
\cleardoublepage

\vspace*{\fill}
\begin{quotation}
  \itshape
  ``Remember to look up at the stars and not down at your feet. 
  Try to make sense of what you see and wonder about what makes 
  the universe exist. Be curious. And however difficult life may 
  seem, there is always something you can do and succeed at. 
  It matters that you don't just give up.''

  \medskip
  \raggedleft
  \upshape\bfseries Stephen Hawking
\end{quotation}

\vspace*{\fill}

\cleardoublepage
\endgroup

\chapter{First chapter}

\end{document}

分组(\begingroup... \endgroup)恢复奉献后的页面样式。

答案2

感谢@Werner,但您可能想考虑使用该epigraph包,它提供了许多控制题词(名言)外观的选项。以下是@Werner 的 MWE 的修改版本。

% quoteprob.tex  SE 590878  

\documentclass{book}
\usepackage{epigraph} % PW added
\usepackage{comment}  % PW added

\begin{document}

\tableofcontents

\clearpage
\begingroup
\pagestyle{empty}
\cleardoublepage

\vspace*{\fill}
\begin{comment} % PW added
\begin{quotation}
  \itshape
  ``Remember to look up at the stars and not down at your feet. 
  Try to make sense of what you see and wonder about what makes 
  the universe exist. Be curious. And however difficult life may 
  seem, there is always something you can do and succeed at. 
  It matters that you don't just give up.''

  \medskip
  \raggedleft
  \upshape\bfseries Stephen Hawking
\end{quotation}
\end{comment}

%%%% PW added
\setlength{\epigraphwidth}{\textwidth}
\epigraph{%
  Remember to look up at the stars and not down at your feet. 
  Try to make sense of what you see and wonder about what makes 
  the universe exist. Be curious. And however difficult life may 
  seem, there is always something you can do and succeed at. 
  It matters that you don't just give up.}
{Stephen Hawking}
%%% end of PW added

\vspace*{\fill}

\cleardoublepage
\endgroup

\chapter{First chapter}

\end{document}

在此处输入图片描述

相关内容