1

For the table of contents, I change the page number in the footer from roman numerals to arabic numerals. But the problem is that the page number will be reset to 1 after the table of contents. I want to make it continue following the page number of table of contents. Could anyone tell me how to do that?

The following is my code for setup header-footer and chapter page:

% Setup fancy headings
\pagestyle{fancyplain}
\newcommand{\clearemptydoublepage}{%
  \newpage{\pagestyle{empty}\cleardoublepage}%
}
\renewcommand{\chaptermark}[1]{%
  \markboth{#1}{}%
}
\renewcommand{\sectionmark}[1]{%
  \markright{\thesection\ #1}%
}

\fancyhead[LE]{\fancyplain{}{\includegraphics[height=0.56in, width=1.5in]{logo.jpg}}}
\fancyhead[CE]{\fancyplain{}{}}
\fancyhead[RE]{\fancyplain{}{}}
\fancyhead[LO]{\fancyplain{}{}}
\fancyhead[CO]{\fancyplain{}{}}
\fancyhead[RO]{\fancyplain{}{\includegraphics[height=0.56in, width=1.5in]{logo.jpg}}}
\fancyfoot[LE]{\fancyplain{}{\bfseries\ page \arabic{page}\ of \pageref{LastPage}}}
\fancyfoot[CE]{\fancyplain{}{}}
\fancyfoot[RE]{\fancyplain{}{}}
\fancyfoot[LO]{\fancyplain{}{}}
\fancyfoot[CO]{\fancyplain{}{}}
\fancyfoot[RO]{\fancyplain{}{\bfseries\ page \arabic{page}\ of \pageref{LastPage}}}  

%---------- Set up chapter style -------------------------------------
\makeatletter
\def\thickhrulefill{\leavevmode \leaders \hrule height 2pt \hfill \kern \z@}
\def\@makechapterhead#1{%
  \thispagestyle {fancyplain}
  \vspace*{10\p@}%
  {\parindent \z@ 
    {\raggedleft \reset@font% 
     \fontencoding{OT1}\fontfamily{cmr}\fontseries{b}\fontshape{n}\fontsize{22pt}{12}\selectfont%
     \bfseries\thechapter\nobreak\hspace{1ex}}%
    {\raggedright \reset@font%
      \fontencoding{OT1}\fontfamily{cmr}\fontseries{b}\fontshape{n}\fontsize{22pt}{12}\selectfont%
      \bfseries #1}%
    \interlinepenalty\@M
    \par\nobreak
    \textcolor{orange}{\thickhrulefill}
    \vspace{26pt}
    \par\nobreak

  }}

\def\@makeschapterhead#1{%
  \thispagestyle {fancyplain}
  \vspace*{10\p@}%
  {\parindent \z@ 
    {\raggedright \reset@font%
      \fontencoding{OT1}\fontfamily{cmr}\fontseries{b}\fontshape{n}\fontsize{22pt}{12}\selectfont%
      \bfseries #1}%
    \interlinepenalty\@M
    \par\nobreak
    \textcolor{orange}{\thickhrulefill}
    \vspace{26pt}
    \par\nobreak

  }}

\makeatother

1 Answer 1

5

Switching to a different \pagenumbering will reset the page counter. Use an auxiliary counter to save the value of page after the ToC, and reset the page counter to this value after switching to arabic.

\documentclass{report}

\usepackage[english]{babel}
\usepackage{blindtext}

\pagenumbering{roman}

\newcounter{mypageno}
\let\oldtableofcontents\tableofcontents
\renewcommand{\tableofcontents}{%
  \oldtableofcontents
  \cleardoublepage
  \setcounter{mypageno}{\value{page}}%
  \pagenumbering{arabic}%
  \setcounter{page}{\value{mypageno}}%
}

\begin{document}

\tableofcontents

\blinddocument

\blinddocument

\blinddocument

\blinddocument

\blinddocument

\end{document}

(The blindtext package is only used to add some dummy text to the example.)

EDIT: MWE changed -- \tableofcontents is redefined in the preamble (this could be used in a .sty file). Note that I'm assuming there should be a page break after the ToC.

1
  • Actually, my code is in .sty file. I want to adjust the .sty file in order to modify the .tex file. In this case, how can I do that? Thanks a lot.
    – Jason Xu
    Jul 20, 2011 at 18:08

You must log in to answer this question.

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