8

I use answers package. In out put of answer, I want to format 1) or Answer 1. instead of 1 as default. How can I do it? My code is

\documentclass[12pt,a4paper]{article}
\usepackage{amsthm}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{amsmath}
\usepackage{fourier}
\usepackage[left=2cm,right=2cm,top=2cm,bottom=2cm]{geometry}
\theoremstyle{definition}
\newtheorem{ex}{Exercise}
\usepackage{answers}
\Newassociation{sol}{Solution}{ans}
\begin{document}
\Opensolutionfile{ans}[ans1]
\begin{ex}
This is a question.
\begin{sol}
This is an answer.
\end{sol}
\end{ex}
\Closesolutionfile{ans}
\section{Ansewr}
 \input{ans1}
\end{document}

enter image description here

10

Once you declare

\Newassociation{sol}{Solution}{ans}

you can use

\renewcommand{\Solutionlabel}[1]{\emph{Solution #1}}

Instead of \emph{Solution #1} do whatever formatting you need.

\documentclass[12pt,a4paper]{article}
\usepackage{amsthm}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{amsmath}
\usepackage{fourier}
\usepackage[left=2cm,right=2cm,top=2cm,bottom=2cm]{geometry}
\theoremstyle{definition}
\newtheorem{ex}{Exercise}
\usepackage{answers}
\Newassociation{sol}{Solution}{ans}
\renewcommand{\Solutionlabel}[1]{\textbf{Answer #1.}}
\begin{document}
\Opensolutionfile{ans}[ans1]
\begin{ex}
This is a question.
\begin{sol}
This is an answer.
\end{sol}
\end{ex}
\Closesolutionfile{ans}
\section{Answer}
 \input{ans1}
\end{document}

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.