1

I am using the report class. I want my abstract, acknowledgements and table of contents to be in the table of contents and its page number to be roman numerals. Then I want the rest after that to be in numbers. I use the code below but I have no page number on my abstract. It only shows on table of content. I dont know how to use book class because if I change the function from report to book I get a big fat error. Below code and pictures.

\documentclass[pdftex,12pt,a4paper]{report}
\usepackage{titlesec}
\usepackage[toc]{appendix}
\titleformat{\chapter}[display] {\normalfont\Huge\bfseries}{\chaptertitlename\ \thechapter}{0pt}{\Huge}

\usepackage[english]{babel}
\usepackage{pdfpages}
\usepackage[utf8x]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{amsmath}
\usepackage{subfig}
\usepackage{float}
\usepackage{booktabs}
\linespread{1.5}   
\usepackage[a4paper,top=3cm,bottom=2cm,left=3cm,right=3cm,marginparwidth=1.75cm]{geometry}

\usepackage{amsmath}
\usepackage{graphicx}
\usepackage[colorinlistoftodos]{todonotes}
\usepackage{xcolor}
\usepackage{hyperref}
\hypersetup{
  colorlinks=false,
  urlbordercolor=red
}

\makeatletter

\newcommand\frontmatter{%
    \cleardoublepage
  %\@mainmatterfalse
  \pagenumbering{roman}}

\newcommand\mainmatter{%
    \cleardoublepage
 % \@mainmattertrue
  \pagenumbering{arabic}}

\newcommand\backmatter{%
  \if@openright
    \cleardoublepage
  \else
    \clearpage
  \fi
 % \@mainmatterfalse
   }

\makeatother

\title{Your Paper}
\author{You}

\begin{document}

\includepdf{Cover_Page}

\frontmatter
\begin{abstract}
\addcontentsline{toc}{chapter}{Abstract}    
\end{abstract}

\begingroup
  \hypersetup{hidelinks}
  \tableofcontents
\endgroup

\mainmatter
\chapter{Introduction}

enter image description here

enter image description here

i get this error when i use the code below

(no line number):
This is BibTeX, Version 0.99d (TeX Live 2016/Debian)
Capacity: max_strings=100000, hash_size=100000, hash_prime=85009
The top-level auxiliary file: main.aux
The style file: IEEEtran.bst
Reallocated singl_function (elt_size=4) to 100 items from 50.
Reallocated singl_function (elt_size=4) to 100 items from 50.
Reallocated singl_function (elt_size=4) to 100 items from 50.
Reallocated wiz_functions (elt_size=4) to 6000 items from 3000.
Reallocated singl_function (elt_size=4) to 100 items from 50.
Database file #1: sample.bib
Repeated entry---line 88 of file sample.bib
 : @article{videoanalysis
 :                       ,
I'm skipping whatever remains of this entry
Repeated entry---line 163 of file sample.bib
 : @article{vrnn
 :              ,
I'm skipping whatever remains of this entry
-- IEEEtran.bst version 1.14 (2015/08/26) by Michael Shell.
-- http://www.michaelshell.org/tex/ieeetran/bibtex/
-- See the "IEEEtran_bst_HOWTO.pdf" manual for usage information.
Name 6 in "Jeff Donahue and Lisa Anne Hendricks and Marcus Rohrbach and Subhashini Venugopalan and Sergio Guadarrama and Kate Saenko, and Trevor Darrell" has a comma at the end for entry videoanalysis
while executing---line 2403 of file IEEEtran.bst
Name 2 in "Ilya Sutskever and Oriol Vinyals, and Quoc V. Le" has a comma at the end for entry machinetranslation
while executing---line 2403 of file IEEEtran.bst
Name 3 in "Oriol Vinyals and Alexander Toshev and Samy Bengio, and Dumitru Erhan" has a comma at the end for entry imagecaptioning1
while executing---line 2403 of file IEEEtran.bst
Name 3 in "Marco Fraccaroy and Soren Kaae Sonderbyz and Ulrich Paquet, and Ole Winther" has a comma at the end for entry srnn
while executing---line 2403 of file IEEEtran.bst
Name 3 in "Diederik P. Kingma and Danilo J. Rezende and Shakir Mohamed, and Max Welling" has a comma at the end for entry cvae1
while executing---line 2403 of file IEEEtran.bst
Name 1 in "Kihyuk Sohn, Honglak Lee, and Xinchen Yan" has a comma at the end for entry cvae2
while executing---line 2403 of file IEEEtran.bst
Name 2 in "Nitish Srivastava and Elman Mansimov, and Ruslan Salakhutdinov" has a comma at the end for entry unsupvideo
while executing---line 2403 of file IEEEtran.bst
Name 3 in "Serena Yeung and Anitha Kannan and Yann Dauphin, and Li Fei-Fei" has a comma at the end for entry overpruning
while executing---line 2403 of file IEEEtran.bst
Name 4 in "Casper Kaae Sonderby and Tapani Raiko and Lars Maaloe and Soren Kaae Sonderby, and Ole Winther" has a comma at the end for entry trainvae
while executing---line 2403 of file IEEEtran.bst
Name 4 in "Anirudh Goyal and Alessandro Sordoni and Marc-Alexandre Cote and Nan Rosemary Ke, and Yoshua Bengio" has a comma at the end for entry zforcing
while executing---line 2403 of file IEEEtran.bst
Name 5 in "Xingjian Shi and Zhourong Chen and Hao Wang and Dit-Yan Yeung and Wai-kin Wong, and Wang-chun Woo" has a comma at the end for entry convlstm
while executing---line 2403 of file IEEEtran.bst

Done.
You've used 23 entries,
            4087 wiz_defined-function locations,
            914 strings with 10786 characters,
and the built_in function-call counts, 10057 in all, are:
= -- 758
> -- 312
< -- 0
+ -- 146
- -- 73
* -- 447
:= -- 1769
add.period$ -- 46
call.type$ -- 23
change.case$ -- 23
chr.to.int$ -- 0
cite$ -- 23
duplicate$ -- 881
empty$ -- 906
format.name$ -- 94
if$ -- 2235
int.to.chr$ -- 0
int.to.str$ -- 23
missing$ -- 165
newline$ -- 92
num.names$ -- 23
pop$ -- 469
preamble$ -- 1
purify$ -- 0
quote$ -- 2
skip$ -- 752
stack$ -- 0
substring$ -- 23
swap$ -- 489
text.length$ -- 0
text.prefix$ -- 0
top$ -- 5
type$ -- 23
warning$ -- 0
while$ -- 23
width$ -- 25
write$ -- 206
(There were 13 error messages)
  • 1
    Which big fat error do you get with book? Is it complaining about the missing abstract environment?. Your document is incomplete – user31729 Dec 29 '17 at 23:18
  • Does this answer help you? tex.stackexchange.com/a/16347/134144 – leandriis Dec 29 '17 at 23:23
  • abstract uses titlepage, which is using empty page style – user31729 Dec 29 '17 at 23:25
3

By default report uses titlepage option or better \@titlepagetrue (that is set right from the beginning, so titlepage as option is not set explicitly) -- this has a side effect on the definition of abstract (code from report.cls,

  \newenvironment{abstract}{%
      \titlepage
      \null\vfil
      \@beginparpenalty\@lowpenalty
      \begin{center}%
        \bfseries \abstractname
        \@endparpenalty\@M
      \end{center}}%
     {\par\vfil\null\endtitlepage}

Now, \titlepage itself uses \thispagestyle{empty}, so there will be no page number shown.

A patch with

\xpatchcmd{\titlepage}{\thispagestyle{empty}}{\pagestyle{plain}}{}{}%

cures this problem.

Please note that book.cls does not have an abstract environment.

\documentclass[12pt,a4paper]{report}
\usepackage{titlesec}
\usepackage[toc]{appendix}
\titleformat{\chapter}[display] {\normalfont\Huge\bfseries}{\chaptertitlename\ \thechapter}{0pt}{\Huge}

\usepackage[english]{babel}
\usepackage{pdfpages}
\usepackage[utf8x]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{amsmath}
\usepackage{subfig}
\usepackage{float}
\usepackage{booktabs}
\linespread{1.5}   
\usepackage[a4paper,top=3cm,bottom=2cm,left=3cm,right=3cm,marginparwidth=1.75cm]{geometry}

\usepackage{amsmath}
\usepackage{graphicx}
\usepackage[colorinlistoftodos]{todonotes}
\usepackage{xcolor}
\usepackage{tocbibind}
\usepackage{xpatch}
\usepackage{hyperref}
\hypersetup{
  colorlinks=false,
  urlbordercolor=red
}


\makeatletter

\xpatchcmd{\titlepage}{\thispagestyle{empty}}{\pagestyle{plain}}{}{}%
\xpatchcmd{\endtitlepage}{\setcounter{page}\@ne}{\cleardoublepage}{}{}% Remove the reset of page at the end of titlepage

\newcommand\frontmatter{%
  \cleardoublepage
  % \@mainmatterfalse
  \pagenumbering{roman}
}

\newcommand\mainmatter{%
    \cleardoublepage
    % \@mainmattertrue
    \pagenumbering{arabic}
  }

\newcommand\backmatter{%
  \if@openright
    \cleardoublepage
  \else
    \clearpage
  \fi
  % \@mainmatterfalse
}

\makeatother

\title{Your Paper}
\author{You}

\begin{document}

%\includepdf{Cover_Page}


\frontmatter
\begin{abstract}
\addcontentsline{toc}{chapter}{Abstract}    
\end{abstract}

\begingroup
  \hypersetup{hidelinks}
  \tableofcontents
\endgroup

\mainmatter
\chapter{Introduction}

\end{document}
  • 1
    Perhaps, it is better to copy over the definition of abstract to a file using book instead the other way round – user31729 Dec 29 '17 at 23:30
  • 1
    I focused on the abstract issue ... the other issues are exercises to the O.P. – user31729 Dec 29 '17 at 23:38
  • why does it page number abstract and table of contents as i ? – Kong Dec 30 '17 at 0:49
  • 1
    @kong: That's what you requested (see the beginning of your question) : \pagenumbering{roman}, i.e. lower case roman numbers. – user31729 Dec 30 '17 at 0:51
  • 1
    @kong: titlepage resets the page number at the end of the environment, so does abstract as well. See the update, please – user31729 Dec 30 '17 at 0:59

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.