0

My problem is that page breaks and horizontal lines are inserted after sections, some chapters and the TOC. I have included all the code since I have no clue about which part of it is causing the problem or why.

\documentclass[letterpaper]{book}
\usepackage[spanish]{babel}
\usepackage[utf8]{inputenc}
\usepackage{fancyhdr}
\usepackage{helvet}
\usepackage{wrapfig}
\usepackage[letterpaper, top=4cm, bottom=2.5cm, left=4cm, right=2.5cm]{geometry}
\usepackage{setspace}
\doublespacing
\usepackage[pdftex]{graphicx}
\renewcommand{\familydefault}{\sfdefault}
\pagestyle{fancyplain}
\fancyhf{}
\fancyfoot[R]{\thepage}
\rfoot{\thepage}
\addto\captionsspanish{\renewcommand*\contentsname{TABLA DE CONTENIDOS}}
\newcommand{\HRule}{\rule{\linewidth}{0.5mm}}

\begin{document}
\frontmatter
%\input{./title.tex}
\tableofcontents
\mainmatter
\section*{MySection}
\addcontentsline{toc}{subsection}{Preface}
\chapter{Introduction}
\section{MySection}
\section{MySection}
\section{MySection}
\subsection{subsect}
Lorem  ipsum  dolor  sit  amet,  consectetuer  adipiscing  
elit.   Etiam  lobortisfacilisis sem.  Nullam nec mi et 
neque pharetra sollicitudin.  Praesent imperdietmi nec ante. 
Donec ullamcorper, felis non sodales
\chapter{Chapter2}
\appendix
\chapter{Reproducible Research}
\end{document}

Here is a live document.

2

The lines are to separate the headers of your pages and the text. You can disable them by setting its width to 0:

\renewcommand{\headrulewidth}{0pt}

It gets set by the fancyhdr package. They are by default disabled on "special" pages, like the first page of the TOC or of chapters, which use a different format.

The empty pages are inserted because every chapter should start as a right page. If you want to disable this (which you really shouldn't), use the openany option:

\documentclass[letterpaper,openany]{book}

You shouldn't put section without a chapter, because that doesn't make sense (your first section*).

  • Thanks! This solves the problem with horizontal lines, but the page breaks are still there. – Federico Feb 17 '15 at 22:05
  • I've already added that, but please consider if you really want to remove them. – Juri Robl Feb 17 '15 at 22:06

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.