[Tex/LaTex] Changing line spacing within a new command

line-spacingmacrossetspace

I have a command written as follows:

\documentclass[12pt]{book}
\usepackage{setspace}

\newcommand{\statshyp}[2]{\noindent \hangindent=1cm \hangafter=0 
\begin{singlespace*}
\textbf{#1}: \emph{#2}
\end{singlespace*}
}

Unfortunately, changing the line spacing just within the new command doesn't work. The intention is to create a macro which allows me to create identically formatted single-spaced hypotheses in a generally doublespaced document. Is there a way to do this? I found one other person asking a similar question but the answers given to him provided a way for him to get what he needed without using the spacing commands at all.

Best Answer

This might be something near to what you want; but the result is not pretty (nothing with very large interline space can be).

I don't think that a length such as 1cm is good: it doesn't mix with the other parameters. Perhaps more space would be needed around the single spaced insertion.

\documentclass[12pt]{book}
\usepackage{setspace,lipsum,changepage}

\makeatletter
\renewenvironment{singlespace*}
  {\setstretch {\setspace@singlespace}%
   \vskip -\baselineskip}
  {\vskip -.25\baselineskip}
\makeatother

\newcommand{\statshyp}[2]{%
  \begin{singlespace*}
  \begin{adjustwidth}{1cm}{0pt}
  \noindent\textbf{#1}: \emph{#2} \par
  \end{adjustwidth}
  \end{singlespace*}
}

\onehalfspacing
\begin{document}

\lipsum[2]

\statshyp{Some}{I don't know what to say, but I'm
trying to keep it very long so that it wraps and
the paragraph will show the effect of the parameters.}

\lipsum[3]

\end{document}

enter image description here