How to define environments for questions and answers
up vote
13
down vote
favorite
I wish to do a simple question and answer sheet for my students. I'd like to have something like this:
section{Differential Equations}
begin{questions}
begin{question}
... Question here ...
end{question}
begin{answer}
... Answer here ...
end{answer}
end{questions}
I wish to have the environment QUESTIONS to have counters like enumerate. That is, each begin{question} ... end{question}
should behave just like item
in
begin{question}
item
end{question}
The begin{question} ... end{question}
environment should take "normal" LaTeX commands.
If possible, I'd wish to have deferred printing to print the answers at the end of the document.
I first tried this
makeatletter
newtoksanswerscollect
newcounter{question}
setcounter{question}{0}
defthequestion{{bfseries{Question arabic{question}. }}\}
defanswer#1{%
protected@edefanswertmp{%
theanswerscollectvspace{.5baselineskip}noindentthequestion#1par}%
paranswerscollect=expandafter{answertmp}}
defprintanswers{theanswerscollectanswerscollect={}}
definitbox{answerscollect={parnoindent Answers:par}}
newcommand{question}[1]{stepcounter{question}parnoindentthequestion#1}
makeatother
but it's not behaving the way I'd love the results to be ...
lists environments
|
show 3 more comments
up vote
13
down vote
favorite
I wish to do a simple question and answer sheet for my students. I'd like to have something like this:
section{Differential Equations}
begin{questions}
begin{question}
... Question here ...
end{question}
begin{answer}
... Answer here ...
end{answer}
end{questions}
I wish to have the environment QUESTIONS to have counters like enumerate. That is, each begin{question} ... end{question}
should behave just like item
in
begin{question}
item
end{question}
The begin{question} ... end{question}
environment should take "normal" LaTeX commands.
If possible, I'd wish to have deferred printing to print the answers at the end of the document.
I first tried this
makeatletter
newtoksanswerscollect
newcounter{question}
setcounter{question}{0}
defthequestion{{bfseries{Question arabic{question}. }}\}
defanswer#1{%
protected@edefanswertmp{%
theanswerscollectvspace{.5baselineskip}noindentthequestion#1par}%
paranswerscollect=expandafter{answertmp}}
defprintanswers{theanswerscollectanswerscollect={}}
definitbox{answerscollect={parnoindent Answers:par}}
newcommand{question}[1]{stepcounter{question}parnoindentthequestion#1}
makeatother
but it's not behaving the way I'd love the results to be ...
lists environments
Welcome to TeX.SX. Usually, we don't put a greeting or a "thank you" in our posts. While this might seem strange at first, it is not a sign of lack of politeness, but rather part of our trying to keep everything very concise. Accepting and upvoting answers is the preferred way here to say "thank you" to users who helped you.
– Claudio Fiandrino
Apr 12 '13 at 12:52
4
Have you looked at the exam package? ctan.org/tex-archive/macros/latex/contrib/exam I guess the packageanswers
too ctan.uib.no/macros/latex/contrib/answers/answers.pdf
– N3buchadnezzar
Apr 12 '13 at 12:53
@N3buchadnezzar I have tried a number of existing packages. They are cool, but do not actually give me the flexibility to do what I want!
– Dorogz
Apr 12 '13 at 13:10
3
I do not see anything in your question, making theanswers
package not valid. Please state what this package is missing =)
– N3buchadnezzar
Apr 12 '13 at 13:14
@N3buchadnezzar, I've looked at them and they are awkward to use. No lack of flexibility, mind you. But then again, I really don't see a simple(r) way to express the rather complex documents to be created... unless you leave the cozy LaTeX world and build a database with questions and answers, and splice the exam together from the result of a query.
– vonbrand
Apr 12 '13 at 13:49
|
show 3 more comments
up vote
13
down vote
favorite
up vote
13
down vote
favorite
I wish to do a simple question and answer sheet for my students. I'd like to have something like this:
section{Differential Equations}
begin{questions}
begin{question}
... Question here ...
end{question}
begin{answer}
... Answer here ...
end{answer}
end{questions}
I wish to have the environment QUESTIONS to have counters like enumerate. That is, each begin{question} ... end{question}
should behave just like item
in
begin{question}
item
end{question}
The begin{question} ... end{question}
environment should take "normal" LaTeX commands.
If possible, I'd wish to have deferred printing to print the answers at the end of the document.
I first tried this
makeatletter
newtoksanswerscollect
newcounter{question}
setcounter{question}{0}
defthequestion{{bfseries{Question arabic{question}. }}\}
defanswer#1{%
protected@edefanswertmp{%
theanswerscollectvspace{.5baselineskip}noindentthequestion#1par}%
paranswerscollect=expandafter{answertmp}}
defprintanswers{theanswerscollectanswerscollect={}}
definitbox{answerscollect={parnoindent Answers:par}}
newcommand{question}[1]{stepcounter{question}parnoindentthequestion#1}
makeatother
but it's not behaving the way I'd love the results to be ...
lists environments
I wish to do a simple question and answer sheet for my students. I'd like to have something like this:
section{Differential Equations}
begin{questions}
begin{question}
... Question here ...
end{question}
begin{answer}
... Answer here ...
end{answer}
end{questions}
I wish to have the environment QUESTIONS to have counters like enumerate. That is, each begin{question} ... end{question}
should behave just like item
in
begin{question}
item
end{question}
The begin{question} ... end{question}
environment should take "normal" LaTeX commands.
If possible, I'd wish to have deferred printing to print the answers at the end of the document.
I first tried this
makeatletter
newtoksanswerscollect
newcounter{question}
setcounter{question}{0}
defthequestion{{bfseries{Question arabic{question}. }}\}
defanswer#1{%
protected@edefanswertmp{%
theanswerscollectvspace{.5baselineskip}noindentthequestion#1par}%
paranswerscollect=expandafter{answertmp}}
defprintanswers{theanswerscollectanswerscollect={}}
definitbox{answerscollect={parnoindent Answers:par}}
newcommand{question}[1]{stepcounter{question}parnoindentthequestion#1}
makeatother
but it's not behaving the way I'd love the results to be ...
lists environments
lists environments
edited Apr 12 '13 at 12:51
Claudio Fiandrino
52k11152303
52k11152303
asked Apr 12 '13 at 12:50
Dorogz
73116
73116
Welcome to TeX.SX. Usually, we don't put a greeting or a "thank you" in our posts. While this might seem strange at first, it is not a sign of lack of politeness, but rather part of our trying to keep everything very concise. Accepting and upvoting answers is the preferred way here to say "thank you" to users who helped you.
– Claudio Fiandrino
Apr 12 '13 at 12:52
4
Have you looked at the exam package? ctan.org/tex-archive/macros/latex/contrib/exam I guess the packageanswers
too ctan.uib.no/macros/latex/contrib/answers/answers.pdf
– N3buchadnezzar
Apr 12 '13 at 12:53
@N3buchadnezzar I have tried a number of existing packages. They are cool, but do not actually give me the flexibility to do what I want!
– Dorogz
Apr 12 '13 at 13:10
3
I do not see anything in your question, making theanswers
package not valid. Please state what this package is missing =)
– N3buchadnezzar
Apr 12 '13 at 13:14
@N3buchadnezzar, I've looked at them and they are awkward to use. No lack of flexibility, mind you. But then again, I really don't see a simple(r) way to express the rather complex documents to be created... unless you leave the cozy LaTeX world and build a database with questions and answers, and splice the exam together from the result of a query.
– vonbrand
Apr 12 '13 at 13:49
|
show 3 more comments
Welcome to TeX.SX. Usually, we don't put a greeting or a "thank you" in our posts. While this might seem strange at first, it is not a sign of lack of politeness, but rather part of our trying to keep everything very concise. Accepting and upvoting answers is the preferred way here to say "thank you" to users who helped you.
– Claudio Fiandrino
Apr 12 '13 at 12:52
4
Have you looked at the exam package? ctan.org/tex-archive/macros/latex/contrib/exam I guess the packageanswers
too ctan.uib.no/macros/latex/contrib/answers/answers.pdf
– N3buchadnezzar
Apr 12 '13 at 12:53
@N3buchadnezzar I have tried a number of existing packages. They are cool, but do not actually give me the flexibility to do what I want!
– Dorogz
Apr 12 '13 at 13:10
3
I do not see anything in your question, making theanswers
package not valid. Please state what this package is missing =)
– N3buchadnezzar
Apr 12 '13 at 13:14
@N3buchadnezzar, I've looked at them and they are awkward to use. No lack of flexibility, mind you. But then again, I really don't see a simple(r) way to express the rather complex documents to be created... unless you leave the cozy LaTeX world and build a database with questions and answers, and splice the exam together from the result of a query.
– vonbrand
Apr 12 '13 at 13:49
Welcome to TeX.SX. Usually, we don't put a greeting or a "thank you" in our posts. While this might seem strange at first, it is not a sign of lack of politeness, but rather part of our trying to keep everything very concise. Accepting and upvoting answers is the preferred way here to say "thank you" to users who helped you.
– Claudio Fiandrino
Apr 12 '13 at 12:52
Welcome to TeX.SX. Usually, we don't put a greeting or a "thank you" in our posts. While this might seem strange at first, it is not a sign of lack of politeness, but rather part of our trying to keep everything very concise. Accepting and upvoting answers is the preferred way here to say "thank you" to users who helped you.
– Claudio Fiandrino
Apr 12 '13 at 12:52
4
4
Have you looked at the exam package? ctan.org/tex-archive/macros/latex/contrib/exam I guess the package
answers
too ctan.uib.no/macros/latex/contrib/answers/answers.pdf– N3buchadnezzar
Apr 12 '13 at 12:53
Have you looked at the exam package? ctan.org/tex-archive/macros/latex/contrib/exam I guess the package
answers
too ctan.uib.no/macros/latex/contrib/answers/answers.pdf– N3buchadnezzar
Apr 12 '13 at 12:53
@N3buchadnezzar I have tried a number of existing packages. They are cool, but do not actually give me the flexibility to do what I want!
– Dorogz
Apr 12 '13 at 13:10
@N3buchadnezzar I have tried a number of existing packages. They are cool, but do not actually give me the flexibility to do what I want!
– Dorogz
Apr 12 '13 at 13:10
3
3
I do not see anything in your question, making the
answers
package not valid. Please state what this package is missing =)– N3buchadnezzar
Apr 12 '13 at 13:14
I do not see anything in your question, making the
answers
package not valid. Please state what this package is missing =)– N3buchadnezzar
Apr 12 '13 at 13:14
@N3buchadnezzar, I've looked at them and they are awkward to use. No lack of flexibility, mind you. But then again, I really don't see a simple(r) way to express the rather complex documents to be created... unless you leave the cozy LaTeX world and build a database with questions and answers, and splice the exam together from the result of a query.
– vonbrand
Apr 12 '13 at 13:49
@N3buchadnezzar, I've looked at them and they are awkward to use. No lack of flexibility, mind you. But then again, I really don't see a simple(r) way to express the rather complex documents to be created... unless you leave the cozy LaTeX world and build a database with questions and answers, and splice the exam together from the result of a query.
– vonbrand
Apr 12 '13 at 13:49
|
show 3 more comments
2 Answers
2
active
oldest
votes
up vote
14
down vote
accepted
Simple use of exam
package :
documentclass{exam}
%printanswers
begin{document}
section{Differential Equations}
begin{questions}
question ... Short question here ... answerline[Short answer]
question ... Question here ...
begin{solution}[.2in]
... Answer here ...
end{solution}
question Long descriptive question about everything
begin{solutionorlines}[2in]
Long descriptive answer is a long descriptive answer that is a long descriptive answer that is along descriptive answer that is along descriptive answer that is along descriptive answer that is a lie.
end{solutionorlines}
question Draw an arrow showing north direction.
begin{solutionorbox}[2in]
$uparrow$
end{solutionorbox}
end{questions}
ifprintanswers
Stuff to appear only when answers textbf{are} being printed.
else
Stuff to appear only when answers textbf{are not} being printed.
fi
end{document}
Commenting and uncommenting printanswers
yields in one of two following:
1)
2)
I don't see any lack of functionality compared to your example.
1
At my department, we took exam.cls as a foundation for our own examination class, so that the cover page would always look the same, and it works very well. It is very flexible.
– Benjamin McKay
Oct 21 '13 at 15:20
add a comment |
up vote
0
down vote
I am using begin{questions}...end{questions}. Output is like Q.1) Q.2) ...
I just want it like 1) 2) ... How to modify my code? Since I want to droppoints I need to use this question segment itself. So someone help me.
New contributor
add a comment |
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
14
down vote
accepted
Simple use of exam
package :
documentclass{exam}
%printanswers
begin{document}
section{Differential Equations}
begin{questions}
question ... Short question here ... answerline[Short answer]
question ... Question here ...
begin{solution}[.2in]
... Answer here ...
end{solution}
question Long descriptive question about everything
begin{solutionorlines}[2in]
Long descriptive answer is a long descriptive answer that is a long descriptive answer that is along descriptive answer that is along descriptive answer that is along descriptive answer that is a lie.
end{solutionorlines}
question Draw an arrow showing north direction.
begin{solutionorbox}[2in]
$uparrow$
end{solutionorbox}
end{questions}
ifprintanswers
Stuff to appear only when answers textbf{are} being printed.
else
Stuff to appear only when answers textbf{are not} being printed.
fi
end{document}
Commenting and uncommenting printanswers
yields in one of two following:
1)
2)
I don't see any lack of functionality compared to your example.
1
At my department, we took exam.cls as a foundation for our own examination class, so that the cover page would always look the same, and it works very well. It is very flexible.
– Benjamin McKay
Oct 21 '13 at 15:20
add a comment |
up vote
14
down vote
accepted
Simple use of exam
package :
documentclass{exam}
%printanswers
begin{document}
section{Differential Equations}
begin{questions}
question ... Short question here ... answerline[Short answer]
question ... Question here ...
begin{solution}[.2in]
... Answer here ...
end{solution}
question Long descriptive question about everything
begin{solutionorlines}[2in]
Long descriptive answer is a long descriptive answer that is a long descriptive answer that is along descriptive answer that is along descriptive answer that is along descriptive answer that is a lie.
end{solutionorlines}
question Draw an arrow showing north direction.
begin{solutionorbox}[2in]
$uparrow$
end{solutionorbox}
end{questions}
ifprintanswers
Stuff to appear only when answers textbf{are} being printed.
else
Stuff to appear only when answers textbf{are not} being printed.
fi
end{document}
Commenting and uncommenting printanswers
yields in one of two following:
1)
2)
I don't see any lack of functionality compared to your example.
1
At my department, we took exam.cls as a foundation for our own examination class, so that the cover page would always look the same, and it works very well. It is very flexible.
– Benjamin McKay
Oct 21 '13 at 15:20
add a comment |
up vote
14
down vote
accepted
up vote
14
down vote
accepted
Simple use of exam
package :
documentclass{exam}
%printanswers
begin{document}
section{Differential Equations}
begin{questions}
question ... Short question here ... answerline[Short answer]
question ... Question here ...
begin{solution}[.2in]
... Answer here ...
end{solution}
question Long descriptive question about everything
begin{solutionorlines}[2in]
Long descriptive answer is a long descriptive answer that is a long descriptive answer that is along descriptive answer that is along descriptive answer that is along descriptive answer that is a lie.
end{solutionorlines}
question Draw an arrow showing north direction.
begin{solutionorbox}[2in]
$uparrow$
end{solutionorbox}
end{questions}
ifprintanswers
Stuff to appear only when answers textbf{are} being printed.
else
Stuff to appear only when answers textbf{are not} being printed.
fi
end{document}
Commenting and uncommenting printanswers
yields in one of two following:
1)
2)
I don't see any lack of functionality compared to your example.
Simple use of exam
package :
documentclass{exam}
%printanswers
begin{document}
section{Differential Equations}
begin{questions}
question ... Short question here ... answerline[Short answer]
question ... Question here ...
begin{solution}[.2in]
... Answer here ...
end{solution}
question Long descriptive question about everything
begin{solutionorlines}[2in]
Long descriptive answer is a long descriptive answer that is a long descriptive answer that is along descriptive answer that is along descriptive answer that is along descriptive answer that is a lie.
end{solutionorlines}
question Draw an arrow showing north direction.
begin{solutionorbox}[2in]
$uparrow$
end{solutionorbox}
end{questions}
ifprintanswers
Stuff to appear only when answers textbf{are} being printed.
else
Stuff to appear only when answers textbf{are not} being printed.
fi
end{document}
Commenting and uncommenting printanswers
yields in one of two following:
1)
2)
I don't see any lack of functionality compared to your example.
edited Jan 10 '14 at 8:59
answered Oct 21 '13 at 14:56
Vairis
641720
641720
1
At my department, we took exam.cls as a foundation for our own examination class, so that the cover page would always look the same, and it works very well. It is very flexible.
– Benjamin McKay
Oct 21 '13 at 15:20
add a comment |
1
At my department, we took exam.cls as a foundation for our own examination class, so that the cover page would always look the same, and it works very well. It is very flexible.
– Benjamin McKay
Oct 21 '13 at 15:20
1
1
At my department, we took exam.cls as a foundation for our own examination class, so that the cover page would always look the same, and it works very well. It is very flexible.
– Benjamin McKay
Oct 21 '13 at 15:20
At my department, we took exam.cls as a foundation for our own examination class, so that the cover page would always look the same, and it works very well. It is very flexible.
– Benjamin McKay
Oct 21 '13 at 15:20
add a comment |
up vote
0
down vote
I am using begin{questions}...end{questions}. Output is like Q.1) Q.2) ...
I just want it like 1) 2) ... How to modify my code? Since I want to droppoints I need to use this question segment itself. So someone help me.
New contributor
add a comment |
up vote
0
down vote
I am using begin{questions}...end{questions}. Output is like Q.1) Q.2) ...
I just want it like 1) 2) ... How to modify my code? Since I want to droppoints I need to use this question segment itself. So someone help me.
New contributor
add a comment |
up vote
0
down vote
up vote
0
down vote
I am using begin{questions}...end{questions}. Output is like Q.1) Q.2) ...
I just want it like 1) 2) ... How to modify my code? Since I want to droppoints I need to use this question segment itself. So someone help me.
New contributor
I am using begin{questions}...end{questions}. Output is like Q.1) Q.2) ...
I just want it like 1) 2) ... How to modify my code? Since I want to droppoints I need to use this question segment itself. So someone help me.
New contributor
New contributor
answered 17 mins ago
Thasheela
1
1
New contributor
New contributor
add a comment |
add a comment |
Thanks for contributing an answer to TeX - LaTeX Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
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%2f108316%2fhow-to-define-environments-for-questions-and-answers%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.SX. Usually, we don't put a greeting or a "thank you" in our posts. While this might seem strange at first, it is not a sign of lack of politeness, but rather part of our trying to keep everything very concise. Accepting and upvoting answers is the preferred way here to say "thank you" to users who helped you.
– Claudio Fiandrino
Apr 12 '13 at 12:52
4
Have you looked at the exam package? ctan.org/tex-archive/macros/latex/contrib/exam I guess the package
answers
too ctan.uib.no/macros/latex/contrib/answers/answers.pdf– N3buchadnezzar
Apr 12 '13 at 12:53
@N3buchadnezzar I have tried a number of existing packages. They are cool, but do not actually give me the flexibility to do what I want!
– Dorogz
Apr 12 '13 at 13:10
3
I do not see anything in your question, making the
answers
package not valid. Please state what this package is missing =)– N3buchadnezzar
Apr 12 '13 at 13:14
@N3buchadnezzar, I've looked at them and they are awkward to use. No lack of flexibility, mind you. But then again, I really don't see a simple(r) way to express the rather complex documents to be created... unless you leave the cozy LaTeX world and build a database with questions and answers, and splice the exam together from the result of a query.
– vonbrand
Apr 12 '13 at 13:49