add tag
Anonymous 2257
In this code
```
\documentclass[12pt,a4paper]{book}
\usepackage{amsthm,amsfonts,amssymb,amsmath}
\usepackage{answers}
\newif\ifsolutions
\solutionstrue 
\theoremstyle{definition}
\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}
		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}   
```

How to color number of Exercises? 

![image.png](/image?hash=0508ba22edb1ea472dc3742846420ff7cf0d7cd9b271077b7bb3c460f2347663)
Top Answer
samcarter
You could define a new theorem style:

```
\documentclass[12pt,a4paper]{book}
\usepackage{amsthm,amsfonts,amssymb,amsmath}
\usepackage{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}   
```

![Screenshot 2022-01-06 at 16.21.13.png](/image?hash=c5c6fb35cfb1d36fc5639e2972ec7c7860c1b5c2a2f19e5f8c56a8fce3d42ad5)

Enter question or answer id or url (and optionally further answer ids/urls from the same question) from

Separate each id/url with a space. No need to list your own answers; they will be imported automatically.