We must give more structure to the right mark emitted by the \chapter
command; so we do
\renewcommand{\chaptermark}[1]{%
\markboth{\chaptername\ \thechapter}
{\noexpand\firstsubsectiontitle}}
The \subsectiontitle
macro will be defined by the \subsection
command; of course it won't work if no subsection starts in the first page:
\renewcommand{\subsectionmark}[1]{%
\markright{#1}\gdef\firstsubsectiontitle{#1}}
Here's an example; notice some changes I've made to your code. For instance I've redefined the \sectionmark
command so it doesn't emit any mark.
The solution to the numbering problem of subsection is to \setcounter{secnumdepth}{1}
.
\documentclass{report}
% PACKAGES
\usepackage{fancyhdr}
\usepackage{lastpage} % Allows referencing of the last page to allow footer to read: "Page [Current page] of [Total number of pages]."
\usepackage{comment} % Allows comments of the type: \begin{comment}This text is commented out.\end{comment}
%\usepackage[colorlinks=true]{hyperref} % Turns table of contents and labels into clickable links. Commented out to speed up compiling.
\usepackage[T1]{fontenc} % Allows use of ">" symbol.
\usepackage{lmodern} %Not really sure what this is for.
% FORMATTING
% Header and Footer
\pagestyle{fancy}
% Allows calling chapter and section names in headers and footers.
\renewcommand{\chaptermark}[1]{%
\markboth{\chaptername\ \thechapter}
{\noexpand\firstsubsectiontitle}}
\renewcommand{\sectionmark}[1]{}
\renewcommand{\subsectionmark}[1]{%
\markright{#1}\gdef\firstsubsectiontitle{#1}}
\newcommand\firstsubsectiontitle{}
% General Header and Footer
\fancyhf{}
\fancyhead[L]{\DocumentAuthor}
\fancyhead[R]{\BookAuthor>\leftmark>\rightmark}
\fancyfoot[C]{Page \thepage\ of \pageref{LastPage}}
% Chapter Header and Footer
\fancypagestyle{plain}{%
\fancyhf{} \fancyhead[L]{\DocumentAuthor}%
\fancyhead[R]{\BookAuthor>\leftmark>\rightmark}%
\fancyfoot[C]{Page \thepage\ of \pageref{LastPage}}%
}
% Header/Footer Separation-line Width
\renewcommand\headrulewidth{0.4pt}
\renewcommand\footrulewidth{0.4pt}
\setlength\parindent{0pt} % Remove paragraph indentation.
% NAME AND CLASS SECTION
\newcommand{\DocumentAuthor}{Author Name}
\newcommand{\BookAuthor}{Book Author}
\setcounter{secnumdepth}{1}
%DOCUMENT
\begin{document}
\tableofcontents
\thispagestyle{empty}
\chapter{Title of Chapter 1}
\section{Sample Problems}
\subsection{Title of Subsection 1}
\pagebreak{}
\subsection{Title of Subsection 2}
\subsection{Title of Subsection 3}
\pagebreak{}
\subsection{Title of Subsection 4}
\end{document}
With this code the first subsection in the page will be put in the header.
What's \noexpand\firstsubsectiontitle
doing? The \markboth
and \markright
commands must record the current values of the counters and titles, so their arguments are passed through an \edef
; this, in the case of the first chapter and English language, would set a left mark with value Chapter\ 1
. If we said only \firstsubsectiontitle
in the second argument, it would be expanded leaving a wrong right mark because it would be empty for the first chapter and would contain the last subsection in the preceding chapter!
So we say "dear TeX, don't expand \firstsubsectiontitle
right now, but only when you'll set the header."
Actually, if there can be more than one subsection in the chapter pages, a different solution should be used:
% Allows calling chapter and section names in headers and footers.
\renewcommand{\chaptermark}[1]{%
\markboth{\chaptername\ \thechapter}
{\noexpand\firstsubsectiontitle}%
\global\firstsubsectionmarktrue}
\renewcommand{\sectionmark}[1]{}
\renewcommand{\subsectionmark}[1]{%
\markright{#1}%
\iffirstsubsectionmark
\gdef\firstsubsectiontitle{#1}%
\fi
\global\firstsubsectionmarkfalse}
\newif\iffirstsubsectionmark
\def\firstsubsectiontitle{}
so that the first subsection would set the mark.
When I compiled a little test file with your class, it was very close to what you wanted it to be. As far as I can see, there isn't enough space between the chapter heading and the body and the top of the page. For both problems you can define the \@makechapterhead
(in utcthesis.cls) as:
\renewcommand{\@makechapterhead}[1]{%
\vspace*{1in}%
\begin{center}
CHAPTER \thechapter
\mbox{} \\
\uppercase{#1}
\mbox{} \\[2\baselineskip]
\end{center}
}
It will now add space above and below. With this solution, you have to adjust the actual needed space for the \vspace
in line 2. It depends on the page spread of your document. While the class is doing this for you, the given solution will work as far as you are using THIS class. In this case: 1in (to obtain a total of 2in from the upper border to the chapter title).
A Simple Test:
\documentclass{utcthesis}
\usepackage{lipsum}
\begin{document}
\chapter{Test}\lipsum
\end{document}
(This is, by the way, a minimal example. None of the packages loaded in your sample preamble will effect the sectioning headings.)
Best Answer
With the KOMA classes you could define a chapter preamble with the command
\setchapterpreamble
. Using a BibTeX style that has full citation support, e.g. biblatex, you could do the following:You could put anything inside the
\setchapterpreamble
command, not only a quote environment, but also plain text. You could e.g. also use KOMA’s\dictum
command: