2

I get a very odd chapter heading in the middle of my abbreviation chapter in my thesis. I simply cannot figure out why and have tried with \clearpage and other tricks, but none worked.

The "empty" chapter appearing in contents

Chapter heading in section

My full main.tex file and abbreviation file can be seen here: Main.tex file

Abbrevations file

Minimal example. Main.tex file: \documentclass[10pt, a4paper, twoside, english]{report} \input{include/packagescommands} \input{include/settings}

\begin{document}
\setlength{\parskip}{0pt} %spacing between paragraphs
\setcounter{tocdepth}{1}
\tableofcontents
\input{include/abbreviations}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%% CHAPTER 1 INTRODUCTION %%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newpage \setdefaulthdr \pagenumbering{arabic} \setcounter{page}{1}
\input{include/dummy}%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\end{document}

Abbrevation.tex file:

\chapter*{Abbreviations}
\addcontentsline{toc}{chapter}{\textit{Abbreviations}}

\vspace{-\baselineskip}
\bgroup
\def\arraystretch{0.8}

\begin{center}{
\begin{tabular}{l c l}
A, C, G, T, U&&adenine, cytosine, guanine, thymine, uracil\\
AFM&&atomic force microscopy\\
AGE&&agarose gel electrophoresis\\
...
\end{tabular}
\newpage
\begin{tabular}{l c l}
MASP(s)&&MBL-associated serine protease(s)\\
MBL&&mannan-binding lectin (also known as mannose-binding lectin)\\
...
\end{tabular}}
\end{center}

Dummy.tex file

\chapter[Dummy chapter]{\uppercase{Dummy chapter}}\label{ch:dummy}
 dummy text\cite{okholm_quantification_2014}
\section{dummy}
\subsection{dummy}

My packages and settings can be seen here Packages

Settings file

The relevant parts are extracted below, however, other parts could be relevant this is just my gut feeling.

Packagecommands.tex

\usepackage{fancyhdr}
\usepackage{fncychap}
\usepackage{array}
\usepackage{sectsty}

Settings.tex

%titlespaceing
\titlespacing*{\chapter}{0pt}{-50pt}{30pt} % this alters "before" spacing (the second length argument) to 0
\titlespacing*{\section}{0pt}{10pt}{0pt}
\titlespacing*{\subsection}{0pt}{10pt}{0pt}
\titlespacing*{\subsubsection}{0pt}{10pt}{0pt}

% Fancyheader (see packagescommands.tex for default/special)
\pagestyle{fancy}

 \newcommand*\HUGE{\Huge}
 \newcommand*\chapnamefont{\normalfont\LARGE\MakeUppercase}
 \newcommand*\chapnumfont{\normalfont}
 \newcommand*\chaptitlefont{\normalfont\HUGE\bfseries}

 \newlength\beforechapskip
 \newlength\midchapskip
 \setlength\midchapskip{\paperwidth}
 \addtolength\midchapskip{-\textwidth}
 \addtolength\midchapskip{-\oddsidemargin}
 \addtolength\midchapskip{-1in}
 \setlength\beforechapskip{18mm}

\titleformat{\chapter}[display]
{\normalfont\filleft}
{{\chapnamefont\chaptertitlename}%
 \makebox[0pt][l]{\hspace{.8em}%
   \resizebox{!}{\beforechapskip}{\chapnumfont\thechapter}%
   \hspace{.8em}%
   \rule{\midchapskip}{\beforechapskip}%
 }%
}%
{25pt}
{\chaptitlefont}
\titlespacing*{\chapter}
  {0pt}{40pt}{40pt}

% Title font
\titleformat*{\section}{\large\bfseries}
\titleformat*{\subsection}{\large\bfseries}
\titleformat*{\subsubsection}{\normalsize\bfseries}
\titleformat*{\paragraph}{\normalsize\bfseries}
\titleformat*{\subparagraph}{\normalsize\bfseries}

Any help with be highly appreciated. Thank you

  • 2
    Please don't make your question dependent on external file hosters. Just make a small MWE that demonstrates your problem. – user36296 Aug 15 '16 at 14:11
  • Hi sam, thank you for your comment. The only issue is I really don't know where the issue stems from. I will try adding som extra line of code. – J. Doe Aug 15 '16 at 14:27
4

Near the beginning of your document you execute the command \setspecialhdr, which is defined in include/settings.tex as follows:

    \newcommand{\setspecialhdr}{%
    \fancyhead[RE, LO]{\slshape \chapter}%
    \fancyhead[RO, LE]\thepage{}%
    \fancyfoot[C]{}%
}

The command \chapter in the second line is responsible that on every second page a new chapter is opened, as part of your fancy heading. What was your intention of putting \chapter there? By the way, it looks like the commands before this definition actually should go into the definition (at least when comparing it to the other header definitions in this file).

As a side note, your abbreviations file contains a \bgroup, but no closing \egroup.

  • Hi Gernot thank you, I wanted it to read "Chapter 2" in the header. – J. Doe Aug 15 '16 at 15:59
  • Thank you Gernot, it was the \chapter in the fancyhead which messed up the layout. – J. Doe Aug 15 '16 at 16:02
  • 2
    Just a suggestion: Next time you mess around with the definitions, check immediately the consequences. If you get unexpected results, it is reasonable to assume that the problem was introduced with the most recent changes. – gernot says Reinstate Monica Aug 15 '16 at 16:05
  • 1
    To get the chapter number into the heading, replace the faulty \chapter by \chaptername~\arabic{chapter}. – gernot says Reinstate Monica Aug 15 '16 at 16:13
  • 1
    It seems you are reinventing the wheel. I suggest to start all over regarding the design of the document layout. Remove all packages manipulating the layout, like fancyhdr, geometry etc. Start with the document class book, scrbook or a similar one for books and structure your document with the commands \frontmatter, \mainmatter and \backmatter. See e.g. this thread. The roman numerals, chapter title in the heading etc will already be ok. – gernot says Reinstate Monica Aug 15 '16 at 18:39
3

I cannot reproduce your issue. Please make sure your MWE exposes the problem. (And the MWE does not require any editing and is actually minimal! Just try downloading your MWE yourself and compile in a clean directory before asking, please.)

I would suggest that you also scan any aux, toc, lot, … files and see if there is any \chapter command. Then you can look for a command/package that writes to this auxiliary file.

(Addendum: as the problem has been found by gernot, the first thing to search for would of course be any \chapter commands in your tex files.)

Also, have a look at the pdflatex output. It shows you which file generates the chapter:

(foo.tex (baz.tex)
chapter 1.
[2] [3] 
) (bar.tex [4] …)

Here, foo.tex generates chapter 1, and also writes pages 2 and 3. At the end of page 4, bar.tex was being typeset (but foo.tex might be responsible for the first part of page 4).

(I have not enough reputation to post this as a comment, so please bear with me.)

  • Hi Martin, thank you for your comment. Oddly I cannot find chapter 1 in the main console output. My output looks like this: – J. Doe Aug 15 '16 at 14:52
  • LaTeX Font Warning: Font shape TS1/aer/m/n' undefined (Font) using TS1/cmr/m/n' instead (Font) for symbol textregistered' on input line 38. [2]) Chapter 1. Package hyperref Warning: Token not allowed in a PDF string (PDFDocEncoding): (hyperref) removing \unhcopy' on input line 61. Package hyperref Warning: Token not allowed in a PDF string (PDFDocEncoding): (hyperref) removing `\strutbox' on input line 61. – J. Doe Aug 15 '16 at 14:57
  • Package Fancyhdr Warning: \headheight is too small (25.79993pt): Make it at least 199.83449pt. We now make it that large for the rest of the document. This may cause the page layout to be inconsistent, however. [3] (./include/dummy.tex Chapter 2. – J. Doe Aug 15 '16 at 14:57
  • Can be found here: pastebin.com/4DgtDDxB And here in full: pastebin.com/PFLZWt8d – J. Doe Aug 15 '16 at 14:58
  • The log file is not accessible. Is it intended that the page number "iv" is in the left margin in your screen shot? Also, the chapter is somehow overwritten over the text. Try to simply remove the \newpage and center environment. Try longtable instead. – Martin Nyolt Aug 15 '16 at 15:05

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.