Page LayoutPage number location problem in thesis bibliography

Information and discussion about page layout specific issues (e.g. header and footer lines, page formats, page numbers).
nevohraalnavnoj
Posts: 5
Joined: Wed May 26, 2010 6:44 pm

Page number location problem in thesis bibliography

Post by nevohraalnavnoj »

Hello everyone, please let me say thank you in advance your help. I have wrestled with this problem for hours and hours and I can not come up with a solution.

I am writing my PhD dissertation, I am using the natbib package so that I have more in-line citing options. I am using a .sty file provided by a former student of my university.

We are required to have page numbers in the upper right, but for the first page of my bibliography the page number is centered in the footer. I have tried a multitude of things to correct it. Here is my main thesis document:

Code: Select all

\documentclass[12pt]{report}

%include all the standard packages
\usepackage{myUniversitysStyleFile}
\usepackage[round]{natbib}

\begin{document}

\include{all my chapters}

\addtocontents{toc}{\protect\vspace{\li}}
\biblio{mythesisbibfile}

\end{document}
And here are the two relevant parts from "myUniversitysStyleFile"

Code: Select all

\newcommand{\biblio}[1]{
   \addcontentsline{toc}{head}{REFERENCES}
   \doublespace\normalsize
   \thispagestyle{myheadings}
   \bibliographystyle{plainnat}
   \bibliography{#1}
}
and

Code: Select all

\def\thebibliography#1{\chapter*{References\markboth
  {REFERENCES}{REFERENCES}}\list
  {[\arabic{enumi}]}{\settowidth\labelwidth{[#1]}
    \thispagestyle{myheadings}
    \leftmargin\labelwidth
    \raggedbottom
    \advance\leftmargin\labelsep
    \usecounter{enumi}}
    \itemsep 7pt
    \def\newblock{\hskip .11em plus .33em minus -.07em}
    \sfcode`\.=1000\relax
 }
Can anyone please offer a suggestion so I can get the first page of my bibliography in the upper right hand corner? Thank you!

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

meho_r
Posts: 823
Joined: Tue Aug 07, 2007 5:28 pm

Page number location problem in thesis bibliography

Post by meho_r »

Hi. Welcome to the forum. In future, please take habit of providing all relevant informations, not just fragments of code, and build a complete compilable MWE (Minimal Working Example). This way you'll significantly shorten the time needed for people here to analyze your problem and suggest you what to do.

The problem at hand is that plain page style is automatically applied to the first page of chapters (including Bibliography) simply ignoring page style currently in effect. Because of that, it should be redefined. The easiest way to do that is to use fancyhdr package for setting headers/footers (take a look at section 7 of fancyhdr manual for redefining plain page style). Try this code (and don't forget to remove or comment out any previously defined page styles like myheadings and similar):

Code: Select all

\usepackage{fancyhdr}

\fancyhf{} % clear all header and footer fields
\fancyhead[R]{\thepage}

\renewcommand{\headrulewidth}{0pt}
\renewcommand{\footrulewidth}{0pt}

% Redefining plain style which is automatically applied to chapters (including Bibliography)

\fancypagestyle{plain}{%
\fancyhf{} % clear all header and footer fields
\fancyhead[R]{\thepage}
\renewcommand{\headrulewidth}{0pt}
\renewcommand{\footrulewidth}{0pt}}

\pagestyle{fancy}
nevohraalnavnoj
Posts: 5
Joined: Wed May 26, 2010 6:44 pm

Re: Page number location problem in thesis bibliography

Post by nevohraalnavnoj »

Thank you for your response. I'm a bit confused when you asked to comment out the styles defined by "myheadings". I believe everything in "myheadings" is a format required by my university. I can include the entire university style file, if you like but it is long.

Thanks,

Jon
meho_r
Posts: 823
Joined: Tue Aug 07, 2007 5:28 pm

Page number location problem in thesis bibliography

Post by meho_r »

You can always create headers/footers with fancyhdr to resemble those created by myheadings page style. If you need only page numbers in the upper right corner, this is simple process (just use the code I provided). Even if headers/footers in your document contain more infos, using fancyhdr to recreate them shouldn't be difficult.

However, if you don't want to use fancyhdr and redefine headers/footer, try redefining only plain page style using this code:

Code: Select all

\makeatletter
\renewcommand{\ps@plain}{%
\renewcommand\@oddhead{\hfil\normalfont\textrm{\thepage}}%
\renewcommand\@evenhead{}%
\renewcommand\@oddfoot{}%
\renewcommand\@evenfoot{}%
}
\makeatother
nevohraalnavnoj
Posts: 5
Joined: Wed May 26, 2010 6:44 pm

Re: Page number location problem in thesis bibliography

Post by nevohraalnavnoj »

I just tried the latest suggestion, adding it to the end of the style file. It worked, thank you! I would have saved hours if I had just asked you first! :)

Thanks, Jon.
nevohraalnavnoj
Posts: 5
Joined: Wed May 26, 2010 6:44 pm

Re: Page number location problem in thesis bibliography

Post by nevohraalnavnoj »

meho_r, can you help me out again?

Overwriting the plain style file has now interfered with requirements in Table of Contents section. In this section, the numbers are to be bottom of the page and centered. The rest of the document, they are to be upper right.

Your solution fixed the problem in the Bibliography, but has now introduced the problem of upper-right numbers in the Table of Contents section.

HELP??! Thank you!

Jon
meho_r
Posts: 823
Joined: Tue Aug 07, 2007 5:28 pm

Page number location problem in thesis bibliography

Post by meho_r »

OK, you just have to redefine plain style again.

1. Remove the code which redefines plain style from your style file, you'll be doing redefinition directly in your document.
2. Redefine plain style for TOC part (put it somewhere before TOC).
3. Redefine plain style for the rest of the document (put it just after TOC and \clearpage command).

An example:

Code: Select all

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

\pagestyle{myheadings}

\begin{document}

% Redefine plain style for the TOC part:
\makeatletter
\renewcommand{\ps@plain}{%
\renewcommand\@oddhead{}%
\renewcommand\@evenhead{}%
\renewcommand\@oddfoot{\hfil\normalfont\textrm{\thepage}\hfil}%
\renewcommand\@evenfoot{}%
}
\makeatother

\pagestyle{plain}% Centered page numbers in footer for TOC pages after the first one

\tableofcontents
\clearpage% Don't forget to clear page after TOC

% Redefine plain style for the rest of the document:
\makeatletter
\renewcommand{\ps@plain}{%
\renewcommand\@oddhead{\hfil\normalfont\textrm{\thepage}}%
\renewcommand\@evenhead{}%
\renewcommand\@oddfoot{}%
\renewcommand\@evenfoot{}%
}
\makeatother

\pagestyle{myheadings}% Page numbers in header, on the right

% Some dummy text:
\Blinddocument
\Blinddocument
\Blinddocument
\Blinddocument
\Blinddocument

\end{document}
So, basically, you may redefine plain style for different parts of your document, just don't forget \clearpage to make a "cut" between those parts.
nevohraalnavnoj
Posts: 5
Joined: Wed May 26, 2010 6:44 pm

Re: Page number location problem in thesis bibliography

Post by nevohraalnavnoj »

Thank you for the help. I have placed the code just before the bibliography, and it works great. Thank you!
ThinkAlot
Posts: 2
Joined: Fri Apr 15, 2011 3:19 am

Page number location problem in thesis bibliography

Post by ThinkAlot »

Hello,

I'm writing my Thesis in TexMaker. I've used several commands from this post to get my page numbers, on every page, up into the right hand corner. Also, I've found other commands which redefine things so the space between my Chapter Headings is reduced. Everything is almost complete. However, I discovered that the redefinition code to move my page number up to the right hand corner contains something in it which won't allow me adjust my \textwidth{}. I believe it is the \makeatletter command which has caused this, but I don't know how to go into this command to free up the \textwidth{} adjustment command. My margins are supposed to be: Top margin = .75in (where page number just begins), Bottom margin = 1in, right = 1.25 to 1.5in, left = 1in. Everything in the code I've provided is just about perfect except, the last thing I need to do is fatten my textwidth just a bit. The default is something around 5.25in to 5.75in, and I'm required to have it at 6in to 6.25in. Note, the code shows my \textwidth{6.25in}, but that's not what prints out. Even when you change it to 6.5in or 5in, nothing changes in the pdf viewer or when you print. Any help on this would be greatly appreciated. Thank you!

Code: Select all

\documentclass[12pt,letterpaper]{report}
%\documentclass[12pt]{report}
\usepackage[latin1]{inputenc}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage[pdftex]{graphicx}
\usepackage{setspace}
\title{Title}

\begin{document}
%Rewrites plain page settings with all page numbers @ top-right-corner.
\makeatletter
\renewcommand{\ps@plain}{
\renewcommand\@oddhead{\hfil\normalfont\textrm{\thepage}}
\renewcommand\@evenhead{}
\renewcommand\@oddfoot{}
\renewcommand\@evenfoot{}}
%Reduces space between section headings and top margin
\def\@makechapterhead#1{%
  \vspace*{-48\p@}%
  {\parindent \z@ \raggedright \normalfont
    \ifnum \c@secnumdepth >\m@ne
        \huge\bfseries \@chapapp\space \thechapter
        \par\nobreak
        \vskip 0\p@
    \fi
    \interlinepenalty\@M
    \Huge \bfseries #1\par\nobreak
    \vskip 20\p@
  }}

\def\@makeschapterhead#1{%
  \vspace*{-48\p@}%
  {\parindent \z@ \raggedright
    \normalfont
    \interlinepenalty\@M
    \Huge \bfseries  #1\par\nobreak
    \vskip 20\p@
  }}
\makeatother

%Page numbers in header, on the right.
\pagestyle{myheadings}
\thispagestyle{empty}

\renewcommand{\thepage}{\roman{page}}
\renewcommand{\contentsname}{Table of Contents}

%General Page Settings
%\setlength{\pdfpageheight}{11in}
%\setlength{\pdfpagewidth}{8.5in}
\addtolength{\voffset}{-.5in}
\addtolength{\hoffset}{0in}
\setlength{\marginparwidth}{1.5in}
\setlength{\oddsidemargin}{.75in}
\setlength{\marginparsep}{0in}
\setlength{\topmargin}{12pt}
\setlength{\headheight}{12pt}
\setlength{\headsep}{12pt}
\setlength{\textheight}{9in}
\setlength{\textwidth}{6.25in}
\setlength{\footskip}{0in}
\doublespacing

%Titlepage
\begin{center}
(TITLE IN CAPS)\\
A Thesis\\
Presented in Partial Fulfilment of the Requirements for the\\
Degree of (degree name)\\
with a\\
Major in (major)\\
in the\\
College of Graduate Studies\\
(name of college)\\
\vspace{84pt}
by\\
my name\\
\vspace{48pt}
May 2011\\
\vspace{60pt} 
Major Professor: name1, Ph.D.\\
\end{center}
\pagebreak

%Authorization to Submit Thesis
\addcontentsline{toc}{chapter}{Authorization to Submit Thesis}
\section*{\huge{AUTHORIZATION TO SUBMIT \begin{center}THESIS\end{center}}}
\begin{flushleft}
This thesis of \ldots.
\end{flushleft}
\begin{singlespace}
\ \ \ \ \ \ \ Major Professor\indent\underline{\makebox[2.8in][l]{\ }}Date\underline{\makebox[1.2in][l]{\ }}\\
\indent\indent\indent\indent\indent\indent\indent name1, Ph.D.\\
\ \\
\indent Committee\\
\indent Members\indent\indent\ \ \ \ \ \ \underline{\makebox[2.8in][l]{\ }}Date\underline{\makebox[1.2in][l]{\ }}\\
\indent\indent\indent\indent\indent\indent\indent name2, Ph.D.\\
\ \\
\indent\indent\indent\indent\indent\indent\ \ \ \underline{\makebox[2.8in][l]{\ }}Date\underline{\makebox[1.2in][l]{\ }}\\
\indent\indent\indent\indent\indent\indent\indent name3, Ph.D.\\
\ \\
\indent\indent\indent\indent\indent\indent\ \ \ \underline{\makebox[2.8in][l]{\ }}Date\underline{\makebox[1.2in][l]{\ }}\\
\indent\indent\indent\indent\indent\indent\indent name4, Ph.D.\\
\ \\
\indent Department\\
\indent Administrator\indent\ \ \ \underline{\makebox[2.8in][l]{\ }}Date\underline{\makebox[1.2in][l]{\ }}\\
\indent\indent\indent\indent\indent\indent\indent name5, Ph.D.\\
\ \\
\indent Discipline's\\
\indent College Dean\indent\ \ \ \ \ \underline{\makebox[2.8in][l]{\ }}Date\underline{\makebox[1.2in][l]{\ }}\\
\indent\indent\indent\indent\indent\indent\indent name6, Ph.D.\\
\ \\
Final Approval and Acceptance by the College of Graduate Studies\\
\ \\
\indent\indent\indent\indent\indent\indent\ \ \underline{\makebox[2.8in][l]{\ }}Date\underline{\makebox[1.2in][l]{\ }}\\
\indent\indent\indent\indent\indent\indent\indent name7\\
\end{singlespace}
\pagebreak

%Abstract
\addcontentsline{toc}{chapter}{Abstract}
\section*{\huge{Abstract}}
\ \ \ \ \ In this thesis, I \ldots
\pagebreak

%Acknowledgements
\addcontentsline{toc}{chapter}{Acknowledgements}
\section*{\huge{Acknowledgements}}
The ...
\pagebreak

%Table of Contents
\addcontentsline{toc}{chapter}{Table of Contents}
\tableofcontents
\pagebreak

%List of Tables
\addcontentsline{toc}{chapter}{List of Tables}
\listoftables
\pagebreak

%List of Figures
\addcontentsline{toc}{chapter}{List of Figures}
\listoffigures
\pagebreak

%Chapter 1
\setcounter{page}{1}
\renewcommand{\thepage}{\arabic{page}}
\chapter{Introduction}
\ \ \ \ \ Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text. 
\end{document}
meho_r
Posts: 823
Joined: Tue Aug 07, 2007 5:28 pm

Page number location problem in thesis bibliography

Post by meho_r »

For starters, move all those commands which (re)define dimensions, headers, footers etc. into the preamble, i.e., before \begin{document}. \begin{document} should be placed somewhere before %Titlepage in your example. After that try experimenting with dimensions.
Post Reply