0

I'm writing my thesis using the book document class.

To include the acknowledgments environment, I added some lines to my code.

The problem now is that using this acknowledgments environment resets the numbering of the pages, for some reason I don't understand.

Also, I'm not able to include the Abstract environment. Can anyone please help?

\documentclass[12pt, a4paper]{book}

\makeatletter
\newcommand\ackname{\Large Acknowledgments}
 \if@titlepage
 \newenvironment{acknowledgments}{%
   \titlepage
   \null\vfil
   \@beginparpenalty\@lowpenalty
   \begin{center}%
     \bfseries \ackname
     \@endparpenalty\@M
   \end{center}}%
  {\par\vfil\null\endtitlepage}
\else
\newenvironment{acknowledgments}{%
   \if@twocolumn
     \section*{\abstractname}%
   \else
     \small
     \begin{center}%
       {\bfseries \ackname\vspace{-.5em}\vspace{\z@}}%
     \end{center}%
     \quotation
   \fi}
   {\if@twocolumn\else\endquotation\fi}
\fi
\makeatother

\begin{document}
\begin{titlepage}
 \centering   
\begin{center}
{\Huge This the title}
   \end{center}
 \end{titlepage}

 \begin{acknowledgments}
 These are the acknowledgments
 \end{acknowledgments}

 \tableofcontents
 \chapter{First chapter}
 \end{document}
5
  • (1) The book class does not define the abstract environment. (2) The titlepage environment (or the \titlepage command, it’s essentially the same) resets the page number to 1.
    – GuM
    Sep 30 '18 at 8:32
  • Yes, I want the titlepage to be number 1 indeed. The problem is that I get, in this order: Page with the title: 1 , blank page: 2, page with the acknowledgments: 1, subsequent pages: 2,3,4, etc.
    – Mary
    Sep 30 '18 at 8:41
  • …Which is exactly what you should expect, since the code you added uses \titlepage to typeset the acknowledgments. Either use a different implementation, or save, and then restore, the value of the page counter. As a collateral remark, I must observe that your code contains some evident mistakes…
    – GuM
    Sep 30 '18 at 8:46
  • Now I get it, you're right! I just found that piece of code on the internet, I don't know Latex well so I don't really understand everything that is written in those lines (I understand very little to be fair), I just hoped it worked for what I wanted. Do you know how to write a better piece of code without using titlepage? Can I just delete that command from the code?
    – Mary
    Sep 30 '18 at 8:51
  • The code you found is a modification of the code for the abstract environment found, e.g., in the report class. Are you sure that you want to typeset the acknowledgments as if they were an abstract? Follow @egreg advice, set them as a normal, albeit unnumbered, chapter; moreover, may be they are best placed at the end of your thesis.
    – GuM
    Sep 30 '18 at 9:45
1

@egreg answered while I was slowly preparing the following code, which does exactly what you were trying to do, that is, typeset the acknowledgments as if they were an abstract, but without resetting the page number. This code honors the titlepage/notitlepage options, as well as the onecolumn/twocolumn ones.

\documentclass[12pt,a4paper]{book}

\makeatletter

\newcommand*\ackname{Acknowledgments}
\if@titlepage
  \newenvironment*{acknowledgments}{%
    \cleardoublepage
    \if@twocolumn
      \@restonecoltrue\onecolumn
    \else
      \@restonecolfalse\newpage
    \fi
    \thispagestyle{empty}%
    \null\vfil
    \@beginparpenalty\@lowpenalty
    \begin{center}%
      \Large \bfseries \ackname
      \@endparpenalty\@M
    \end{center}%
  }{%
    \par\vfil\null  % the standard classes do so, but is it right?
    \endtitlepage   % this can be safely used
  }
\else
\newenvironment{acknowledgments}{%
   \if@twocolumn
     \section*{\ackname}%
   \else
     \small
     \begin{center}%
       {\bfseries \ackname\vspace{-.5em}\vspace{\z@}}%
     \end{center}%
     \quotation
   \fi}
   {\if@twocolumn\else\endquotation\fi}
\fi
\makeatother

\begin{document}
\begin{titlepage}
 \centering   
\begin{center}
{\Huge This the title}
   \end{center}
 \end{titlepage}

 \begin{acknowledgments}
 These are the acknowledgments
 \end{acknowledgments}

 \tableofcontents
 \chapter{First chapter}
 \end{document}

Let me clarify, however, that I’m not endorsing or recommending this solution.

3
  • Thank you a lot! I may be wrong, but for my taste, I find it more visually appealing to have the acknowledgments section typeset like this, to differentiate it from the chapters
    – Mary
    Sep 30 '18 at 13:50
  • @Mary: Well, if that is what you want… Let me know if you want the acknowledgements listed in the table of contents.
    – GuM
    Sep 30 '18 at 18:32
  • Thank you but it's not necessary, it's perfect like this
    – Mary
    Oct 2 '18 at 9:35
2

Define the environment without \titlepage.

\documentclass[12pt, a4paper]{book}

\newcommand\ackname{Acknowledgments}
\newenvironment{acknowledgments}
 {%
  \cleardoublepage
  \thispagestyle{plain}
  \addcontentsline{toc}{chapter}{\ackname}
  \vspace*{\fill}
  \begin{center}
  \bfseries\Large\ackname
  \end{center}
 }
 {\par\vspace*{\fill}}

\begin{document}

\begin{titlepage}
\begin{center}
\Huge This the title
\end{center}
\end{titlepage}

\begin{acknowledgments}
These are the acknowledgments
\end{acknowledgments}

\tableofcontents

\chapter{First chapter}

\end{document}

To be honest, I'd much prefer a simpler

\chapter*{\ackname}
\addcontentsline{toc}{chapter}{\ackname}

These are the acknowledgments
0

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.