I am writing a class file for a template with very specific requirements. One of those requirements is that a section title must be bolded, centered, and be written in single-spacing with a single-spaced blank line before and after the section label. The rest of the document must be double spaced.

The problem I am having is that for some reason the \singlespace command in the setspace package seems to generate a weird amount of extra space at the top of the section command... but only when using the \centercommand in the titlesec format. Moreover, I can't seem to get subsection numbers included in the subsection label (in the actual text) whenever the label is not \center aligned... although the Table of Contents seems to have them.

To be clear, the \section should be centered and bolded, whereas the \subsection and \subsubsection should be left aligned and bolded. All the section and subsection types should be singlespaced with a single space white blank line before and after the label, and the rest of the document needs to be double spaced.

Here is my MWE in which I think I can get everything except the subsection and subsubsection numbers in the labels themselves... but I have no earthly idea what I'm missing to make those numbers appear. It appears to have to do with using some type of left alignment instead of center alignment, but I haven't a clue as to why?

    margin=1in,% All 4 margins need to be one inch.
    paperheight=11in,% we want 11in tall...
    paperwidth=8.5in% and 8.5in wide paper.

\newcommand{\realSingleSpace}{\setstretch{1}}%  They claim they want single-space, but what they actually want is 
%                                               "as little white space between letters as is visually acceptable".
\usepackage[nodisplayskipstretch]{setspace}% This will allow us to set spacing in general.
%                   The optional argument "nodisplayskipstretch" turns off doublespacing for math display mode environments.
\doublespacing% Make everything double spaced by default.


% Eliminate extra vertical spacing around section levels. \section seems to have odd behavior compared to the others here. 

%% \center command give me the section in-line numbering, but the vertical spacing is off if I use \singlespace... but not if I use \realSingleSpace?
%% The other commands eg \raggedright or \filright don't give numbers, but don't throw off spacing either, even with \singlespace?


\section{The spacing above this is larger than the space below when using singlespace}% instead of realSingleSpace commands and I don't know why. 
\section{Also this is a really long section name to verify that the section is typeset in a single-space manner, despite the rest being double spaced.}
\subsection{Subsections seem to have the correct spacing, but no in-line numbering?}
\subsubsection{Subsubsections seem to behave similarly to subsections as well}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.