练习包中的答案链接

练习包中的答案链接

我正在使用练习包创建一本练习册。

我知道我可以给问题添加标签以将答案链接到特定问题。

不过,我想在问题下添加一个答案的链接。所以它看起来像:

当前文本来源:

\usepackage[answerdelayed]{exercise}
\begin{Exercise}
What is the value of 2+5?
\end{Exercise}
\begin{Answer}
7
\end{Answer}
<rest of the document>
\shipoutaAnswer

电流输出:

Exercise 1: What is the value of 2 + 5?

<rest of the document>

Solution 1: 7

期望输出:

Exercise 1: What is the value of 2 + 5?
<Link to Solution at the end of the document>

<rest of the document>

Solution 1: 7

答案1

exercise包有特定的方式来管理标签。

查看包装文档第 2.4 节。

\documentclass{article}
\usepackage{hyperref}% you must load it before the exercise package
\usepackage[answerdelayed]{exercise}

\begin{document}
    \begin{Exercise}[label={mylabel}]
        What is the value of 2+5? (To see the answer click here: \refAnswer{\ExerciseLabel})
    \end{Exercise}
    \begin{Answer}[ref=\ExerciseLabel]
        7
    \end{Answer}

    rest of the document
    \newpage % I've added a new page only to clearly show the hyperlink. Of course, you don't need it in your document.

    \shipoutAnswer
\end{document}

在此处输入图片描述

在此处输入图片描述

答案2

像这样:

\documentclass{article}
\usepackage{exercise}
\usepackage{hyperref}
\begin{document}
\begin{Exercise}
    Some introductory text.
    \Question The first question
\end{Exercise}

See the answer \hyperref[one]{here}.
\newpage
\begin{Answer}[ref=first]
    The answer to question~\ref{first}.\label{one}
\end{Answer}
\end{document}

相关内容