section in-line numbering and vertical spacing with the titlesec packageVertical space before section title...

Meshing the cow

I can't die. Who am I?

PTIJ: Mordechai mourning

Was it really inappropriate to write a pull request for the company I interviewed with?

Split a number into equal parts given the number of parts

Has Wakanda ever accepted refugees?

Practical reasons to have both a large police force and bounty hunting network?

A bug in Excel? Conditional formatting for marking duplicates also highlights unique value

Are small insurances worth it

What's Bob's age again?

How spaceships determine each other mass in space?

Number of folds to form a cube, using a square paper?

Label layer as symbol colors with QGIS 3

Deal the cards to the players

Should we avoid writing fiction about historical events without extensive research?

What is the oldest European royal house?

Searching for a string that contains the file name

Are Wave equations equivalent to Maxwell equations in free space?

Rationale to prefer local variables over instance variables?

If nine coins are tossed, what is the probability that the number of heads is even?

How to concatenate two command in shell

How to develop an internal intuition for note timings?

School performs periodic password audits. Is my password compromised?

The orphan's family



section in-line numbering and vertical spacing with the titlesec package


Vertical space before section title with titlesecDouble-spaced paragraphs, single-spaced headersCombine single and double spaceTitlesec numberless section numberingQuestion on spacing in the book document classSpacing of bibliography items affects title spaceHow to control spacing in toc for different sections?Section numbering disappeared after updating titlesec packagePackage titlesec adds spacing around section even with titlespacing all set to zeroHow to fill section on titlesec













0















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?



documentclass{report}
usepackage{hyperref}
usepackage{titlesec}
usepackage[english]{babel}
usepackage{blindtext}
makeatletter
usepackage[
margin=1in,% All 4 margins need to be one inch.
paperheight=11in,% we want 11in tall...
paperwidth=8.5in% and 8.5in wide paper.
]{geometry}

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.

setcounter{secnumdepth}{4}%
setcounter{tocdepth}{4}%

% Eliminate extra vertical spacing around section levels. section seems to have odd behavior compared to the others here.
titlespacing*{section}{0pt}{0pt}{0pt}
titlespacing*{subsection}{0pt}{10pt}{0pt}
titlespacing*{subsubsection}{0pt}{10pt}{0pt}

%% 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?

titleformat{section}
{bfseriescenterrealSingleSpace}{thesection}{1em}{}
titleformat{subsection}
{bfseriesraggedrightrealSingleSpace}{thesubsection}{1em}{}
titleformat{subsubsection}
{bfseriesfilrightrealSingleSpace}
{thesubsubsection}{1em}{}


begin{document}
tableofcontents
blindtext
section{The spacing above this is larger than the space below when using singlespace}% instead of realSingleSpace commands and I don't know why.
blindtext
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.}
blindtext[2]
subsection{Subsections seem to have the correct spacing, but no in-line numbering?}
blindtext
subsubsection{Subsubsections seem to behave similarly to subsections as well}
blindtext
end{document}









share|improve this question



























    0















    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?



    documentclass{report}
    usepackage{hyperref}
    usepackage{titlesec}
    usepackage[english]{babel}
    usepackage{blindtext}
    makeatletter
    usepackage[
    margin=1in,% All 4 margins need to be one inch.
    paperheight=11in,% we want 11in tall...
    paperwidth=8.5in% and 8.5in wide paper.
    ]{geometry}

    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.

    setcounter{secnumdepth}{4}%
    setcounter{tocdepth}{4}%

    % Eliminate extra vertical spacing around section levels. section seems to have odd behavior compared to the others here.
    titlespacing*{section}{0pt}{0pt}{0pt}
    titlespacing*{subsection}{0pt}{10pt}{0pt}
    titlespacing*{subsubsection}{0pt}{10pt}{0pt}

    %% 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?

    titleformat{section}
    {bfseriescenterrealSingleSpace}{thesection}{1em}{}
    titleformat{subsection}
    {bfseriesraggedrightrealSingleSpace}{thesubsection}{1em}{}
    titleformat{subsubsection}
    {bfseriesfilrightrealSingleSpace}
    {thesubsubsection}{1em}{}


    begin{document}
    tableofcontents
    blindtext
    section{The spacing above this is larger than the space below when using singlespace}% instead of realSingleSpace commands and I don't know why.
    blindtext
    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.}
    blindtext[2]
    subsection{Subsections seem to have the correct spacing, but no in-line numbering?}
    blindtext
    subsubsection{Subsubsections seem to behave similarly to subsections as well}
    blindtext
    end{document}









    share|improve this question

























      0












      0








      0








      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?



      documentclass{report}
      usepackage{hyperref}
      usepackage{titlesec}
      usepackage[english]{babel}
      usepackage{blindtext}
      makeatletter
      usepackage[
      margin=1in,% All 4 margins need to be one inch.
      paperheight=11in,% we want 11in tall...
      paperwidth=8.5in% and 8.5in wide paper.
      ]{geometry}

      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.

      setcounter{secnumdepth}{4}%
      setcounter{tocdepth}{4}%

      % Eliminate extra vertical spacing around section levels. section seems to have odd behavior compared to the others here.
      titlespacing*{section}{0pt}{0pt}{0pt}
      titlespacing*{subsection}{0pt}{10pt}{0pt}
      titlespacing*{subsubsection}{0pt}{10pt}{0pt}

      %% 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?

      titleformat{section}
      {bfseriescenterrealSingleSpace}{thesection}{1em}{}
      titleformat{subsection}
      {bfseriesraggedrightrealSingleSpace}{thesubsection}{1em}{}
      titleformat{subsubsection}
      {bfseriesfilrightrealSingleSpace}
      {thesubsubsection}{1em}{}


      begin{document}
      tableofcontents
      blindtext
      section{The spacing above this is larger than the space below when using singlespace}% instead of realSingleSpace commands and I don't know why.
      blindtext
      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.}
      blindtext[2]
      subsection{Subsections seem to have the correct spacing, but no in-line numbering?}
      blindtext
      subsubsection{Subsubsections seem to behave similarly to subsections as well}
      blindtext
      end{document}









      share|improve this question














      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?



      documentclass{report}
      usepackage{hyperref}
      usepackage{titlesec}
      usepackage[english]{babel}
      usepackage{blindtext}
      makeatletter
      usepackage[
      margin=1in,% All 4 margins need to be one inch.
      paperheight=11in,% we want 11in tall...
      paperwidth=8.5in% and 8.5in wide paper.
      ]{geometry}

      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.

      setcounter{secnumdepth}{4}%
      setcounter{tocdepth}{4}%

      % Eliminate extra vertical spacing around section levels. section seems to have odd behavior compared to the others here.
      titlespacing*{section}{0pt}{0pt}{0pt}
      titlespacing*{subsection}{0pt}{10pt}{0pt}
      titlespacing*{subsubsection}{0pt}{10pt}{0pt}

      %% 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?

      titleformat{section}
      {bfseriescenterrealSingleSpace}{thesection}{1em}{}
      titleformat{subsection}
      {bfseriesraggedrightrealSingleSpace}{thesubsection}{1em}{}
      titleformat{subsubsection}
      {bfseriesfilrightrealSingleSpace}
      {thesubsubsection}{1em}{}


      begin{document}
      tableofcontents
      blindtext
      section{The spacing above this is larger than the space below when using singlespace}% instead of realSingleSpace commands and I don't know why.
      blindtext
      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.}
      blindtext[2]
      subsection{Subsections seem to have the correct spacing, but no in-line numbering?}
      blindtext
      subsubsection{Subsubsections seem to behave similarly to subsections as well}
      blindtext
      end{document}






      spacing sectioning vertical-alignment titlesec






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked 14 hours ago









      JasonJason

      46037




      46037






















          0






          active

          oldest

          votes











          Your Answer








          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "85"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: false,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: null,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f478128%2fsection-in-line-numbering-and-vertical-spacing-with-the-titlesec-package%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          0






          active

          oldest

          votes








          0






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes
















          draft saved

          draft discarded




















































          Thanks for contributing an answer to TeX - LaTeX Stack Exchange!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f478128%2fsection-in-line-numbering-and-vertical-spacing-with-the-titlesec-package%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          El tren de la libertad Índice Antecedentes "Porque yo decido" Desarrollo de la...

          Castillo d'Acher Características Menú de navegación

          Connecting two nodes from the same mother node horizontallyTikZ: What EXACTLY does the the |- notation for...