4

I'm quite struggling with footers. After hours spent trying to customize usepackage{fancyhdr} and pagestyle{fancy}, I decided to create as simple document as possible. Something reminding picture below.

enter image description here

Unfortunately, when I use

\documentclass[a4paper,12pt,titlepage,oneside,final]{book}
\begin{document}

\frontmatter
\begin{titlepage}
{\bf Titlepage}
\end{titlepage}

\newpage
\thispagestyle{empty}
{\bf included pdf}

\newpage
{\bf declaration}

\newpage
{\bf Acknowledgement}

\newpage
\thispagestyle{empty}
{\bf included pdf}

\tableofcontents


\mainmatter
\chapter*{introduction}
\addcontentsline{toc}{chapter}{introduction}

\chapter{1st chapter}

\end{document}

two problems occur:

1) Roman numerals (i - iv) are placed in the header, on the right. Maybe it's more convenient, I'm not sure - I would rather put them at the bottom if possible.

2) Final .pdf file starts with 1 instead of i (or nothing for titlepage). I would expect pages to be denoted by Arabic numerals since Introduction.

Do you have any clue? Thanks for your time!

  • Do you mean arabic numerals? So 1 should be the first page of the introduction? Do you want the titlepage to have a number but not show it, to have a number and show it as 'i' or not to have a number at all? I ask because you have 'ii' for declaration which suggests pages should not be counted to include the title page. – cfr Jan 26 '14 at 23:36
  • Not quite clear to me. What are those pdfs? One-page like images? And you don't want the page numbers to appear on the pdf pages? – Bernard Jan 26 '14 at 23:36
  • cfr: my bad, Arabic numerals, not letters (edited). My original intention was that titlepage will be numberless. On second thoughts, titlepage being 'i' and ToC being 'vi' + 'i' not shown sounds more reasonable.___ Bernard: Those pdfs are something I'll be including in the document via \includepdf. It is not necessarily one-page image though - that's why \thispagestyle{empty}. – Vochmelka Jan 27 '14 at 0:01
4

Does this produce the result you are looking for?

\documentclass[a4paper,12pt,titlepage,oneside,final]{book}
\usepackage{fancyhdr}
  \fancyhf{}
  \renewcommand{\headrulewidth}{0pt}
  \fancyhf[cf]{\thepage}
  \pagestyle{fancy}

\begin{document}

\frontmatter
\begin{titlepage}
{\bf Titlepage}\thispagestyle{empty}
\end{titlepage}
\pagenumbering{roman}
\stepcounter{page}% comment if the titlepage should not be counted

\newpage
\thispagestyle{empty}
{\bf included pdf}

\newpage
{\bf declaration}

\newpage
{\bf Acknowledgement}

\newpage
\thispagestyle{empty}
{\bf included pdf}

\tableofcontents


\mainmatter
\chapter*{introduction}
\pagenumbering{arabic}
\addcontentsline{toc}{chapter}{introduction}

\chapter{1st chapter}

\end{document}

This omits the number on the title page and included pdfs but counts them. (Comment the relevant line if you don't want to count the title page.)

title page, first included pdf, first numbered page shows 'iii' next three pages with included pdfs unnumbered but counted introduction starts arabic page numbering with '1'

EDIT: This does leave one problem which is not to do with the page numbering of the pages as such but, rather, with the way they are designated in a PDF viewer. Although the page shows 'iii', for example, the viewer will call this '3'. And although the introduction is labelled '1', the viewer will refer to it as '7'.

To address this, we need to use a package designed for dealing with electronic versions of documents rather than merely printed ones. hyperref will address this problem and bookmark may optionally be loaded for enhanced, but more experimental, handling of bookmarks.

The following code produces the same visual output on the page but persuades the PDF viewer to label the pages correctly. This version also updates the deprecated commands identified by Harish Kumar in the comments.

\documentclass[a4paper,12pt,titlepage,oneside,final]{book}
\usepackage{hyperref}
%\usepackage{bookmark}%  uncomment for enhanced, but experimental, bookmark handling
\usepackage{fancyhdr}
  \fancyhf{}
  \renewcommand{\headrulewidth}{0pt}
  \fancyhf[cf]{\thepage}
  \pagestyle{fancy}

\begin{document}

\frontmatter
\begin{titlepage}
{\bfseries Titlepage}\thispagestyle{empty}% note use of \bfseries replacing obsolete \bf command
\end{titlepage}
\pagenumbering{roman}
\stepcounter{page}% comment if the titlepage should not be counted

\clearpage% replaces deprecated \newpage
\thispagestyle{empty}
{\bfseries included pdf}

\clearpage
{\bfseries declaration}

\clearpage
{\bfseries Acknowledgement}

\clearpage
\thispagestyle{empty}
{\bfseries included pdf}

\tableofcontents


\mainmatter
\chapter*{introduction}
\pagenumbering{arabic}
\addcontentsline{toc}{chapter}{introduction}

\chapter{1st chapter}

\end{document}
  • Yes, it's almost perfect. There is still problem #2 -- First pages being addressed by Arabic numerals in the final pdf. When I open pdf, page counter starts with 1 instead of i. – Vochmelka Jan 27 '14 at 0:11
  • Are you saying that you are getting different output from that shown in the images I posted? Or that you want output which differs from that shown? In my output, the first page with an Arabic numeral is the Introduction. Page numbers in \frontmatter are getting roman numerals. That's what the \pagenumbering{roman} does. \pagenumbering{arabic} then switches to Arabic numerals for \mainmatter. – cfr Jan 27 '14 at 0:23
  • @HarishKumar Thanks. You're right. I copied the code from the question without really thinking about it. When Vochmelka lets me know what's not working, I'll hopefully be able to update the code and I'll make sure to update those commands at the same time. (Don't want to waste an edit on it when I'm waiting on a response from the OP. Otherwise I'd change it immediately.) – cfr Jan 27 '14 at 0:35
  • I have just figured out what was the problem. It is necessary to include \usepackage{hyperref} in order to see 'i' instead of 1 as page number, when you open final pdf file in let say Adobe Reader (i.e. postimg.org/image/qtk0xp5jt). Hyperref creates pdf bookmarks. Thank you guys! – Vochmelka Jan 27 '14 at 0:55
  • 1
    @Vochmelka You posted this comment while I was updating my answer. I suddenly had guessed what you meant. I've also updated the obsolete commands Harish Kumar pointed out. You might want to check these and make sure that you are using the new (LaTeX2e/NFSS) versions elsewhere as they correct various deficiencies in the older LaTeX 2.09 versions. – cfr Jan 27 '14 at 1:02

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.