# Answers in a line with Answers package

I am typing a set of exercises with an 'answers' package. MWE:

\documentclass[12pt]{article}

\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage[OT1]{fontenc}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{amsthm}

\Newassociation{sol}{Solution}{ans}
\renewcommand{\Solutionlabel}[1]{\textbf{#1.}}
\theoremstyle{plain}
\newtheorem{ex}{}

\begin{document}
\Opensolutionfile{ans}[ans1]
\section{Problems}
\begin{ex}
$2+2=?$
\begin{sol}
$4$.
\end{sol}
\end{ex}
\begin{ex}
$1+2=?$
\begin{sol}
$3$.
\end{sol}
\end{ex}
\Closesolutionfile{ans}
\input{ans1}
\end{document}


Everything is fine. But I want these short answers go in one paragraph like this: How to achieve it? This should be simple, but the manual is very concise and is missing a lot of details.

Restriction: I cannot use exam package as I need to use these exercises in tufte-style book eventually, so I cannot do \documentclass{exam}.

Acceptable answer: The answer could be the suggestion of the package that allows doing the same stuff with a continuous enumeration of the problems through the entire book and the answers printed at the end of the document but by \section and with the continuous enumeration.

• I have a question, does the TEX language solve equations? – LCarvalho Feb 2 '18 at 8:37
• TeX is for typesetting, you solve equations yourself. – Sergey Belyaev Feb 2 '18 at 12:56

\documentclass[12pt]{article}

\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage[OT1]{fontenc}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{amsthm}

\Newassociation{sol}{Solution}{ans}
\renewcommand{\Solutionlabel}[1]{\textbf{#1.}}
\theoremstyle{plain}
\newtheorem{ex}{}

\begin{document}
\Opensolutionfile{ans}[ans1]
\section{Problems}
\begin{ex}
$2+2=?$
\begin{sol}
$4$.
\end{sol}
\end{ex}
\begin{ex}
$1+2=?$
\begin{sol}
$3$.
\end{sol}
\end{ex}
\Closesolutionfile{ans}
\input{ans1}
\end{document}

• I knew it is simple. Thank you. The manual is not very detailed (or I am not smart enough :) ) – Sergey Belyaev Feb 2 '18 at 13:00