The solution,the answers keys are show in vertical,in this way it need big space and when i print them, i will use more paper and I want to get that answer key can show in horizontal. Thank you

\documentclass{exam} \usepackage{answers}

\Newassociation{sol}{Solution}{ans}

\newtheorem{ex}{}{} \renewcommand\questionlabel{}
\renewcommand\questionshook{\leftmargin0pt} \begin{document}

\Opensolutionfile{ans}[ans1] \section{Problems}

\begin{ex}
\begin{questions}
\question One of these things is not like the
others; one of these things is not the same. Which one is different?

\begin{oneparchoices}
\choice John
\choice Paul
\choice George
\choice Ringo
\choice Socrates \end{oneparchoices}
\begin{sol}
Socrates
\end{sol}
\end{questions} \end{ex}

\begin{ex} \begin{questions} \stepcounter{question} \question One of these
numbers is perfect.

\begin{oneparchoices}
\choice $2$
\choice $28$
\choice $5$
\choice $3$
\choice $7$ \end{oneparchoices} \end{questions}
\begin{sol}
$7$
\end{sol}
\end{ex}

\Closesolutionfile{ans}
\section{Solutions}
\input{ans1}

\end{document}


• This question is pretty unclear. Please add a code example and rephrase your question according to your needs. – TeXnician Jul 2 '18 at 11:45
• I did some change,maybe now it will be more clear@TeXnician – nar Jul 2 '18 at 17:47

Redefine how solutions are displayed. You can change how much space to put between answers or other aspects of the formatting as you see fit.

\documentclass{exam} \usepackage{answers}

\Newassociation{sol}{Solution}{ans}

\newtheorem{ex}{}{} \renewcommand\questionlabel{}
\renewcommand\questionshook{\leftmargin0pt} \begin{document}

\renewenvironment{Solution}[1]{\textbf{#1} }{\hspace{10pt}} %NEW

\Opensolutionfile{ans}[ans1] \section{Problems}

\begin{ex}
\begin{questions}
\question One of these things is not like the others; one of these things is not the same. Which one is different?

\begin{oneparchoices}
\choice John
\choice Paul
\choice George
\choice Ringo
\choice Socrates \end{oneparchoices}
\begin{sol}
Socrates
\end{sol}
\end{questions} \end{ex}

\begin{ex} \begin{questions} \stepcounter{question} \question One of these numbers is perfect.

\begin{oneparchoices}
\choice $2$
\choice $28$
\choice $5$
\choice $3$
\choice $7$ \end{oneparchoices} \end{questions}
\begin{sol}
$7$
\end{sol}
\end{ex}

\Closesolutionfile{ans}
\section{Solutions}
\input{ans1}

\end{document}

• Thank you very much you solved my problem @CrimsonRain – nar Jul 3 '18 at 3:26