문서 끝에 나타나는 솔루션의 번호 매기기 방정식에 질문 카운터 사용

문서 끝에 나타나는 솔루션의 번호 매기기 방정식에 질문 카운터 사용

exsheets문제 세트를 작성하는 데 사용하고 있습니다 . 나는 방정식과 관련된 질문별로 방정식에 번호를 매기고 싶습니다. 그래서 나는 \numberwithin{equation}{question}.

이는 질문 자체에 나타나는 방정식에는 잘 작동하지만 솔루션(마지막에 인쇄 중)에는 작동하지 않습니다.

\documentclass{article}

\usepackage{amsmath}
\usepackage{exsheets}

\numberwithin{equation}{question}

\begin{document}

\begin{question}
First Question
\begin{equation}
a^2 + b^2 = c^2
\end{equation}
\end{question}
\begin{solution}
    \begin{equation}
        E = m c^2
    \end{equation}
\end{solution}

\begin{question}
Second Question
\end{question}

\section*{Answers}%
\printsolutions%

\end{document}

여기에 이미지 설명을 입력하세요

나는 "a^2+b^2=c^2가 1.2로 번호가 매겨질 것으로 예상했습니다.

모든 해 방정식은 마지막 문제 번호를 번호로 사용합니다. 솔루션 내에서 적절한 질문 번호를 어떻게 사용할 수 있나요?

답변1

간단한 해결 방법은 태그를 추가하는 것입니다. 를 사용하면 자동으로 수행될 수도 있습니다 equation.

\documentclass{article}

\usepackage{amsmath}
\usepackage{exsheets}

\numberwithin{equation}{question}
\NewDocumentCommand{\TAG}{m}{\label{#1}}

\begin{document}

\begin{question}
First Question
\begin{equation}
a^2 + b^2 = c^2 \TAG{A}
\end{equation}
\end{question}
\begin{solution}
    \begin{equation}
        E = m c^2 \TAG{A}
    \end{equation}
\end{solution}

\begin{question}
Second Question
\end{question}

\section*{Answers}
\RenewDocumentCommand{\TAG}{m}{\tag{\ref{#1}}}
\printsolutions

\end{document}

여기에 이미지 설명을 입력하세요

관련 정보