Using exam question counter as an argument
up vote
1
down vote
favorite
I am trying to use the exam class to create a study guide for my students that has all of the answers at the end of the document.
I would like to have the answers automatically labeled by question number and part, but I'm hung up on how to pass the question and part counters to the command I'm using to construct the end notes.
All of my attempts to do this end up labeling all answers with the most recent question and part counter values. My problem seems very related to this question, but I'm unable to bridge the gap between them. I've tried reading through a few posts on expanding arguments, but I don't know enough of the deeper aspects of TeX to understand what's going on.
Here's a (relatively minimal) working example. Again, I would like to have output that looked numbered answers like "1: 5, 2(a): 9, 2(b): 30, 3: 2 apples".
documentclass{exam}
usepackage[utf8]{inputenc}
usepackage{endnotes}
defenotesize{normalsize}
defmakeenmark{relax}
defnotesname{normalsize Answers}
defanswer#1{endnotetext{#1\}}
deftheanswers{theendnotes}
begin{document}
noindenttextbf{Practice Problems}
begin{questions}
question How many sides does a pentagon have?
answer{thequestion: $5$}
question Calculate the following:
begin{parts}
part $2+7$
answer{thequestion(thepartno): $9$}
part $5cdot 6$
answer{thequestion(thepartno): $30$}
end{parts}
question If I have four apples and I eat two, how many are left?
answer{thequestion: $2$ apples}
end{questions}
theanswers
end{document}
macros counters expansion exam arguments
New contributor
AegisCruiser is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
add a comment |
up vote
1
down vote
favorite
I am trying to use the exam class to create a study guide for my students that has all of the answers at the end of the document.
I would like to have the answers automatically labeled by question number and part, but I'm hung up on how to pass the question and part counters to the command I'm using to construct the end notes.
All of my attempts to do this end up labeling all answers with the most recent question and part counter values. My problem seems very related to this question, but I'm unable to bridge the gap between them. I've tried reading through a few posts on expanding arguments, but I don't know enough of the deeper aspects of TeX to understand what's going on.
Here's a (relatively minimal) working example. Again, I would like to have output that looked numbered answers like "1: 5, 2(a): 9, 2(b): 30, 3: 2 apples".
documentclass{exam}
usepackage[utf8]{inputenc}
usepackage{endnotes}
defenotesize{normalsize}
defmakeenmark{relax}
defnotesname{normalsize Answers}
defanswer#1{endnotetext{#1\}}
deftheanswers{theendnotes}
begin{document}
noindenttextbf{Practice Problems}
begin{questions}
question How many sides does a pentagon have?
answer{thequestion: $5$}
question Calculate the following:
begin{parts}
part $2+7$
answer{thequestion(thepartno): $9$}
part $5cdot 6$
answer{thequestion(thepartno): $30$}
end{parts}
question If I have four apples and I eat two, how many are left?
answer{thequestion: $2$ apples}
end{questions}
theanswers
end{document}
macros counters expansion exam arguments
New contributor
AegisCruiser is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
Welcome to TeX.SE!
– Kurt
49 mins ago
add a comment |
up vote
1
down vote
favorite
up vote
1
down vote
favorite
I am trying to use the exam class to create a study guide for my students that has all of the answers at the end of the document.
I would like to have the answers automatically labeled by question number and part, but I'm hung up on how to pass the question and part counters to the command I'm using to construct the end notes.
All of my attempts to do this end up labeling all answers with the most recent question and part counter values. My problem seems very related to this question, but I'm unable to bridge the gap between them. I've tried reading through a few posts on expanding arguments, but I don't know enough of the deeper aspects of TeX to understand what's going on.
Here's a (relatively minimal) working example. Again, I would like to have output that looked numbered answers like "1: 5, 2(a): 9, 2(b): 30, 3: 2 apples".
documentclass{exam}
usepackage[utf8]{inputenc}
usepackage{endnotes}
defenotesize{normalsize}
defmakeenmark{relax}
defnotesname{normalsize Answers}
defanswer#1{endnotetext{#1\}}
deftheanswers{theendnotes}
begin{document}
noindenttextbf{Practice Problems}
begin{questions}
question How many sides does a pentagon have?
answer{thequestion: $5$}
question Calculate the following:
begin{parts}
part $2+7$
answer{thequestion(thepartno): $9$}
part $5cdot 6$
answer{thequestion(thepartno): $30$}
end{parts}
question If I have four apples and I eat two, how many are left?
answer{thequestion: $2$ apples}
end{questions}
theanswers
end{document}
macros counters expansion exam arguments
New contributor
AegisCruiser is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
I am trying to use the exam class to create a study guide for my students that has all of the answers at the end of the document.
I would like to have the answers automatically labeled by question number and part, but I'm hung up on how to pass the question and part counters to the command I'm using to construct the end notes.
All of my attempts to do this end up labeling all answers with the most recent question and part counter values. My problem seems very related to this question, but I'm unable to bridge the gap between them. I've tried reading through a few posts on expanding arguments, but I don't know enough of the deeper aspects of TeX to understand what's going on.
Here's a (relatively minimal) working example. Again, I would like to have output that looked numbered answers like "1: 5, 2(a): 9, 2(b): 30, 3: 2 apples".
documentclass{exam}
usepackage[utf8]{inputenc}
usepackage{endnotes}
defenotesize{normalsize}
defmakeenmark{relax}
defnotesname{normalsize Answers}
defanswer#1{endnotetext{#1\}}
deftheanswers{theendnotes}
begin{document}
noindenttextbf{Practice Problems}
begin{questions}
question How many sides does a pentagon have?
answer{thequestion: $5$}
question Calculate the following:
begin{parts}
part $2+7$
answer{thequestion(thepartno): $9$}
part $5cdot 6$
answer{thequestion(thepartno): $30$}
end{parts}
question If I have four apples and I eat two, how many are left?
answer{thequestion: $2$ apples}
end{questions}
theanswers
end{document}
macros counters expansion exam arguments
macros counters expansion exam arguments
New contributor
AegisCruiser is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
New contributor
AegisCruiser is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
edited 50 mins ago
New contributor
AegisCruiser is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
asked 56 mins ago
AegisCruiser
1063
1063
New contributor
AegisCruiser is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
New contributor
AegisCruiser is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
AegisCruiser is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
Welcome to TeX.SE!
– Kurt
49 mins ago
add a comment |
Welcome to TeX.SE!
– Kurt
49 mins ago
Welcome to TeX.SE!
– Kurt
49 mins ago
Welcome to TeX.SE!
– Kurt
49 mins ago
add a comment |
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
AegisCruiser is a new contributor. Be nice, and check out our Code of Conduct.
AegisCruiser is a new contributor. Be nice, and check out our Code of Conduct.
AegisCruiser is a new contributor. Be nice, and check out our Code of Conduct.
AegisCruiser is a new contributor. Be nice, and check out our Code of Conduct.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f462096%2fusing-exam-question-counter-as-an-argument%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Welcome to TeX.SE!
– Kurt
49 mins ago