연습 패키지의 답변 링크

연습 패키지의 답변 링크

저는 운동 패키지를 사용하여 운동 책을 만들고 있습니다.

질문에 라벨을 추가하여 특정 질문에 대한 답변을 연결할 수 있다는 것을 이해합니다.

그러나 질문 아래 답변에 대한 링크를 추가하고 싶습니다. 그래서 그것은 다음과 같습니다:

현재 텍스 소스:

\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}

관련 정보