3

I would like to increase the linespread within a group. Namely, the linespread within an inline-enumeration. For this purpose, I have the following code.

\documentclass[]{article}
\parindent 0cm 
\usepackage{setspace}
\usepackage{enumerate}
\usepackage[inline,shortlabels]{enumitem}

\newlist{choices}{enumerate*}{1}
\setlist[choices]{itemjoin = \hspace{0.7cm}, label=\alph*)}

\begin{document}
{
\setstretch{2}
\begin{choices}
  \item $XXXX$
  \item $XXXX$
  \item $XXXX$
  \item $XXXX$
  \item $XXXX$
  \item $XXXX$
  \item $XXXX$
  \item $XXXX$
  \item $XXXX$
  \item $XXXX$
\end{choices}
}\\

\begin{choices}
  \item $XXXX$
  \item $XXXX$
  \item $XXXX$
  \item $XXXX$
  \item $XXXX$
  \item $XXXX$
  \item $XXXX$
  \item $XXXX$
  \item $XXXX$
  \item $XXXX$
\end{choices}
\end{document}

Which produces Output1

I would, however, like to have only the first list spaced with double spacing. Like so

\documentclass[]{article}
\parindent 0cm 
\usepackage{setspace}
\usepackage{enumerate}
\usepackage[inline,shortlabels]{enumitem}

\newlist{choices}{enumerate*}{1}
\setlist[choices]{itemjoin = \hspace{0.7cm}, label=\alph*)}

\begin{document}

\setstretch{2}
\begin{choices}
  \item $XXXX$
  \item $XXXX$
  \item $XXXX$
  \item $XXXX$
  \item $XXXX$
  \item $XXXX$
  \item $XXXX$
  \item $XXXX$
  \item $XXXX$
  \item $XXXX$
\end{choices}

\end{document}

which produces Output2

So, if I have only one list present, it works. As soon as there is another list, or other text, it doesn't. Can somebody help me?

Wrapping it in a minipage environment does the trick. Is there another solution?

2 Answers2

4

The package setspace offers an environment. You get the manual probably by typing texdoc setspaceon the command line.

\documentclass[]{article}
\parindent 0cm 
\usepackage{setspace}
\usepackage{enumerate}
\usepackage[inline,shortlabels]{enumitem}

\newlist{choices}{enumerate*}{1}
\setlist[choices]{itemjoin = \hspace{0.7cm}, label=\alph*)}

\begin{document}

\begin{spacing}{2}
  \begin{choices}
  \item $XXXX$
  \item $XXXX$
  \item $XXXX$
  \item $XXXX$
  \item $XXXX$
  \item $XXXX$
  \item $XXXX$
  \item $XXXX$
  \item $XXXX$
  \item $XXXX$
  \end{choices}
\end{spacing}

\begin{choices}
  \item $XXXX$
  \item $XXXX$
  \item $XXXX$
  \item $XXXX$
  \item $XXXX$
  \item $XXXX$
  \item $XXXX$
  \item $XXXX$
  \item $XXXX$
  \item $XXXX$
\end{choices}
\end{document}

We get:

enter image description here

Keks Dose
  • 30,892
2

Never use \\ in order to terminate paragraphs. Also, don't load enumerate along with enumitem.

\documentclass{article}
\usepackage{setspace}
\usepackage[inline]{enumitem}

\newlist{innerchoices}{enumerate*}{1}
\setlist[innerchoices]{
  itemjoin = \hspace{0.7cm},
  label=\alph*),
  before=\noindent,
  mode=unboxed,
}
\newenvironment{choices}[1][1]
  {\begin{spacing}{#1}\begin{innerchoices}}
  {\end{innerchoices}\end{spacing}}

\begin{document}

\begin{choices}[2]
  \item $XXXX$
  \item $XXXX$
  \item $XXXX$
  \item $XXXX$
  \item $XXXX$
  \item $XXXX$
  \item $XXXX$
  \item $XXXX$
  \item $XXXX$
  \item $XXXX$
\end{choices}

\begin{choices}
  \item $XXXX$
  \item $XXXX$
  \item $XXXX$
  \item $XXXX$
  \item $XXXX$
  \item $XXXX$
  \item $XXXX$
  \item $XXXX$
  \item $XXXX$
  \item $XXXX$
\end{choices}
\end{document}

enter image description here

egreg
  • 1,121,712
  • why and why? :) so why should I not end paragraphs with // ? and why should I not load enumitem and enumerate together? they are compatible, no? – Johannes Bleher Aug 24 '18 at 19:34
  • 1
    @JohannesBleher \\ is not to be used for ending paragraphs. Ever. And no, enumerate and enumitem are not really compatible. – egreg Aug 24 '18 at 20:12
  • alright. looked it up https://tex.stackexchange.com/questions/82664/when-to-use-par-and-when-or-blank-lines – Johannes Bleher Aug 24 '18 at 20:19