[texhax] Insert chapter and section heading into document header

Jerry jerry at seibercom.net
Sat Dec 15 19:30:04 CET 2012

I am still very new to Latex. I am in the process of creating a
document that requires that the "Chapter" + "Section" + "subsection" if
applicable be included in the document header. This is a large one
sided report.

I have used the "fancyhdr" package to create the footers I required,
but I just cannot get the headers correct.

I used the following to control the vertical spacing or the Chapter

% Change chapter vertical spacing
\def\ttl at mkchap@i#1#2#3#4#5#6#7{%
    \ttl at assign\@tempskipa#3\relax\beforetitleunit
    \vspace{\@tempskipa}%<<<<<< REMOVE THE * AFTER \vspace
    \ifcase#5 \global\@afterindentfalse\fi
    \ttl at assign\@tempskipb#4\relax\aftertitleunit
    \ttl at topmode{\@tempskipb}{%
        \ttl at select{#6}{#1}{#2}{#7}}%
    \ttl at finmarks  % Outside the box!
    \@ifundefined{ttlp@#6}{}{\ttlp at write{#6}}}

I then modified the numbering for my needs.

%Format section numbering

I changed chapter" to "article" which was required since it is a legal

% change chapter to article and center it
\titleformat{\chapter}[display]{\LARGE\bfseries\centering}{\chaptertitlename\ \thechapter}{-0.125in}{\Large}

I then made sure "fancy" was the default style

% Swap plain for fancy when using "chapter" since chapter set the document style to plain
\let\ps at plain\ps at fancy % :\Let plain be exactly the same as fancy


% Create Table of Contents
\fancyfoot[r]{{\footnotesize \textbf{Contents:\ \thepage}}}
\fancyfoot[l]{{\footnotesize \textbf{\date{01-08-2013}}}}
\fancyfoot[r]{{\footnotesize \textbf{Page \thepage\ of \pageref{LastPage}}}}
\fancyfoot[l]{{\footnotesize \textbf{\date{01-08-2013}}}}

%I am attempting to use this to get the headers correct/=
\fancyhead{r}{\chaptertitlename\ \thechapter\ \thesection \thesubsection}

The problem is that it does not stay in sync with the document. In fact
the first page has:

"Article II 1.1.C" when it should be "Article I 1"

I would really appreciate any assistance that someone might be able to
afford me.

Jerry ♔

Disclaimer: off-list followups get on-list replies or get ignored.
Please do not ignore the Reply-To header.

More information about the texhax mailing list