
나는 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}
main.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}