when section heading at top of page, top margin wrong!



Hello,
For a thesis, my university requires a top margin of 1" throughout,
with the page number appearing at the upper-right with a 3/4" margin
above. The style file below has been passed from student to student
for some time, and the original author is not around any more. This
style file achieves all of the requirements of our university, with
one exception: Whenever a section (or subsection) heading falls at
the very top of a page, there is an extra 1/8" margin at the top
(i.e., the top margin is 1 and 1/8 inch). Does anyone see why this
would happen, or suggest a change to this style file to correct this?

FYI there are two files pasted in below: thesis.sty and
unccspecs.sty. At the top of the thesis file, we do this:

\usepackage{packages/thesis}

Thanks for your help.

John

unccspecs.sty --cut--cut--cut--cut--cut--cut

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%
% This package contains formatting commands for uncc thesis
specifications. %
% It defines the following commands: %
% 1) \bodychapter - to be used to create chapters in the body
text. %
% 2) \bodysection, \bodysubsection \bodysubsubsection- create section
subsection, and %
% subsubsection in body text. %
% 3) \appendixchapter, \appendixsection, \appendixsubsection - create
appendix chapters, %
% sections, and subsections. %
% 4) \startbibliography, \finishbibliography - begin and end the
bibliography environment.%
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%


% Use this package for double spacing.
\usepackage[nodisplayskipstretch]{setspace}

% These 2 packages work together to format sectioning commands
% and format the table of contents.
% Note: to get table of contents to work correctly, you must
% run latex twice.
\usepackage[rm,md,up,tiny,center,compact]{titlesec}
\usepackage{titletoc}

% This package is for conditional statements.
\usepackage{ifthen}
\usepackage{psfrag}

% Make the top margin (from top edge of paper to top of header) be 3/4
inch. This is
% needed to set the page number (which will be inside the header).
%\setlength{\topmargin}{-0.625in} % Negative value because top margin
= \topmargin + 1 inch (orig {-0.625in})
\setlength{\topmargin}{-0.425in} % Negative value because top margin =
\topmargin + 1 inch
% (The amount .625 = .25 + .375 which accounts the
distance
% between the top of the pagenumber and the top of
the header
% region.)

% Make the left margin (from left edge of paper to left edge of body)
be 1.5 inches.
\setlength{\oddsidemargin}{.5in} % Left margin = \oddsidemargin + 1
inch

% Make the top body margin (from top edge of paper to top of body) be
1 inch.
\setlength{\headheight}{0.25in} % Header height will 1/4 inch.
%\setlength{\headheight}{0in}

%\setlength{\headsep}{0.375in} % \headsep is the distance between top
of body and bottom of header. (orig {0.375in})
\setlength{\headsep}{0.175in} % \headsep is the distance between top
of body and bottom of header.
% This is not 0 to correct for the smaller
\topmargin.

% Make the right body margin (from right edge of paper to right edge
of body) be 1 inch.
\setlength{\textwidth}{6in} % Total paper width = 8.5 inches so 6 in.
+ 1.5 in. = 7.5 in
% which leaves 1 inch for the right margin.

% Make the bottom body margin (from bottom edge of paper to bottom
edge of body) be 1 inch.
\setlength{\footskip}{0in} % No footer region needed.
\setlength{\textheight}{9in} % Total paper height = 11 inches so 9 in.
+ 1 in. = 10 in.
% which leaves 1 inch for the bottom body margin.



\doublespacing % command from setspace package to invoke double
spacing

\pagestyle{myheadings} % This makes my own style headings (with
pagenumber in upper rt. corner).

\markright{} % This will put page number in right corner without any
other text in header.
% (Footer will be blank.)



% Increase the section number depth and the toc depth (the depth of
sections which get numbered
% and put in the table of contents). This is necessary to allow the
new titleclasses to be
% numbered correctly and put in the toc.
\setcounter{secnumdepth}{5}
\setcounter{tocdepth}{5}

% Make a new titleclass called "bodychapter" which will be used for
chapters in the body text.
\titleclass{\bodychapter}[0]{top}
\newcounter{bodychapter}
\newcommand{\bodychaptertitlename}{CHAPTER}
\newcommand{\figuretitlename}{FIGURE}
\newcommand{\tabletitlename}{TABLE}

% Make a new titleclass called "bodysection" which will be used for
sections in the body text.
\titleclass{\bodysection}{straight}[\bodychapter]
\newcounter{bodysection}
\renewcommand{\thebodysection}{\arabic{bodychapter}.
\arabic{bodysection}}

% Make a new titleclass called "bodysubsection" which will be used for
subsections in the body text.
\titleclass{\bodysubsection}{straight}[\bodysection]
\newcounter{bodysubsection}
\renewcommand{\thebodysubsection}{\arabic{bodychapter}.
\arabic{bodysection}.\arabic{bodysubsection}}

% Make a new titleclass called "bodysubsubsection" which will be used
for subsections in the body text.
\titleclass{\bodysubsubsection}{straight}[\bodysubsection]
\newcounter{bodysubsubsection}
\renewcommand{\thebodysubsubsection}{\arabic{bodychapter}.
\arabic{bodysection}.\arabic{bodysubsection}.
\arabic{bodysubsubsection}}

% Make commands for appendix chapters, sections, and subsections as
aliases for chapter, section,
% and subsection. This is not necessary but makes for a uniform scheme
in which body chapters, etc.
% use \bodychapter section command and appendix chapters use
\appendixchapter section command.
\newcommand*{\appendixchapter}[1]{\chapter{#1}}
\newcommand*{\appendixsection}[1]{\section{#1}}
\newcommand*{\appendixsubsection}[1]{\subsection{#1}}



% The following commands will be used for formatting the bibliography.
\renewcommand*{\bibname}{\\REFERENCES} % Redefines the title of the
bibliography.
\newcommand{\startbibliography}{\begin{thebibliography}{999}
\addcontentsline{toc}{chapter}{\bibname}}
\newcommand{\finishbibliography}{\end{thebibliography}}

% This redefines the table of contents title.
\renewcommand*{\contentsname}{TABLE OF CONTENTS}

\renewcommand*{\listtablename}{LIST OF TABLES}
\renewcommand*{\listfigurename}{LIST OF FIGURES}



% The following 2 commands come from titlesec package.
% titleformat formats the chapter sectioning command.
% titlespacing formats the spacing for chapters (spacing above and
below chapter titles).
% Note: these commands will format the toc and reference pages because
they get displayed as
% if they were chapters by default. Appendix chapters will also use
the chapter formatting.
% For body chapters, a new titleclass is made that has its own
formatting.

\titleformat{\chapter}[block]{\normalfont\mdseries\centering}
{\MakeUppercase{\chaptertitlename} \thechapter :}
{.25em}{\normalfont\mdseries}[\thispagestyle{myheadings}]
\titlespacing{\chapter}{0pt}{-0.375in}{.1875in} % Parameter -.25in is
needed to reduce the 1.25in space from top edge
% of paper to chapter title that already
exists to make space = 1in.

% Format \section command
\titleformat{\section}[block]{\normalfont\mdseries\centering}
{\thesection}
{1.5em}{\normalfont\mdseries}
\titlespacing{\section}{0pt}{.0625in}{.0625in}

% Format \subsection command
\titleformat{\subsection}[block]{\normalfont\mdseries\centering}
{\thesubsection}
{1.5em}{\normalfont\mdseries}
\titlespacing{\subsection}{0pt}{.0625in}{.0625in}

% Format \subsubsection command
\titleformat{\subsubsection}[block]{\normalfont\mdseries\centering}
{\thesubsubsection}
{1.5em}{\normalfont\mdseries}
\titlespacing{\subsubsection}{0pt}{.0625in}{.0625in}

% This macro is used to increment the chapter counter and reset
counters associated with figures, tables,
% and equations. This is necessary because titleclass \bodychapter is
used to generate new chapters instead
% of the standard \chapter command (which would do these things
automatically). This macro will be used
% in the formatting of \bodychapter command to allow figures, tables,
and equations to be numbered correctly.
\newcommand{\setfigurecounters}{\addtocounter{chapter}{1}
\setcounter{figure}{0} \setcounter{table}{0}
\setcounter{equation}{0}}



% Format the new titleclass \bodychapter


\titleformat{\bodychapter}[block]{\normalfont\mdseries\centering}
{\bodychaptertitlename ~\thebodychapter :}
{.25em}{\normalfont\mdseries}[\thispagestyle{empty}
\setcounter{bodysection}{0} \setcounter{bodysubsection}{0}
\setcounter{bodysubsubsection}
{0}\setfigurecounters] % Calls macro \setfigurecounters in order to
get figures and tables to be numbered correctly.


\titlespacing{\bodychapter}{0pt}{0.625in}{.1875in} % Parameter .75in
is needed to increase the 1.25in space from top edge
% of paper to chapter title that already
exists to make space = 2in.



% Format \bodysection command
\titleformat{\bodysection}[block]{\normalfont\mdseries\centering}
{\thebodysection}
{1.5em}{\normalfont\mdseries}[\setcounter{bodysubsection}
{0}\setcounter{bodysubsubsection}{0}] %\setfigurecounters]
\titlespacing{\bodysection}{0pt}{.0625in}{.0625in}



% Format \bodysubsection command
\titleformat{\bodysubsection}[block]{\normalfont\mdseries\centering}
{\thebodysubsection}
{1.5em}{\normalfont\mdseries}
[\setcounter{bodysubsubsection}{0}] %\setfigurecounters]
\titlespacing{\bodysubsection}{0pt}{.0625in}{.0625in}



% Format \bodysubsubsection command
\titleformat{\bodysubsubsection}[block]{\normalfont\mdseries\centering}
{\thebodysubsubsection}
{1.5em}{\normalfont\mdseries} %[\setfigurecounters]
\titlespacing{\bodysubsubsection}{0pt}{.0625in}{.0625in}











% The following commands format the table of contents (from titletoc
package).
% Note: the toc formatting for chapter below will be used for
formatting the
% References and appendix chapters. Note: \appendixname is used in toc
title
% in order to get the correct name for appendix chapters. References
still
% comes out correctly because \addcontentsline{toc}{chapter}{\bibname}
was
% used for putting the title `REFERENCES' in the toc.


\titlecontents{chapter}[0pt]{\normalfont\mdseries}
{\MakeUppercase{\appendixname} \thecontentslabel :\hspace{.25em}}
{}{\titlerule*[1pc]{.}\contentspage}

\titlecontents{section}[4em]{}{\contentslabel{2.3em}}{}
{\titlerule*[1pc]{.}\contentspage}

% Format \subsection's toc entry.
\titlecontents{subsection}[8em]{}{\contentslabel{4em}}{}
{\titlerule*[1pc]{.}\contentspage}

% Format \subsubsection's toc entry.
\titlecontents{subsubsection}[12em]{}{\contentslabel{4em}}{}
{\titlerule*[1pc]{.}\contentspage}




% Format \bodychapter's toc entry.
\titlecontents{bodychapter}[0pt]{\normalfont\mdseries}
{\bodychaptertitlename ~\thecontentslabel :\hspace{.25em}}
{}{\titlerule*[1pc]{.}\contentspage}

% Format \bodysection's toc entry
\titlecontents{bodysection}[4em]{\singlespace}{\contentslabel{2.3em}}{}
{\titlerule*[1pc]{.}\contentspage}

% Format \bodysubsection's toc entry.
\titlecontents{bodysubsection}[8em]{\singlespace}{\contentslabel{4em}}
{}{\titlerule*[1pc]{.}\contentspage}

% Format \bodysubsubsection's toc entry.
\titlecontents{bodysubsubsection}[12em]{\singlespace}
{\contentslabel{4em}}{}{\titlerule*[1pc]{.}\contentspage}

\titlecontents{figure}[0pt]{\normalfont\mdseries}{\figuretitlename ~
\thecontentslabel :\hspace{.25em}}
{}{\titlerule*[1pc]{.}\contentspage}

\titlecontents{table}[0pt]{\normalfont\mdseries}{\tabletitlename ~
\thecontentslabel :\hspace{.25em}}
{}{\titlerule*[1pc]{.}\contentspage}


% Command to continue appendix chapter headings correctly when each
appendix chapter is contained in a
% different file. This will be used instead "\appendix" command for
all appendix chapters after the 1st.
% (Using "\appendix" causes each new appendix chapter to be labelled
as "A" which is incorrect.)
\newcommand{\continueappendixchapterheadings}
{\renewcommand{\thechapter}{\Alph{chapter}}
\renewcommand*{\chaptertitlename}{Appendix}}


% Commands to allow enumerate environment to be used with correct
spacing for uncc requirements.
\setlength{\parindent}{.17in} % Set the paragraph's indent to match
the indent of the enumerate environment.
\newcommand{\startenum}{\begin{enumerate}}
\newcommand{\finishenum}{\ifthenelse{\value{enumii} = 0} % Check if in
1st level nesting.
{\vspace{-7pt} \end{enumerate}} % 1st level nesting,
reduce vertical space by 7pt.
% before \end{enumerate}.
{\ifthenelse{\value{enumiii} = 0} % Not in 1st level,
check if in 2nd level.
{\vspace{-2pt} \end{enumerate}} % 2nd level nesting,
reduce vertical space by 2pt.
% before \end{enumerate}.
{\end{enumerate}} % Not in 2nd level nesting, no
reduction of vertical space needed
% before \end{enumerate}.
} %end Not in 1st level.
} %end \finishenum
\newcommand{\enumitem}{\ifthenelse{\value{enumii} = 0} % Check if in
1st level nesting.
{\vspace{-7pt} \item} % 1st level nesting, reduce
vertical space by 7pt. before \item.
{\ifthenelse{\value{enumiii} = 0} % Not in 1st level,
check if in 2nd level.
{\vspace{-2pt} \item} % 2nd level nesting, reduce
vertical space by 2pt. before \item.
{\item} % Not in 2nd level nesting, no reduction of
vertical space needed before \item.
} %end Not in 1st level.
} %end \enumitem


% Command to place adequate space between a figure or table and
preceding body text of the document.
\newcommand{\tablespace}{\vspace{10pt}}

% Command to place adequate space between a figure or table and its
caption.
\newcommand{\captionspace}{\vspace{-10pt}}


%Get LaTeX to Double-Space
\renewcommand{\baselinestretch}{2}








thesis.sty --cut--cut--cut--cut--cut--cut

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%
% This package contains all commands (including \usepackage commands)
that are %
% needed for the thesis document. %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%

\usepackage{packages/unccspecs} % This package contains commands that
format the document
% according to UNCC thesis manual specifications.

\usepackage[dvips]{graphicx} % This allows for creating and
manipulating graphics.

\usepackage{pstricks,pst-node,pst-tree} % This allows for tree-
creating macros
% from the pstricks graphics package.

\usepackage{pst-plot} % This allows for data plotting macros from the
pstricks
% package.


\usepackage{amsmath} % This allows more mathematical formatting
macros.
\usepackage{amsfonts} % This allows more mathematical fonts.

\usepackage{verbatim} % This allows files contents to be printed in
the latex
% document as is (without latex formatting).


% A new command to be used in the bibliography environment. It will
label each
% bibitem using a counter so that the order of bibitems can be changed
without
% renumbering bibitems.
\newcounter{bibitemcounter} % The counter to be used to label
bibitems.
\newcommand*{\bibliographyitem}[1]{\addtocounter{bibitemcounter}{1}
\bibitem[\thebibitemcounter]{#1}}

% This command shows a grid. For use when making figures in order
% to estimate x and y coordinate values.
\newpsobject{showgrid}{psgrid}
{subgriddiv=1,griddots=10,gridlabels=6pt}


% This command comes from pg. 49 of Latex Graphics Companion. For
making spanning
% braces to be placed in unusual ways.
% #1, #2 allow for moving the middle of the brace horizontally or
vertically by a number of points.
% #3 is rotation angle for large brace in degrees.
% #4 is total height of the brace in points.
\newcommand{\Bpara}[4]{%
\begin{picture}(0,0)%
\setlength{\unitlength}{1pt}%
\put(#1,#2){\rotatebox{#3}{\raisebox{0mm}[0mm][0mm]{%
\makebox[0mm]{$\left. \rule{0mm}{#4pt}\right\}$}}}}%
\end{picture}}

% This command goes with \Bpara. Its used to place text next to the
spanning brace.
% #1, #2 allow for moving the text horizontally or vertically by a
number of points.
% #3 is rotation angle for text in degrees.
% #4 is the text to be placed.
\newcommand{\Bparatext}[4]{%
\begin{picture}(0,0)%
\setlength{\unitlength}{1pt}%
\put(#1,#2){\rotatebox{#3}{\raisebox{0mm}[0mm][0mm]{%
\makebox[0mm]{$#4$}}}}%
\end{picture}}


% These counters are used to save a step number in an enumerate
environment.
\newcounter{savedstepone}
\newcounter{savedsteptwo}

.



Relevant Pages

  • Re: Where does fmtutil get its inputs?
    ... Here I first look into fmtutil.cnf to see that the 'latex' format ... uses the pdfetex engine. ... the command - thanks. ... been able to work out what texconfig does exactly, ...
    (comp.text.tex)
  • Re: Debug.exe for win32
    ... Format is: n) e address t=n ... Display the debug registers. ... R DRx command. ... The help output can be limited by specifying the first letterof the ...
    (alt.lang.asm)
  • Re: MacBook Pro with a new weird AWFUL bug
    ... is an ATSUI crash. ... command-z after every alignement command. ... You should then be able to format within whole ... publisher of the font and the date and version number of the font file). ...
    (microsoft.public.mac.office.word)
  • Re: CKD commands and PDS writing
    ... I wouldn't call Format Write the complement of Read Track. ... specific command, and Format Write is a process employed by several different ... commands in IBM's control unit reference manuals, ...
    (bit.listserv.ibm-main)
  • Re: text-formatting program c++ problem
    ... > command lines. ... > Set the left margin to n spaces ... When not operating in fill mode, ... > is said to be operating in adjust mode when operating in this manner. ...
    (comp.lang.cpp)