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}









share|improve this question









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















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}









share|improve this question









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













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}









share|improve this question









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






share|improve this question









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.











share|improve this question









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.









share|improve this question




share|improve this question








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


















  • Welcome to TeX.SE!
    – Kurt
    49 mins ago
















Welcome to TeX.SE!
– Kurt
49 mins ago




Welcome to TeX.SE!
– Kurt
49 mins ago















active

oldest

votes











Your Answer








StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "85"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});






AegisCruiser is a new contributor. Be nice, and check out our Code of Conduct.










 

draft saved


draft discarded


















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






























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.










 

draft saved


draft discarded


















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.















 


draft saved


draft discarded














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





















































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







Popular posts from this blog

Lallio

Unable to find Lightning Node

Futebolista