0

I am trying to create a page with a quote from a famous physicist for my master's thesis. To do this I used the unchapter command, which removes the chapter heading from the page, as I wanted, but adds this page to the TOC. I want the chapter heading not to appear on the page, but I also want to hide this chapter in the TOC. How can I do this? The thesis is organized in several files that are "called" in a main file. I will put here the excerpts of the sections that are involved in this problem. In addition, before and after the page where the quote is written, there must be a blank page. The chapter "Dedicação", which corresponds to the famous quote should not appear in the TOC. How can I hide it?

File that gathers all the chapters:

\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}

File named "Dedicação" with the famous quote:

\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}

TOC: enter image description here

7
  • 2
    Hey Carmen... can you reduce your code into something smaller? Remove all the unnecessary stuff (including packages and chapters) that doesn't need to be included while still replicating the problem. Can you do that?
    – Werner
    Mar 31, 2021 at 19:54
  • @Werner I have now removed some parts and comments that were not needed, but I am unable to remove more because I am afraid that I may change the formatting. I think it's smaller now. Do you think you could help me, please? I keep trying to solve the problem, but I am not succeeding. Mar 31, 2021 at 20:06
  • 1
    No. The formatting has nothing to do with your problem. For example, do you use makecell, or float anywhere in your use case for the dedication? No. So, remove those. Consider reading this: I've just been asked to write a minimal working example (MWE), what is that? For reference, look at the document I created in my answer. It doesn't use any package, since it's not necessary, and the answer is self-contained (no need to create an extra .tex that you \include).
    – Werner
    Mar 31, 2021 at 20:21
  • 1
    You may want to use \chapter*{...} No chapter number, no TOC entry, no headers. It is what \tableofcontents uses, for example. Mar 31, 2021 at 20:30
  • @JohnKormylo I tried to use the chapter*{}, but in my case, the heading still appears, although in the TOC there is no longer the entry. However, your solution unlike Werner's solution preserves the numbering on the page. Could you put your hypothesis as an answer, please, but taking the heading out of the chapter? Apr 1, 2021 at 1:26

2 Answers 2

2

I think you're using the wrong approach. Consider the following template to insert a dedication:

\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}

The grouping (\begingroup...\endgroup) restores the page style after the dedication.

1

With thanks to @Werner but you might want to consider using the epigraph package which provides many options for controlling the appearance of epigraphs (famous quotes). The following is a modified version of @Werner's 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}

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .