2

I am currently writing my final master thesis in tex. I am stuck up in the following place. Firstly I have a chapter called Introduction which is not numbered. In the table of contents page, the introduction page starts with a different page number than 1. Ex:enter image description here

Next problem is in the introduction chapter. The heading is different from what it supposed to be. In my template, the first page of the chapter only has a header line with page number and the subsequent pages have the chapter name as header. In this case it is throwing up something else. Ex. enter image description here

and this is the next page enter image description here

How to resolve this ?

The third problem is in the table of contents as shown in the figure, "Acknowledgements" and "Abstract" have been assigned some roman numbers. But actually there are no page numbers in the respective tex files. How to set page numbering for these two pages and also incorporate the same in the table of contents. I am also attaching my code in the main file thesis.tex so that it is helpful:

\documentclass[oneside,a4paper,12pt]{book}
% Start Global Settings
\linespread{1.3}
%\usepackage{epigraph}
\usepackage{attrib}
\usepackage{amssymb}
\usepackage{amsmath}
%\usepackage{abstract}
\usepackage{amsthm}
\usepackage{mathrsfs}
\usepackage{float}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage{amsfonts}
\usepackage{geometry}
\usepackage{braket}
\usepackage{array,booktabs}
\usepackage[dvipsnames]{xcolor}
%\usepackage[svgnames]{xcolor}
\usepackage{sectsty}
\usepackage[titletoc]{appendix}
%\usepackage{nath}
%\usepackage{w}
%\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
%use color for the document
\usepackage{color}
%for allowing word-wrap around images.
\usepackage{floatflt}
\usepackage{graphicx}
\usepackage{fontspec}
%\usepackage{xunicode}
%\usepackage{xltxtra}
\usepackage{polyglossia}
\setmainlanguage[variant=british]{english}
\setotherlanguage{sanskrit}
%\font\serif="FreeSerif:script=beng"
\newfontfamily\devanagarifont[Script=Devanagari]{Lohit Devanagari}
\usepackage{subfigure}
%Indent the first line of the first paragraph after each section heading.
\usepackage{indentfirst}
%Enable HyperLinks
\usepackage[plainpages=false]{hyperref}
    \hypersetup{colorlinks,citecolor=black,filecolor=black,linkcolor=black,urlcolor=black}
\usepackage{url}
\usepackage{amsmath}
\setcounter{secnumdepth}{4} %By doing this, we allow subsubsubsections to be numbered :)
\usepackage{fancyhdr}
\pagestyle{fancy}
\renewcommand{\chaptermark}[1]{\markboth{#1}{}}
\renewcommand{\sectionmark}[1]{\markright{\thesection\ #1}}

    \fancypagestyle{mystyle}{
    \fancyhf{} % delete current setting for header and footer
    \fancyhead[L]{\bfseries\rightmark}
    \fancyhead[R]{\bfseries\thepage}
    \renewcommand{\headrulewidth}{1pt}
    \renewcommand{\footrulewidth}{1pt}
    \addtolength{\headheight}{1pt} % make space for the rule
    \fancyfoot[L]{\bfseries \it{\bfseries{}}}       %footer here
    }

%   %LOOKS LIKE THE FANCY HEADER USES PLAIN FANCYPAGESTYLE FOR THE FIRST PAGE OF EACH CHAPTER.
    \fancypagestyle{plain}{
    \fancyhead{}% get rid of headers on plain pages
    \renewcommand{\headrulewidth}{0pt}
    \renewcommand{\footrulewidth}{1pt}
    \fancyfoot[C]{\bfseries \thepage}
    }

    \fancypagestyle{empty}
    {
        \fancyhf{}
        \renewcommand{\headrulewidth}{0pt}
        \renewcommand{\footrulewidth}{0pt}
    }
%End Global Settings

%\setlength{\topmargin}{-0.3in}
%\setlength{\topskip}{0.3in}    % between header and text
\setlength{\textheight}{8.4in} % height of main text
%\setlength{\textwidth}{5.8in}    % width of text
%\setlength{\oddsidemargin}{0.75in} % odd page left margin
%\setlength{\evensidemargin}{0.75in} % even page left margin

%\addtolength{\evensidemargin}{-2cm}
%\addtolength{\oddsidemargin}{-2cm}
%\addtolength{\textwidth}{2cm}


\begin{document}
\nocite{*}  
\pagestyle{empty}

\input{Title.tex}
% !TeX program = xelatex
\input{dedication2.tex}
\input{Tribute.tex}
\input{dedicate.tex}
\input{SSSUCertificate.tex}
\input{Declaration.tex}
\frontmatter
\pagestyle{plain}
\tableofcontents
\pagenumbering{roman}
\listoffigures
\input{Ack.tex}
\addcontentsline{toc}{chapter}{Acknowledgements}
\input{Abstract.tex}
\addcontentsline{toc}{chapter}{Abstract}
%\listoftables
%\addcontentsline{toc}{chapter}{List of Figures}
%\addcontentsline{toc}{chapter}{List of Figures}
\mainmatter
\pagestyle{mystyle}
%\chapterfont{\color{Aquamarine}}
%\sectionfont{\color{MidnightBlue}}
%\subsectionfont{\color{RedViolet}}
%input your tex files using the input command
\input{intro.tex}
\addcontentsline{toc}{chapter}{Introduction}
\input{chapter1.tex}
\input{chapter2.tex}
\input{chapter3.tex}
\input{chapter4.tex}

\bibliographystyle{plain}
%create a bibiliograpgy file using jabref and input the file name below. In this case it is refs.bib
\bibliography{refs}
\addcontentsline{toc}{chapter}{Bibliography}
\end{document}

thanks for the help and suggestions.

1

The first issue should be solvable by using the following after starting your mainmatter:

\setcounter{page}{1}

This resets the page number.

For the second issue, I would use the titlesec package to set the pagestyle of the chapter page:

\assignpagestyle{\chapter}{plain}

This is necessary as the \chapter sets the plain pagestyle by default.

  • If \mainmatter would be used, the problem wouldn't occure. This is probably due to using \pagenumbering . The pagestyle matter is dealt with in the example code but probably overridden later. Nobody knows. – Johannes_B Mar 19 '16 at 14:10
  • As far as I can see, \mainmatter is used in the code posted? – Vidar Mar 19 '16 at 14:24
  • Oh yes, i am sorry. The manual toc entry is added at the wrong place. – Johannes_B Mar 19 '16 at 14:27
  • Also, while I see that the chapter style is attempted dealt with in the code, the titlesec package might have more robust implementation? At least it has worked well for me for this issue in the past. – Vidar Mar 19 '16 at 14:27
  • 1
    For the third issue: Open up a new question. Generally we have one question, one issue. – Johannes_B Mar 21 '16 at 6:28

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.