# Enumerating in same line with chapter numbers

I want to present the answers of selected exercises at the end of a textbook. They should be labeled with chapter number and without a new line. Is there an easy way of doing it?

My Latex skills is not adequate to solve this problem. My solution:

\newpage
\begin{multicols}{2}
\huge{Chapter 1}\\

\normalsize
\textbf{1.1.} 25 \textbf{1.2.} 14 \textbf{1.3.} 42 \textbf{1.4.} $H_0$ reject
\textbf{1.5.} Do not reject $H_0$ \textbf{1.6.} 125 \textbf{1.7.} no
\textbf{1.8.} maybe \textbf{1.9.} probably not \textbf{1.10.} why not?
\textbf{1.11.} fate \textbf{1.12.} 754.14 \textbf{1.13.} correlation
\textbf{1.14.} $\rho = 0.7$ \textbf{1.15.} 147 \\

\huge{Chapter 2}\\

\normalsize
\end{multicols}
....

• Probably there is, but please show us what you've tried so far (minimal, but compilable code example). Jan 7, 2018 at 14:44
• the spacing in the "answer" lists is misleading. there should be more space between an answer and the next exercise number than between an exercise number and its answer. as for whether it can be done, i'm certain it can, but unfortunately am not able to offer any useful code. Jan 7, 2018 at 14:48
• This deliberately depends on how the questions and the answers are set. If you type in the solutions with numbering directly at the end, there is not much that can be done but adding the chapter number manually.
– user31729
Jan 7, 2018 at 15:12

You can use an inline list from enumitem. With some macros to define the new set of solutions - \chapteranswer{<num>}, the process of automating the addition of <num> to the enumeration is easy:

\documentclass{article}

\usepackage[inline]{enumitem}
\usepackage{multicol}

\subsection*{Chapter #1}%
\setlist[enumerate]{label = \textbf{#1.\arabic*}, itemjoin = \quad}%
}

\begin{document}

\begin{multicols}{2}
\raggedright

\begin{enumerate*}
\item 25
\item 14
\item 42
\item $H_0$ reject
\item Do not reject $H_0$
\item 125
\item no
\item maybe
\item probably not
\item why not?
\item fate
\item 754.14
\item correlation
\item $\rho = 0.7$
\item 147
\end{enumerate*}

\begin{enumerate*}
\item 25
\item 14
\item 42
\item $H_0$ reject
\item Do not reject $H_0$
\item 125
\item no
\item maybe
\item probably not
\item why not?
\item fate
\item 754.14
\item correlation
\item $\rho = 0.7$
\item 147
\end{enumerate*}

\begin{enumerate*}
\item 25
\item 14
\item 42
\item $H_0$ reject
\item Do not reject $H_0$
\item 125
\item no
\item maybe
\item probably not
\item why not?
\item fate
\item 754.14
\item correlation
\item $\rho = 0.7$
\item 147
\end{enumerate*}

\end{multicols}

\end{document}


Since the content doesn't truly follow a sentence-like structure, hyphenation patterns may look awful within a traditional justified setting. As such, I've issued \raggedright to make things a little more pleasing to the eye.

Using a known/existing sectional unit for each Chapter helps keep things together, although this can be changed as well.

\nextanswer{<num>} allows you to identify the number of the next answer explicitly (since you may only provide answers to selected exercises).