0

I want to have only the chapter heading showing on top of each page without the the section headings. Below is a MWE. How do I modify it to get rid of the section heading appearing so as to avoid the overlap of chapter and section headings on top of each page?

\documentclass[a4paper,12pt,oneside]{book}
\usepackage[top=1.0in, bottom=1.0in, left=1.0in,right=1.0in,bindingoffset=2.3cm]{geometry}
\usepackage[lenny]{fncychap}
\usepackage{fancyhdr}
%\fancyhf{}
\cfoot{\thepage}
\pagestyle{fancy}
\usepackage{lipsum} 
\begin{document}
 \chapter{Some Chapter Some Chapter Some Chapter Some Chapter Some Chapter}
 \lipsum[1-1]
 \section{Some Sections Some section1}
 \lipsum[2-3]
 \section{Some Sections Some section2}
 \lipsum[1-16]
 \chapter{Some Chapter Some Chapter Some Chapter Some Chapter Some Chapter1 }
  \section{Some Sections Some section5}
  \lipsum[4-5]
  \section{Some Sections Some section6}
  \lipsum[6-7]
  \chapter{Some Chapter Some Chapter Some Chapter Some Chapter Some      Chapter45}
   \section{Some Sections Some section6}
   \lipsum[4-5]

  \section{Some Sections Some section7}
   \lipsum[10-11]
   \end{document}

1 Answer 1

1

It can be done using the commands \rhead and \lhead. The code for box around the header is took from this answer.

\documentclass[a4paper,12pt,oneside]{book}
\usepackage[top=1.0in, bottom=1.0in, left=1.0in,right=1.0in,bindingoffset=2.3cm]{geometry}
\usepackage[lenny]{fncychap}
\usepackage{fancyhdr}

\cfoot{\thepage}
\pagestyle{fancy}
\usepackage{lipsum} 

\renewcommand{\headrulewidth}{0pt} %remove header rule
\rhead{\flushleft\leftmark}
\rhead{\noindent\fbox{\parbox{\dimexpr\linewidth-2\fboxsep-\fboxrule\relax}{\leftmark}}} %make box on th header
\setlength{\headsep}{1cm} %add some additional space between header and text
\lhead{}

\begin{document}
 \chapter{Some Chapter Some Chapter Some Chapter Some Chapter Some Chapter}
 \lipsum[1-1]
 \section{Some Sections Some section1}
 \lipsum[2-3]
 \section{Some Sections Some section2}
 \lipsum[1-16]
 \chapter{Some Chapter Some Chapter Some Chapter Some Chapter Some Chapter1 }
 \section{Some Sections Some section5}
 \lipsum[4-5]
 \section{Some Sections Some section6}
 \lipsum[6-7]
 \chapter{Some Chapter Some Chapter Some Chapter Some Chapter Some      Chapter45}
 \section{Some Sections Some section6}
 \lipsum[4-5]

 \section{Some Sections Some section7}
 \lipsum[10-11]
 \end{document}
7
  • good it works. However, instead of the \fancyplain, is there any other command to get the fance boxes around the chapter headings? Thank you
    – richard
    Jul 11, 2016 at 15:37
  • You should add that part to your question by editing it, the part about the box. \fancyplain has nothing to do with the box, what do you want exactly is a box on the header?
    – Cfun
    Jul 11, 2016 at 15:45
  • @richard please check if my update answers your needs.
    – Cfun
    Jul 11, 2016 at 16:05
  • sorry for my trouble. I meant the boxes on the chapter headings itself. The earlier one is fine except for the plain chapter headings in the text itself
    – richard
    Jul 11, 2016 at 16:15
  • I responded above
    – richard
    Jul 11, 2016 at 16:26

You must log in to answer this question.

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