Anonymous 2257
I use `\usepackage[nosolutionfiles]{answers}` in this code.
```
\documentclass[12pt,a4paper]{book}
\usepackage{amsthm,amsfonts,amssymb,amsmath}
%\usepackage{answers}
\usepackage[nosolutionfiles]{answers}
\newif\ifsolutions
\solutionstrue
\newtheoremstyle{foo}%
{}{}%
{}{}%
{\bfseries}{:}%
{ }%
{\thmname{#1}\thmnumber{ \textcolor{blue}{#2.}}\thmnote{ (#3)}}
\theoremstyle{foo}
\newtheorem{ex}{%
\hyperlink{ex:\theex}{Exercise}%
\hypertarget{sol:\theex}{}}[chapter]
\Newassociation{sol}{Soln}{ans}
\renewenvironment{Soln}[1]{\par\bigskip\noindent{\bfseries \hypertarget{ex:#1}{}%
\hyperlink{sol:#1}{ #1}}\quad}
\usepackage[linkcolor=blue,colorlinks=true,unicode,bookmarksnumbered]{hyperref}
\begin{document}
\chapter{Try}
\Opensolutionfile{ans}[ans1]
\begin{ex}[Quack]
First exercise
\begin{sol}
First solution.
\end{sol}
\end{ex}
\clearpage
\begin{ex}
Second exercise
\begin{sol}
Second solution.
\end{sol}
\end{ex}
\clearpage
\Closesolutionfile{ans}
\ifsolutions
\section{Solutions}
\input{ans1}
\fi
\end{document}
```
After Exercise 1.1 is 1.1. How to change 1.1 into Solution like this
![image.png](/image?hash=b75df8e00bd185d0515fa6b6864c406b948ad5ec380f1c71c35753ebb1dad18f)
and
I do not want to show solutions like this
![image.png](/image?hash=0e4621a966d265a26ed00cd697c657cdc6a16a77ac77158f07d1a9f9291717e4)
Top Answer
samcarter
The appearance of the solution is defined in the `Soln` environment in your code. To add the word "Solution", you can modify it like this:
```
\renewenvironment{Soln}[1]{%
\par\bigskip\noindent%
{%
\bfseries%
\hypertarget{ex:#1}{}%
\hyperlink{sol:#1}{Solution}%
}%
\quad%
}
```
To control the position of the solution (below the exercise or at the end of the document), you can toggle on/off the `nosolutionfiles` package option and show the solutions at the end depending on this option:
```
\documentclass[12pt,a4paper]{book}
\usepackage{amsthm,amsfonts,amssymb,amsmath}
\usepackage[
% nosolutionfiles % comment or uncomment thus line
]{answers}
\newtheoremstyle{foo}%
{}{}%
{}{}%
{\bfseries}{:}%
{ }%
{\thmname{#1}\thmnumber{ \textcolor{blue}{#2.}}\thmnote{ (#3)}}
\theoremstyle{foo}
\newtheorem{ex}{%
\hyperlink{ex:\theex}{Exercise}%
\hypertarget{sol:\theex}{}}[chapter]
\Newassociation{sol}{Soln}{ans}
\renewenvironment{Soln}[1]{\par\bigskip\noindent{\bfseries \hypertarget{ex:#1}{}%
\hyperlink{sol:#1}{%
\ifanswerfiles
#1
\else
Solution
\fi}}\quad}
\usepackage[linkcolor=blue,colorlinks=true,unicode,bookmarksnumbered]{hyperref}
\begin{document}
\chapter{Try}
\Opensolutionfile{ans}[ans1]
\begin{ex}[Quack]
First exercise
\begin{sol}
First solution.
\end{sol}
\end{ex}
\clearpage
\begin{ex}
Second exercise
\begin{sol}
Second solution.
\end{sol}
\end{ex}
\clearpage
\Closesolutionfile{ans}
\ifanswerfiles
\section{Solutions}
\input{ans1}
\fi
\end{document}
```
![Screenshot 2022-01-10 at 10.25.17.png](/image?hash=2b5511d28be4436045899caf0fe2ad19ad4e33dc528eae2d68422fc9dfc1b7e8)