問題解決: 問題とその解決策をどのように結び付けるか?

問題解決: 問題とその解決策をどのように結び付けるか?

13ページと14ページの例は簡略化しました。probsoln パッケージドキュメント次の質問をします。問題とその解決策をどのように結び付ければよいでしょうか?(解決策はすでに対応する問題にリンクされています。)

MWE (2 ファイル!)

派生語.tex

\begin{defproblem}{cosxsqsinx}%
\begin{onlyproblem}%
$y = \cos(x^2)\sin x$.%
\end{onlyproblem}%
\begin{onlysolution}%
\[\frac{dy}{dx} = -\sin(x^2)2x\sin x + \cos(x^2)\cos x\]
\end{onlysolution}%
\end{defproblem}

メイン.tex

\documentclass{report}

\usepackage{probsoln}
\usepackage[colorlinks,linkcolor=blue]{hyperref}

\begin{document}

\hideanswers

\chapter{Differentiation}
% randomly select 25 problems from derivatives.tex and add to
% the data set called 'deriv'
\loadrandomproblems[deriv]{1}{derivatives}
% Display the problems
\renewcommand{\theenumi}{\thechapter.\arabic{enumi}}
\begin{enumerate}
\foreachproblem[deriv]{\item\label{prob:\thisproblemlabel}\thisproblem}
\end{enumerate}
% You may need to change \theenumi back here

\appendix
\chapter{Solutions}
\showanswers
\begin{itemize}
\foreachdataset{\thisdataset}{%
\foreachproblem[\thisdataset]{\item[\ref{prob:\thisproblemlabel}]\thisproblem}
}
\end{itemize}

\end{document}

スクリーンショット

1 ページ目の「1.1」にソリューションへのリンクを表示したいのですが...

ここに画像の説明を入力してください

...2 ページ目。2 ページの「1.1」のように、1 ページの演習にリンクします。

ここに画像の説明を入力してください

答え1

\documentclass{report}

\usepackage{probsoln}
\usepackage[colorlinks,linkcolor=blue]{hyperref}

\begin{document}

\hideanswers

\chapter{Differentiation}
% randomly select 25 problems from derivatives.tex and add to
% the data set called 'deriv'
\loadrandomproblems[deriv]{1}{derivatives}
% Display the problems
\renewcommand{\theenumi}{\thechapter.\arabic{enumi}}
\begin{enumerate}
\foreachproblem[deriv]{%
 \item[{\refstepcounter{enumi}\label{prob:\thisproblemlabel}%
        \hyperref[sol:\thisproblemlabel]{\theenumi}}]
       \thisproblem}
\end{enumerate}
% You may need to change \theenumi back here

\appendix
\chapter{Solutions}
\showanswers
\begin{itemize}
\foreachdataset{\thisdataset}{%
\foreachproblem[\thisdataset]{%
 \item[\ref{prob:\thisproblemlabel}\phantomsection\label{sol:\thisproblemlabel}]\thisproblem}
}
\end{itemize}

\end{document}

関連情報