0

I want to add a chapter without numbering in a book class. It should appear in the table of contents as well. However, the chapter rule as it is appears not to allow this properly. For instance, in the chapter, the title of the previous chapters appears. I think I have to modify the command \chapter*[]{}. But I do not know how. Attached, you find a MWE. Thanky you very much.

\documentclass{book}
\begin{document}
\tableofcontents

\chapter[Initial stuff]{Initial stuff}
Interesting stuff.

\clearpage

\chapter*[General summary]{General summary}
\addcontentsline{toc}{chapter}{Summary and overall conclusion}

Interesting stuff.

\clearpage

We conclude.

\end{document} 

EDIT 1:

I recognized that I was missing something in my MWE. The chapter definition. This is why Pieter's reply did not work properly. My apologies. attached you find the full MWE. Since some asked for clarification, maybe due to the missing pieces, I will explain again. My chapter definition is such that, after usage, the title of the chapter as well as the section alternate. This works just fine. However, if I use \chapter*[]{}, it does not work anymore. Instead, we see the ``2.A ADDITIONAL TABLES'' in the header. I would like to see the chapter title instead. I hope this clarifies the issue. I believe this is the key part:

\titleformat{\chapter}[display]
{\Large\sffamily}
{\vspace{1pc}\LARGE\MakeUppercase{\chaptertitlename} \thechapter}
{1pc}
{\titlerule\vspace{1pc}\Huge}

Thanks.

FULL MWE:

\documentclass[12pt]{book}
\renewcommand{\baselinestretch}{1.5}
\usepackage[toc,page]{appendix}
\usepackage{array}
\usepackage{amsmath,amsthm,verbatim,amssymb,amsfonts,amscd, graphicx}

%\usepackage[toc,page]{appendix}
\usepackage{booktabs}
%\usepackage{caption}
%\usepackage{cite}
\usepackage{eurosym}
\usepackage{float}
%\usepackage{graphics}
%\usepackage{hyperref}
\usepackage{lscape}
\usepackage{multirow}
\usepackage{natbib}
\usepackage{natbib}
%\bibliographystyle{rusnat}
%\usepackage[]{natbib}
%\usepackage[authordate]{biblatex-chicago}
%\usepackage[authordate]{biblatex-chicago}
\setcitestyle{sort&compress,authoryear,open={(},close={)}}
\usepackage{rotating}
\usepackage{setspace}
\usepackage{subcaption}
%\usepackage{subfig}
\usepackage{threeparttable}
\usepackage{xcolor}
\usepackage[tableposition=top]{caption}
\usepackage[section]{placeins}
\usepackage[multiple]{footmisc}
\usepackage[left=2.5cm, right=2.5cm, top=2.5cm, bottom=2.5cm]{geometry}
\usepackage{pifont}
\usepackage[acronym]{glossaries}
\makeglossaries
\usepackage{longtable} % for 'longtable' environment
\usepackage{pdflscape} % for 'landscape' environment
\usepackage[hyphens]{url}
\usepackage{hyperref}
\hypersetup{
    colorlinks=true,
    linkcolor=black,
    filecolor=black,      
    urlcolor=black,
    citecolor=blue,
}
\usepackage{fancyhdr}
\pagestyle{fancy}
%\usepackage{fancychap}

\usepackage{titlesec}
\usepackage{lipsum}
\usepackage{etoolbox}
\usepackage{dsfont}
\usepackage{makecell}





\titleformat{\chapter}[display]
{\Large\sffamily}
{\vspace{1pc}\LARGE\MakeUppercase{\chaptertitlename} \thechapter}
{1pc}
{\titlerule\vspace{1pc}\Huge}

\newcommand{\chapterstarmark}[1]{\markboth{#1}{#1}}

\newcommand{\chapterthanksmark}{%
    \renewcommand{\thefootnote}{$\ast$}%
    \footnotemark%
}

\newcommand{\chapterthanksnote}[1]{%
    \renewcommand{\thefootnote}{$\ast$}%
    \addtocounter{footnote}{-1}% 
    \footnotetext{#1}%
    \renewcommand{\thefootnote}{\arabic{footnote}}% <-- restore footnote numbering
}

%[\newpage] % creates the new page
\usepackage{tabularx}


% *****************************************************************
% Custom subcaptions
% *****************************************************************
% Note/Source/Text after Tables
\newcommand{\figtext}[1]{
    \vspace{1ex}
    \captionsetup{justification={justified}, font={footnotesize,singlespacing}}
    \caption*{\hspace{6pt}\hangindent=1.5em #1}
    }
\newcommand{\fignote}[1]{\figtext{\emph{Note:~}~#1}}

\newcommand{\figsource}[1]{\figtext{\emph{Source:~}~#1}}

% Add significance note with \starnote
\newcommand{\starnote}{\figtext{* p $<$ 0.1, ** p $<$ 0.05, *** p $<$ 0.01.}}

\newcommand{\tablefont}{\fontsize{10pt}{10pt}\selectfont\centering}
\newcommand{\tablefonttwo}{\fontsize{8pt}{10pt}\selectfont\centering}
\newcolumntype{Y}{>{\centering\arraybackslash}X}

% *****************************************************************
% Cnew column types
% *****************************************************************
\newcolumntype{L}[1]{>{\raggedright\let\newline\\\arraybackslash\hspace{0pt}}m{#1}}
\newcolumntype{C}[1]{>{\centering\let\newline\\\arraybackslash\hspace{0pt}}m{#1}}
\newcolumntype{R}[1]{>{\raggedleft\let\newline\\\arraybackslash\hspace{0pt}}m{#1}}
\defcitealias{bmg2020}{Federal Ministry of Health, 2020}
\defcitealias{WHO2020}{WHO, 2020}
\defcitealias{BAMF2019}{BAMF, 2019}
\defcitealias{CDC2020}{CDC, 2020}
\defcitealias{RKI2020a}{RKI, 2020a}
\defcitealias{ba2020}{BA, 2020}
\defcitealias{Lancet2020}{The Lancet Global Health, 2020}
\defcitealias{UNHCR1951}{UNHCR, 1951}
\defcitealias{CSTE2017}{\scshape CSTE (2017)}
\newcommand{\ie}{\textit{i}.\textit{e}., }
\newcommand{\eg}{\textit{e}.\textit{g}., }

\def\chapterthanks#1{\renewcommand{\thefootnote}{$\heartsuit$}%
\addtocounter{footnote}{-1}% 
\footnote{#1}}


\makeatletter
\patchcmd{\@maketitle}{\newpage}{}{}{} 
\renewcommand*\l@figure{\@dottedtocline{1}{1.5em}{3em}} % modified. 
\let\l@table\l@figure
\makeatother

\fancyfoot{}
\fancyhead[RO,LE]{\thepage}
\fancyhead[LO]{\leftmark}
\fancyhead[RE]{\rightmark}

\AtBeginEnvironment{subappendices}{%
\chapter*{Appendix}
\addcontentsline{toc}{chapter}{Appendices}
\counterwithin{figure}{section}
\counterwithin{table}{section}
}

\AtEndEnvironment{subappendices}{%
\counterwithout{figure}{section}
\counterwithin{figure}{chapter}
\counterwithout{table}{section}
\counterwithin{table}{chapter}
}


\let\cleardoublepage=\clearpage

\begin{document}
\begin{titlepage}
   \begin{center}
       \vspace*{1cm}

       {\LARGE Awesome stuff}

     
            
       \vspace{2cm}

       {\Large stuffy stuff}

       \vspace{2cm}
       
       {\Large More stuffy stuff
       \vfill
     
       %\includegraphics[width=0.4\textwidth]{university}
            
       Authored by me}
            
   \end{center}
\end{titlepage}

\tableofcontents
\listoffigures
\listoftables

\chapter[Initial stuff]{Initial stuff}
Interesting stuff.

\section{test}

\begin{table}[]
\caption{Test 1\label{tab:test1}}
\begin{tabular}{lllll}
1 & 2 & 3 & 4 &  \\
5 & 6 & 7 & 8 &  \\
  &   &   &   &  \\
  &   &   &   & 
\end{tabular}
\end{table}

\clearpage

more text

\clearpage

way more text

\begin{subappendices}
\section{Additional tables}
\begin{table}[]
\caption{Test 2\label{tab:test2}}
\begin{tabular}{lllll}
1 & 2 & 3 & 4 &  \\
5 & 6 & 7 & 8 &  \\
  &   &   &   &  \\
  &   &   &   & 
\end{tabular}
\end{table}
\end{subappendices}

\chapter[Initial stuff 2]{Initial stuff}
Interesting stuff 2.


\section{test 2}

\begin{table}[]
\caption{Test 3\label{tab:test3}}
\begin{tabular}{lllll}
1 & 2 & 3 & 4 &  \\
5 & 6 & 7 & 8 &  \\
  &   &   &   &  \\
  &   &   &   & 
\end{tabular}
\end{table}

\begin{subappendices}
\section{Additional tables}

\begin{table}[]
\caption{Test 4\label{tab:test4}}
\begin{tabular}{lllll}
1 & 2 & 3 & 4 &  \\
5 & 6 & 7 & 8 &  \\
  &   &   &   &  \\
  &   &   &   & 
\end{tabular}
\end{table}
\end{subappendices}



\chapter*[General summary]{General summary}\addcontentsline{toc}{chapter}{Summary and overall conclusion}

Interesting stuff.

\clearpage

We conclude.

\end{document}

LAST EDIT AND CONCLUSION:

Pieter's olution did it. One has to add it to the preamble and replace the chapterstarmark with Pieter's version. Works perfectly. All complications were caused on my side.

5
  • The \chapter* command does not allow an optional first argument. Why do you want to use the optional argument? – Pieter van Oostrum Apr 19 at 8:21
  • To allow for chapter titles in the header of the pages. Similar to the way in the previous pages. – Daniel2805 Apr 19 at 8:30
  • So if \chapter* has an optional argument, that should got o the header? What if it doesn't have an optional argument? – Pieter van Oostrum Apr 19 at 8:51
  • Are you aware that \chapter* is also used for \tableofcontents, \listoffigures, index, bibliography etc. so if you change it, it will also affect all of these. – Pieter van Oostrum Apr 19 at 8:54
  • I would have suggestes \addcontentsline{toc}{chapter}{}, but as you are already using this, I am not sure, I understand what you are trying to achieve exactly. – Markus G. Apr 19 at 9:44
2

Here is some code to redefine \chapter, such that \chapter* accepts an optional argument. If the optional argument is present, it generates a mark for the header. If not present, nothing changes, so that uses in table of contents, index, bibliography, etc. are not affected. Because for \chapter*, chapter numbers don't make sense, the command doesn't use \chaptermark to generate the mark, but introduces a new command \chapterstarmark that works similar to the \chaptermark for unstarred chapters.

\let\originalchapter\chapter
\RenewDocumentCommand{\chapter}{som}{%
  \IfBooleanTF{#1}
    {% \chapter*
      \originalchapter*{#3}
      \IfNoValueF{#2}
        {\chapterstarmark{#2}}%
    }%
    {% normal \chapter
      \IfNoValueTF{#2}
       {\originalchapter{#3}}
       {\originalchapter[#2]{#3}}%
    }%
}
\newcommand{\chapterstarmark}[1]{\markboth{#1}{}}
4
  • Dear Pieter, my apologies. I just recognized that you were missing crucial information. I added additional information which I deem useful. I hope that clarifies the issue. As it is now, you answer does not work as I hoped (but did not communicate properly). – Daniel2805 Apr 19 at 14:14
  • You said: we see the ``list of tables'' in the header. I don't see that with your example. I do see "2.A Additional tables" where "General summary" probably would be what you want (but don't say). As I said in my answer \chapter*[...]{...} is not supported in standard LaTeX. My code solves that, and it will generate the header "General Summary". But you did not include my code in your example. So maybe you can explain what you really want. – Pieter van Oostrum Apr 19 at 16:38
  • Okay, you are right. My apologies. I am somewhat caught between the original and the MWE. On the last page, it says "2.A ADDITIONAL TABLES". I wish the header would function the same way it does with the \chapter[]{} command. Since this chapter does not have sections, there should be nothing at the even pages. On the odd pages, it should take the chapter title. I think in general, it does not matter whether it is the odd page or not since it depends on where the chapter starts. – Daniel2805 Apr 19 at 18:00
  • \newcommand{\chapterstarmark}[1]{\markboth{#1}{}} – Pieter van Oostrum Apr 19 at 18:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.