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

Misplaced tyre lever - alternatives?

Can a space-faring robot still function over a billion years?

Why would the IRS ask for birth certificates or even audit a small tax return?

Why do phishing e-mails use faked e-mail addresses instead of the real one?

Difference between 'stomach' and 'uterus'

PTIJ: Aharon, King of Egypt

Are there other characters in the Star Wars universe who had damaged bodies and needed to wear an outfit like Darth Vader?

Should I use HTTPS on a domain that will only be used for redirection?

What is a term for a function that when called repeatedly, has the same effect as calling once?

Where is the fallacy here?

How can I handle a player who pre-plans arguments about my rulings on RAW?

School performs periodic password audits. Is my password compromised?

Every subset equal to original set?

Are small insurances worth it

How does insurance birth control work?

Is there a frame of reference in which I was born before I was conceived?

Can we carry rice to Japan?

How to disable or uninstall iTunes under High Sierra without disabling SIP

How to kill a localhost:8080

How can neutral atoms have exactly zero electric field when there is a difference in the positions of the charges?

Can an earth elemental drown/bury its opponent underground using earth glide?

Is there a way to find out the age of climbing ropes?

How to mitigate "bandwagon attacking" from players?

Quitting employee has privileged access to critical information



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 11 mins 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

          Can't compile dgruyter and caption packagesLaTeX templates/packages for writing a patent specificationLatex...

          Schneeberg (Smreczany) Bibliografia | Menu...

          Hans Bellmer Spis treści Życiorys | Upamiętnienie | Przypisy | Bibliografia | Linki zewnętrzne |...