1

I am writing my research proposal using a custom thesis.sty(actual file name is different) file provided by my university. The section headers generated using this style file break at the end of the page. So there are orphan section headers at the page end. In one instance there is a page break within the section header itself, in this case the section header was longer than one line. Here is a snippet of the thesis.sty file that defines custom section and subsections:

%==============================================================
% BEGIN Section and subsection Customization 
%==============================================================

%\def\section#1{\ifnum\chaptertest>1 \vskip 0.25in \else \vskip 0.01in \fi
 \def\section#1{\ifnum\chaptertest>1 \vskip 0.25in \else \vskip 0.25in \fi
    \ifnum \c@secnumdepth >\m@ne
    \refstepcounter{section}
    \addcontentsline{toc}{section}{\protect
        \numberline{\thesection.}#1}\else
    \addcontentsline{toc}{section}{#1}\fi
    \sectionmark{#1}
    \noindent %T
    %T \centerline{$\underline{\hbox{\thesection.} _{\ } \ \hbox{#1}}$}
    \Null {\bf \thesection. \ #1}%T Removed preceeding space before bf which makes headers misaligned TCM
    \vskip -0.23in %% Ju
    \indent
}

%\def\sectiondl#1#2{\ifnum\chaptertest>1 \vskip 0.25in \else \vskip 0.01in \fi
 \def\sectiondl#1#2{\ifnum\chaptertest>1 \vskip 0.25in \else \vskip 0.25in \fi
                \ifnum \c@secnumdepth >\m@ne
 \refstepcounter{section}
 \addcontentsline{toc}{section}{\protect
 \numberline{\thesection.}#1 #2}\else
 \addcontentsline{toc}{section}{#1 #2}\fi
 \sectionmark{#1 #2}

 \centerline{$\underline{\hbox{\thesection.} _{\ } \ \hbox{#1}}$}
 \centerline{$\underline{\hbox{\thesection.} _{\ } \ \hbox{#1}}$}
 \centerline{$\underline{_{\ } \hbox{#2}}$}
 \vskip -0.09in %% Ju
 \indent
 }

 \def\subsection#1{\vskip 0.25in \ifnum \c@secnumdepth >\m@ne
 \refstepcounter{subsection}
 \addcontentsline{toc}{subsection}{\protect
 \numberline{\thesubsection.}#1}\else
 \addcontentsline{toc}{subsection}{#1}\fi
 \subsectionmark{#1}
%T \centerline{\thesubsection. \ #1}
 \noindent %T
 \Null \thesubsection. \ #1
  \vskip -0.27in  %% Ju: space betw. name to the fisrt line
 \indent

 }

 \def\subsectiondl#1#2{\vskip 0.25in \ifnum \c@secnumdepth >\m@ne
 \refstepcounter{subsection}
 \addcontentsline{toc}{subsection}{\protect
 \numberline{\thesubsection.}#1 #2}\else
 \addcontentsline{toc}{subsection}{#1 #2}\fi
 \subsectionmark{#1}


 }

 \def\subsubsection#1{\vskip 0.25in \ifnum \c@secnumdepth >\m@ne
 \refstepcounter{subsubsection}
 \addcontentsline{toc}{subsubsection}{\protect
 \numberline{\thesubsubsection.}#1}\else
 \addcontentsline{toc}{subsubsection}{#1}\fi
 \subsubsectionmark{#1}
 \noindent
 %\centerline{\thesubsubsection. \ #1}  %% title is on the middle originally
 %T\Null \thesubsubsection. \ #1  %% Ju move it to the left ( standard requirement)
 \Null {\em \thesubsubsection. \ #1 } %% Ju move it to the left ( standard requirement) % Removed preceeding space before em which makes headers misaligned TCM
                                %T \Null added to show first numeral
 \vskip -0.27in
 \indent

 }

 \def\subsubsectiondl#1#2{\vskip 0.25in \ifnum \c@secnumdepth >\m@ne
 \refstepcounter{subsubsection}
 \addcontentsline{toc}{subsubsection}{\protect
 \numberline{\thesubsubsection.}#1 #2}\else
 \addcontentsline{toc}{subsubsection}{#1 #2}\fi
 \subsubsectionmark{#1 #2}
 \noindent
 \centerline{\em \thesubsubsection. \ #1} \vskip -0.08in
 \centerline{\em #2}
 \vskip -0.27in
 \indent
 }

%==============================================================
% END Section and subsection Customization 
%==============================================================

This is how the sections headers should look using the thesis.sty format that I have to use:

Section headers generated using the custom thesis.sty format

I am also providing this additional bit of detail just in case if it gives any clues to solve this problem. Quite weirdly, the way this thesis.sty is designed, we are supposed to add one blank line after the section label else it causes problems with the spacing between the header and the following paragraph.

\section{section header}
<leave a blank line>
Start Paragraph from here. 

However, it does not bother me that I have to add a blank line after section labels. Its a minor inconvenience that I will look into later. For now I really don't know to fix those orphan section headers. I looked at a lot of threads on here regarding the same problem but none of those solutions work for me. Please let me know if I need to provide any additional information to help troubleshoot this. Thanks a lot !

closed as too broad by cfr, Zarko, Mico, ebosi, Stefan Pinnow May 10 '17 at 0:23

Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • 4
    Welcome! If you really have to use thesis.sty, then presumably you are stuck with the style. If you just mean you are using it because it is supposed to make life easier, don't use it. It won't make life easier. If that excerpt is straight for the .sty and really hasn't been messed up in your reproducing it here, don't walk away. Run. – cfr May 7 '17 at 3:02
  • 2
    LaTeX has an interface that is used for all internal section like commands. Commands defined by that interface prohibit orphans. Your style file just gives a **** and redefines those commands without taking care of prohibiting orphans. – Johannes_B May 7 '17 at 7:33
  • 1
    the code isn't really fixable just from that fragment, it is almost all wrong, it does not use any of the mechanisms latex has for section headings, it omits % from lots of lines so will add spurious white space in many instances, it fails as you note, to correctly handle paragraph breaking, the combination of negative vskip and \indent means that you must never leave a blank line after the heading, if you do then not only is the spacing poor you will always have a spurious paragraph with no text after the heading. – David Carlisle May 7 '17 at 8:03
  • 2
    Easiest would be, honestly, not to use the package. Have a ook at writing a scientific report with LaTeX. – Johannes_B May 8 '17 at 4:36
  • 2
    To be a bit frank, blunt and rude: The complete code posted is just rubbish. There is no reason for anybody, not a helper, nor you, to get hands on trying to make the code better. Current LaTeX is stable for almost 25 years now, the internals work fine. Why build pure strangeness on top? – Johannes_B May 8 '17 at 5:38

Browse other questions tagged or ask your own question.