[texhax] Problem configuring headers
Jerry
jerry at seibercom.net
Fri Jun 14 18:33:58 CEST 2013
I admit that I am not quite sure what I am doing. I spend a lot of time
creating legal documents using Word. Word has a nice legal template. I
am trying to use LaTEX but it isn't easy. It is too bad that LaTEX
doesn't have a native "legal" document class.
Anyway, what I am trying to do is get the Chapter name, actually the
"Article" name and the article number and title in the left side
heading. I can get the article's number but not its title.
Second, and I am not sure if this is possible, in the right side
header, I want the section name & number, plus the subsection name and
number ONLY if there is one. The way I have it configured now, I get
the section repeated twice if there is no subsection. The subsection
number should be printed on a line below the section number, which surprisingly is actually working..
I would really appreciate it if someone can tell me where I can find
out how to accomplish this. I need to have this approximately 50 page
report completed by this Tuesday.
\documentclass[10pt,letterpaper,final,oneside,openany,onecolumn,titlepage]{report}
\usepackage[parfill]{parskip}
\usepackage[T1]{fontenc}
\usepackage{ucs}
\usepackage[utf8x]{inputenc}
\usepackage[width=8.50in, height=11.00in, left=1.00in, right=1.00in, top=1.00in, bottom=1.00in]{geometry}
\usepackage{mathptmx}
\usepackage{calc}
\usepackage{fancyhdr}
\usepackage{lastpage}
\usepackage{titlesec}
\usepackage{varioref}
\usepackage{tocstyle}
% change chapter to article and center it
\renewcommand{\chaptername}{Article}
\renewcommand{\thechapter}{\Roman{chapter}}
\titleformat{\chapter}[display]{\LARGE\bfseries\centering}{\chaptertitlename\
\thechapter}{-0.125in}{\Large}
% Swap plain for fancy when using "chapter" since chapter sets the document style to plain
\makeatletter
\let\ps at plain\ps at fancy % :\Let plain be exactly the same as fancy
\makeatother
%Format section numbering
\def\thesection{\arabic{section}.}
\def\thesubsection{\arabic{section}.\alph{subsection}}
\def\thesubsubsection{\arabic{section}.\alph{subsection}.\roman{subsubsection}}
\setcounter{secnumdepth}{4} % Number subsubsections
\setcounter{tocdepth}{4} % Add subsubsection to TOC
% Change chapter vertical spacing
\makeatletter
\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
\global\@afterindenttrue
\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}}}
\makeatother
%Attempt to control dangling paragraphs
\widowpenalty=10000
\author{Me}
\title{Code of Ordinances}
\begin{document}
% Switch to the Times New Roman Font
\usefont{T1}{ptm}{m}{n}
% Create the title page.
\begin{titlepage}
\begin{center}
\includegraphics[scale=0.75]{../img/Stem_Logo_1200x1200} \\[72pt]
{\Huge The Charter \\
and \\
General Ordinances of the \\
Town \textsuperscript{of} Stem \\
\vfill
\includegraphics[width=0.2\linewidth]{../img/Town_of_Stem_Sign}
\vfill
{\large June 17, 2013} \\ }
\end{center}
\end{titlepage}
\clearpage
\fancyhf{}
\thispagestyle{fancy}
\pagestyle{fancy}
\pagenumbering{Roman}
\fancyfoot[r]{{\footnotesize \textbf{Contents:\ \thepage}}}
\fancyfoot[l]{{\footnotesize \textbf{06-17-2013}}}
\fancyfoot[c]{\textbf{{\footnotesize Charter and General Ordinances of Stem}}}
\tableofcontents
\clearpage
\pagestyle{fancy}
\fancyhf{} % Will clear the headers if uncommented
\pagenumbering{arabic}
\renewcommand{\footrulewidth}{2.0pt}
\renewcommand{\headrulewidth}{2.0pt}
\addtolength{\headheight}{\baselineskip}
\renewcommand{\sectionmark}[1]{\markboth{#1}{}}
\renewcommand{\subsectionmark}[1]{\markright{#1}}
\fancyhead[L]{{\footnotesize \chaptername~\thechapter \chaptermark{} }}
\fancyhead[R]{{\footnotesize Section: \thesection \\ Subsection: \thesubsection}}
\fancyfoot[r]{{\footnotesize \textbf{Page \thepage\ of \pageref{LastPage}}}}
\fancyfoot[c]{{\footnotesize \textbf{Charter and General Ordinances of Stem}}}
\fancyfoot[l]{{\footnotesize \textbf{June 17, 2013}}}
\thispagestyle{fancy}
\pagestyle{fancy}
\setcounter{section}{0} % Set the section counter at 0
\setcounter{page}{1} % Set the page number to 1
\labelformat{section}{section~#1} % used for \vref
\labelformat{chapter}{article~#1} % used for \vref
\labelformat{subsection}{subsection~#1}
\labelformat{subsubsection}{subsubsection~#1}
\labelformat{enumi}{item~#1} % used for \vref
\labelformat{enumii}{item~#1} % Used for \vref
\labelformat{enumiii}{item~#1}
\labelformat{enumiiii}{item-#1}
\chapter{The Town \textsuperscript{of} Stem}
\section{Introduction}
\chapter{Act to Incorporate the Town of Stem}
\section{Incorporation}
\section{Corporate Limits}
\section{Officers}
\chapter {Mayor and Board of Commissioners}
\section {Composition of Board of Commissioners.}
\subsection {Organization of Board; Oaths of Office.}
\subsection {Compensation of Mayor, Councilmen and Town Employees.}
\subsubsection{Travel Reimbursement}
\chapter {Administrative Offices}
\section {Mayor}
%% The rest of the document is truncated
\end{document}
--
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