[Tex/LaTex] Question on spacing in the book document class

line-spacingsectioningsetspacespacing

I have 2 questions regrading the spacing is concerned.

1. How to reduce the space between the heading of the paragraph in the paragraph command and the content?

Usually, the space provided is far sufficient. But rather sometimes, the space is too much and changes the meaning of the content. So are there low-level TeX commands to reduce this space.

The MWE:

\documentclass[12pt]{book}
\usepackage{kantlipsum}
\begin{document}
\chapter{Sample}
\section{Demo}
\paragraph{Demo}\kant[1]
\end{document} 

enter image description here

2. How to enable \doublespacing only to the content of the document and not to chapter, section or other headings.

When I include \doublespacing immediately after the \begin{document}, the whole document is double spaced but I want only the content. How do I do that?

The MWE:

\documentclass[12pt]{book}
\usepackage{kantlipsum}
\usepackage{setspace}
\begin{document}
\doublespacing
\chapter{Sample}
\section{Demo}
\paragraph{Demo}\kant[1]
\end{document} 

enter image description here

Best Answer

For first, you can use titlesec and put

\titlespacing*{\paragraph} {0pt}{3.25ex  plus 1ex minus .2ex}{0.5em}  %% change the 0.5em as you wish, default is 1em

0.5em is the length you have to adjust.

For second, You can put \doublespacing at appropriate place. However, I feel that the spacing in titles should vary according the baseline skip of the contents.

\documentclass[12pt]{book}
\usepackage{kantlipsum}
\usepackage{setspace}
\usepackage{titlesec}
\titlespacing*{\paragraph} {0pt}{3.25ex  plus 1ex minus .2ex}{0.5em}  %% change the 0.5em as you wish, default is 1em    

\begin{document}
\singlespacing
\chapter{Sample}
\section{Demo}
\doublespacing
\paragraph{Demo} 
\kant[1-5]
\singlespacing
\section{Demo}
\doublespacing
\paragraph{Demo}
\kant[6-10]
\end{document} 

enter image description here