3

I am writing a report, where if i use the command \pagestyle{plain} the page numbering comes to the bottom, thats good.

However i also want the heading of the chapter to come on the top left hand corner, hows that possible. If i remove the \pagestyle{plain}, then the heading comes on the top left corner but the page numbering as well comes on the top right, when i want it in the bottom!

\documentclass[letterpaper,11pt,oneside,final]{book}


%-----------------------------------------------------------------------------%
% Margins:
%-----------------------------------------------------------------------------%
\setlength{\marginparwidth}{0pt} % width of margin notes
\setlength{\marginparsep}{0pt} % width of space between body text and margin notes
\setlength{\evensidemargin}{0.125in} % Adds 1/8 in. to binding side of all 
\setlength{\oddsidemargin}{0.125in} % Adds 1/8 in. to the left of all pages
\setlength{\textwidth}{6.375in} % assuming US letter paper (8.5 in. x 11 in.) and 
\raggedbottom
\setlength{\parskip}{\medskipamount}

\renewcommand{\baselinestretch}{1.1} % this is the default line space setting

\let\origdoublepage\cleardoublepage
\newcommand{\clearemptydoublepage}{%
  \clearpage{\pagestyle{empty}\origdoublepage}}
\let\cleardoublepage\clearemptydoublepage


\usepackage[pdftex,letterpaper=true,pagebackref=true]{hyperref} % with basic options
\usepackage{hypcap}


\usepackage{grffile}
\usepackage{libertine}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage{textcomp}
\usepackage{mathpazo}
\usepackage{stmaryrd}
\usepackage{rotating}
\usepackage{dsfont}


\hypersetup{pdfpagemode=UseNone}


%\fancyhf{}


\usepackage{fancyhdr}

\fancyhf{} % clear header and footer
\fancyhead[L]{\leftmark}
\fancyfoot[C]{\thepage}
\pagestyle{fancy}
\fancypagestyle{plain}{} % inherit the settings from fancy style


\begin{document}

snippet      

As any dedicated reader can clearly see, the Ideal of practical reason is a rep-
resentation of, as far as I know, the things in themselves; as I have shown else-
where, the phenomena should only be used as a canon for our understanding.
The paralogisms of practical reason are what rst give rise to the architectonic
of practical reason. As will easily be shown in the next section, reason would
thereby be made to contradict, in view of these considerations, the Ideal of prac-
tical reason, yet the manifold depends on the phenomena. Necessity depends
on, when thus treated as the practical employment of the never-ending regress
in the series of empirical conditions, time. Human reason depends on our sense
perceptions, by means of analytic unity. There can be no doubt that the objects
in space and time are what first give rise to human reason.

\section{Test 1}
As any dedicated reader can clearly see, the Ideal of practical reason is a rep-
resentation of, as far as I know, the things in themselves; as I have shown else-
where, the phenomena should only be used as a canon for our understanding.
The paralogisms of practical reason are what rst give rise to the architectonic
of practical reason. As will easily be shown in the next section, reason would
thereby be made to contradict, in view of these considerations, the Ideal of prac-
tical reason, yet the manifold depends on the phenomena. Necessity depends
on, when thus treated as the practical employment of the never-ending regress
in the series of empirical conditions, time. Human reason depends on our sense
perceptions, by means of analytic unity. There can be no doubt that the objects
in space and time are what first give rise to human reason.
\pagestyle{empty}

\bibliographystyle{alpha}


\nocite{*}
\hfill \today


\end{document}
3
  • Please add a minimal working example (MWE) that illustrates your problem.
    – lockstep
    Commented Feb 12, 2014 at 16:10
  • Please tell us what you want in the header and in the footer in first chapter pages and in all the rest. Commented Feb 12, 2014 at 19:33
  • in all the chapters i want a uniform format, as the top left being the Chapter no.xx:xxnamexx and the bottom of the page to have the page number.
    – howtotag
    Commented Feb 12, 2014 at 19:34

3 Answers 3

1

This is another way of making plain page style equal to fancy page style

You have to use \chapter so that \leftmark is defined. Also, you have used \pagestyle{empty}. Put a \clearpage (\cleardoublepage if using twoside option) before.

\documentclass[letterpaper,11pt,oneside,final]{book}


%-----------------------------------------------------------------------------%
% Margins:
%-----------------------------------------------------------------------------%
\setlength{\marginparwidth}{0pt} % width of margin notes
\setlength{\marginparsep}{0pt} % width of space between body text and margin notes
\setlength{\evensidemargin}{0.125in} % Adds 1/8 in. to binding side of all
\setlength{\oddsidemargin}{0.125in} % Adds 1/8 in. to the left of all pages
\setlength{\textwidth}{6.375in} % assuming US letter paper (8.5 in. x 11 in.) and
\raggedbottom
\setlength{\parskip}{\medskipamount}

\renewcommand{\baselinestretch}{1.1} % this is the default line space setting

%\let\origdoublepage\cleardoublepage
%\newcommand{\clearemptydoublepage}{%
%  \clearpage{\pagestyle{empty}\origdoublepage}}
%\let\cleardoublepage\clearemptydoublepage


\usepackage[pdftex,letterpaper=true,pagebackref=true]{hyperref} % with basic options
\usepackage{hypcap}


\usepackage{grffile}
\usepackage{libertine}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage{textcomp}
\usepackage{mathpazo}
\usepackage{stmaryrd}
\usepackage{rotating}
\usepackage{dsfont}


%\hypersetup{pdfpagemode=UseNone}


\usepackage{fancyhdr}

\fancyhf{} % clear header and footer
\fancyhead[L]{\leftmark}
\fancyfoot[C]{\thepage}



\makeatletter
\let\ps@plain\ps@fancy % plain style = fancy style
\makeatother

\pagestyle{fancy}

\begin{document}

\chapter{One}

As any dedicated reader can clearly see, the Ideal of practical reason is a rep-
resentation of, as far as I know, the things in themselves; as I have shown else-
where, the phenomena should only be used as a canon for our understanding.
The paralogisms of practical reason are what rst give rise to the architectonic
of practical reason. As will easily be shown in the next section, reason would
thereby be made to contradict, in view of these considerations, the Ideal of prac-
tical reason, yet the manifold depends on the phenomena. Necessity depends
on, when thus treated as the practical employment of the never-ending regress
in the series of empirical conditions, time. Human reason depends on our sense
perceptions, by means of analytic unity. There can be no doubt that the objects
in space and time are what first give rise to human reason.


\section{Test 1}
As any dedicated reader can clearly see, the Ideal of practical reason is a rep-
resentation of, as far as I know, the things in themselves; as I have shown else-
where, the phenomena should only be used as a canon for our understanding.
The paralogisms of practical reason are what rst give rise to the architectonic
of practical reason. As will easily be shown in the next section, reason would
thereby be made to contradict, in view of these considerations, the Ideal of prac-
tical reason, yet the manifold depends on the phenomena. Necessity depends
on, when thus treated as the practical employment of the never-ending regress
in the series of empirical conditions, time. Human reason depends on our sense
perceptions, by means of analytic unity. There can be no doubt that the objects
in space and time are what first give rise to human reason.

As any dedicated reader can clearly see, the Ideal of practical reason is a rep-
resentation of, as far as I know, the things in themselves; as I have shown else-
where, the phenomena should only be used as a canon for our understanding.
The paralogisms of practical reason are what rst give rise to the architectonic
of practical reason. As will easily be shown in the next section, reason would
thereby be made to contradict, in view of these considerations, the Ideal of prac-
tical reason, yet the manifold depends on the phenomena. Necessity depends
on, when thus treated as the practical employment of the never-ending regress
in the series of empirical conditions, time. Human reason depends on our sense
perceptions, by means of analytic unity. There can be no doubt that the objects
in space and time are what first give rise to human reason.

\clearpage
\pagestyle{empty}

\bibliographystyle{alpha}


\nocite{*}
\hfill \today


\end{document}

enter image description here

Slightly un-related, you may consider using geometry package for changing the page layout.

6
  • this is precisely what i want, but when i implement your code of \usepackage{fancyhdr} \fancyhf{} % clear header and footer \fancyhead[L]{\leftmark} \fancyfoot[C]{\thepage} \pagestyle{fancy} \makeatletter \let\ps@plain\ps@fancy % plain style = fancy style \makeatother I get a line across the top of the page without any page numbering in the bottom, do i need to maybe install some package?
    – howtotag
    Commented Feb 13, 2014 at 15:24
  • @howtotag Did you run the code above as such? Line at the top isn't a problem. It can be removed if you don't want.
    – user11232
    Commented Feb 13, 2014 at 15:27
  • nope, i ran ur code it works fine, i put the lines of the code whicha are relevant (in my comments) in my report, and then it doesnt appear as its required to? Could it be because im using documentclass{book}?
    – howtotag
    Commented Feb 13, 2014 at 15:29
  • @howtotag Can you post your full code to your question? Some thing is wrong in it.
    – user11232
    Commented Feb 13, 2014 at 15:30
  • added snippet to question
    – howtotag
    Commented Feb 13, 2014 at 15:49
3

If I understand correctly, you want the same behavior for all pages, including first pages of chapters.

And you want the chapter heading on the left of the header, and the page number on the center of the footer.

The following code does exactly that:

\documentclass{report}
\usepackage{fancyhdr}

\fancyhf{} % clear header and footer
\fancyhead[L]{\leftmark}
\fancyfoot[C]{\thepage}

\pagestyle{fancy}

\fancypagestyle{plain}{} % inherit the settings from fancy style

\usepackage{kantlipsum} % only for the example

\begin{document}
\chapter{Test}
\kant[1]
\section{Test}
\kant[2-7]
\end{document} 

enter image description here

3
  • this is precisely what i want, but when i implement your code of \usepackage{fancyhdr} \fancyhf{} % clear header and footer \fancyhead[L]{\leftmark} \fancyfoot[C]{\thepage} \pagestyle{fancy} \makeatletter \let\ps@plain\ps@fancy % plain style = fancy style \makeatother I get a line across the top of the page without any page numbering in the bottom, do i need to maybe install some package?
    – howtotag
    Commented Feb 13, 2014 at 15:26
  • @howtotag Probably you have something in your document that interferes with it. Try adding a Minimal (Non) Working Example in your question. Commented Feb 13, 2014 at 15:36
  • added snippet in my question
    – howtotag
    Commented Feb 13, 2014 at 15:50
1

Have you tried using the fancyhdr package? I've just implemented it to do something similar. The syntax is pretty straightforward and you can basically customise your page layout to get what you want.

The following few lines might get you close?

\documentclass[12pt, a4paper, oneside, fleqn]{report}

\headheight 28pt
\headsep 24pt

\usepackage{lmodern}       % gives bold italic font
\usepackage{lipsum}
%Sectioning and headings
%------------------------
\usepackage{fancyhdr}

 \begin{document}

\pagestyle{fancy}
\lhead{\leftmark}
\chead{}
\rhead{}
\lfoot{}
\cfoot{\thepage}
\rfoot{}

\chapter{A chapter}
\lipsum


\end{document}
6
  • i still dont get the desired output. I still get the chapter name on the top left and thepage number on the top right (which i want at the bottom). Could you just paste a snippet of the fancyhdr part that you use?
    – howtotag
    Commented Feb 12, 2014 at 16:57
  • Sorry I should have done that before, but I was in a rush. Does that get you close to what you wanted?
    – FionaSmith
    Commented Feb 12, 2014 at 17:16
  • You should have \lhead{\sffamily\leftmark}; better yet, \fancyhead[L]{\sffamily\leftmark}. Leave off \sffamily from \chaptermark. By the way, it is not a command with arguments.
    – egreg
    Commented Feb 12, 2014 at 17:28
  • nope, i still didnt get it. I get a line on the top of my page with no page numbers in any of the pages at all! What do you think is the problem? Before you snippet i also used \usepackage{fancyhdr}
    – howtotag
    Commented Feb 12, 2014 at 17:49
  • @egreg I copied that syntax (with the argument) direct from the 'fancyhdr' documentation, so if the syntax is wrong I guess the documentation is wrong! Anyway, it works! Thanks for the tip about moving the \sffamily.
    – FionaSmith
    Commented Feb 14, 2014 at 11:48

You must log in to answer this question.

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