Package mcexam random question from file
It has a file of multiple choice questions with 50 questions that wanted to generate evaluations with different questions, for each evaluation limit the number by 10 questions, generating 5 files with different questions.
documentclass[a4paper]{article}
usepackage[output=exam
,numberofversions=4
,version=1
,seed=1
,randomizequestions=true
,randomizeanswers=true
,writeRfile=false
]{mcexam}
% Packages used for special things
usepackage{tikz,framed}
usepackage{fancyhdr,lastpage,totcount,xpatch}
usepackage{calc}
% Set headers and footers
pagestyle{fancy}
fancyhf{}
renewcommand{headrulewidth}{0pt}
renewcommand{footrulewidth}{1pt}
lfoot{mctheversion}
rfoot{Page thepage of pageref{LastPage}}
% Ensure each question+answers is printed entirely on the same page.
renewenvironment{setmcquestion}
{begin{minipage}[t]{linewidth-labelwidth}}
{end{minipage}par}
newtoggle{questionscounted}
globaltogglefalse{questionscounted}
makeatletter
newcommand{patch@mcquestions}{%
iftoggle{questionscounted}
{}
{%
setcounter{numquestions}{value{mc@counter}}%
globaltoggletrue{questionscounted}
}%
}
newcounter{numquestions}
regtotcounter{numquestions}
xpatchcmd{env@mcquestions@process}
{mc@setQuestionAndAnswerNumbers}
{mc@setQuestionAndAnswerNumberspatch@mcquestions}
{}{}
makeatother
begin{document}
begin{center}
bfseriesLARGE Midterm Exam
end{center}
begin{framed}
centeringbfseriesLargeMakeUppercase{mctheversion}
end{framed}
mcifoutput{concept,exam}{
bigskip
noindent Name: dotfill\[.5baselineskip]
noindent Student Number: dotfill\[.5baselineskip]
noindent Program: dotfill
vspace{2baselineskip}
noindenttextbf{Instructions:}
begin{itemize}[nosep]
item This exam has total{numquestions} questions. %THIS THROWS AN UNDEFINED CONTROL SEQUENCE ERROR
end{itemize}
}
begin{mcquestions}
question What is the color of the sky?
begin{mcanswerslist}[fixlast]
answer[correct] blue
answer green
answer red
answer yellow
answer none of the above
end{mcanswerslist}
begin{mcexplanation}
If you look up to the sky and there are no clouds, you'll see it is blue.
end{mcexplanation}
begin{mcnotes}
This question had a large proportion of good answers last year.
end{mcnotes}
question Which figure is a square?
begin{mcanswers}
begin{tabular}{@{}cccc}
answer{1}{tikz{draw (-0.66,0)--(0.66,0)--(0,1)--cycle;}}&
answer{2}{tikz{draw (0,0)--(2,0)--(2,1)--(0,1)--cycle;}}&
answer[correct]{3}{tikz{draw (0,0)--(1,0)--(1,1)--(0,1)--cycle;}}&
answer{4}{tikz{draw (0,0) circle[radius=0.5];}}\
answernum{1}&answernum{2}&answernum{3}&answernum{4}\
end{tabular}
end{mcanswers}
end{mcquestions}
end{document}
mcexam
add a comment |
It has a file of multiple choice questions with 50 questions that wanted to generate evaluations with different questions, for each evaluation limit the number by 10 questions, generating 5 files with different questions.
documentclass[a4paper]{article}
usepackage[output=exam
,numberofversions=4
,version=1
,seed=1
,randomizequestions=true
,randomizeanswers=true
,writeRfile=false
]{mcexam}
% Packages used for special things
usepackage{tikz,framed}
usepackage{fancyhdr,lastpage,totcount,xpatch}
usepackage{calc}
% Set headers and footers
pagestyle{fancy}
fancyhf{}
renewcommand{headrulewidth}{0pt}
renewcommand{footrulewidth}{1pt}
lfoot{mctheversion}
rfoot{Page thepage of pageref{LastPage}}
% Ensure each question+answers is printed entirely on the same page.
renewenvironment{setmcquestion}
{begin{minipage}[t]{linewidth-labelwidth}}
{end{minipage}par}
newtoggle{questionscounted}
globaltogglefalse{questionscounted}
makeatletter
newcommand{patch@mcquestions}{%
iftoggle{questionscounted}
{}
{%
setcounter{numquestions}{value{mc@counter}}%
globaltoggletrue{questionscounted}
}%
}
newcounter{numquestions}
regtotcounter{numquestions}
xpatchcmd{env@mcquestions@process}
{mc@setQuestionAndAnswerNumbers}
{mc@setQuestionAndAnswerNumberspatch@mcquestions}
{}{}
makeatother
begin{document}
begin{center}
bfseriesLARGE Midterm Exam
end{center}
begin{framed}
centeringbfseriesLargeMakeUppercase{mctheversion}
end{framed}
mcifoutput{concept,exam}{
bigskip
noindent Name: dotfill\[.5baselineskip]
noindent Student Number: dotfill\[.5baselineskip]
noindent Program: dotfill
vspace{2baselineskip}
noindenttextbf{Instructions:}
begin{itemize}[nosep]
item This exam has total{numquestions} questions. %THIS THROWS AN UNDEFINED CONTROL SEQUENCE ERROR
end{itemize}
}
begin{mcquestions}
question What is the color of the sky?
begin{mcanswerslist}[fixlast]
answer[correct] blue
answer green
answer red
answer yellow
answer none of the above
end{mcanswerslist}
begin{mcexplanation}
If you look up to the sky and there are no clouds, you'll see it is blue.
end{mcexplanation}
begin{mcnotes}
This question had a large proportion of good answers last year.
end{mcnotes}
question Which figure is a square?
begin{mcanswers}
begin{tabular}{@{}cccc}
answer{1}{tikz{draw (-0.66,0)--(0.66,0)--(0,1)--cycle;}}&
answer{2}{tikz{draw (0,0)--(2,0)--(2,1)--(0,1)--cycle;}}&
answer[correct]{3}{tikz{draw (0,0)--(1,0)--(1,1)--(0,1)--cycle;}}&
answer{4}{tikz{draw (0,0) circle[radius=0.5];}}\
answernum{1}&answernum{2}&answernum{3}&answernum{4}\
end{tabular}
end{mcanswers}
end{mcquestions}
end{document}
mcexam
It looks like you've got two separate accounts, which means you cannot edit your original post or leave comments. The Stack Exchange staff can merge them together for you.
– Kurt
3 hours ago
@Kurt i am guess merge all accounts now. Thanks for observation
– Fabio Lima
2 hours ago
By my fileforeach i in {1,...,10}{ newpage setkeys{mcexam.sty}{version=i,seed=123} begin{mcquestions} input{../path1/file1} input{../path2/file2} end{mcquestions}
} Have error compilation used this mode.
– Fabio Lima
2 hours ago
Your given code in your question compiles without problems with current MiKTeX 2.9 ... Can you please add the complete error message you get and make sure the given code in your questions results in your error please.
– Kurt
2 hours ago
add a comment |
It has a file of multiple choice questions with 50 questions that wanted to generate evaluations with different questions, for each evaluation limit the number by 10 questions, generating 5 files with different questions.
documentclass[a4paper]{article}
usepackage[output=exam
,numberofversions=4
,version=1
,seed=1
,randomizequestions=true
,randomizeanswers=true
,writeRfile=false
]{mcexam}
% Packages used for special things
usepackage{tikz,framed}
usepackage{fancyhdr,lastpage,totcount,xpatch}
usepackage{calc}
% Set headers and footers
pagestyle{fancy}
fancyhf{}
renewcommand{headrulewidth}{0pt}
renewcommand{footrulewidth}{1pt}
lfoot{mctheversion}
rfoot{Page thepage of pageref{LastPage}}
% Ensure each question+answers is printed entirely on the same page.
renewenvironment{setmcquestion}
{begin{minipage}[t]{linewidth-labelwidth}}
{end{minipage}par}
newtoggle{questionscounted}
globaltogglefalse{questionscounted}
makeatletter
newcommand{patch@mcquestions}{%
iftoggle{questionscounted}
{}
{%
setcounter{numquestions}{value{mc@counter}}%
globaltoggletrue{questionscounted}
}%
}
newcounter{numquestions}
regtotcounter{numquestions}
xpatchcmd{env@mcquestions@process}
{mc@setQuestionAndAnswerNumbers}
{mc@setQuestionAndAnswerNumberspatch@mcquestions}
{}{}
makeatother
begin{document}
begin{center}
bfseriesLARGE Midterm Exam
end{center}
begin{framed}
centeringbfseriesLargeMakeUppercase{mctheversion}
end{framed}
mcifoutput{concept,exam}{
bigskip
noindent Name: dotfill\[.5baselineskip]
noindent Student Number: dotfill\[.5baselineskip]
noindent Program: dotfill
vspace{2baselineskip}
noindenttextbf{Instructions:}
begin{itemize}[nosep]
item This exam has total{numquestions} questions. %THIS THROWS AN UNDEFINED CONTROL SEQUENCE ERROR
end{itemize}
}
begin{mcquestions}
question What is the color of the sky?
begin{mcanswerslist}[fixlast]
answer[correct] blue
answer green
answer red
answer yellow
answer none of the above
end{mcanswerslist}
begin{mcexplanation}
If you look up to the sky and there are no clouds, you'll see it is blue.
end{mcexplanation}
begin{mcnotes}
This question had a large proportion of good answers last year.
end{mcnotes}
question Which figure is a square?
begin{mcanswers}
begin{tabular}{@{}cccc}
answer{1}{tikz{draw (-0.66,0)--(0.66,0)--(0,1)--cycle;}}&
answer{2}{tikz{draw (0,0)--(2,0)--(2,1)--(0,1)--cycle;}}&
answer[correct]{3}{tikz{draw (0,0)--(1,0)--(1,1)--(0,1)--cycle;}}&
answer{4}{tikz{draw (0,0) circle[radius=0.5];}}\
answernum{1}&answernum{2}&answernum{3}&answernum{4}\
end{tabular}
end{mcanswers}
end{mcquestions}
end{document}
mcexam
It has a file of multiple choice questions with 50 questions that wanted to generate evaluations with different questions, for each evaluation limit the number by 10 questions, generating 5 files with different questions.
documentclass[a4paper]{article}
usepackage[output=exam
,numberofversions=4
,version=1
,seed=1
,randomizequestions=true
,randomizeanswers=true
,writeRfile=false
]{mcexam}
% Packages used for special things
usepackage{tikz,framed}
usepackage{fancyhdr,lastpage,totcount,xpatch}
usepackage{calc}
% Set headers and footers
pagestyle{fancy}
fancyhf{}
renewcommand{headrulewidth}{0pt}
renewcommand{footrulewidth}{1pt}
lfoot{mctheversion}
rfoot{Page thepage of pageref{LastPage}}
% Ensure each question+answers is printed entirely on the same page.
renewenvironment{setmcquestion}
{begin{minipage}[t]{linewidth-labelwidth}}
{end{minipage}par}
newtoggle{questionscounted}
globaltogglefalse{questionscounted}
makeatletter
newcommand{patch@mcquestions}{%
iftoggle{questionscounted}
{}
{%
setcounter{numquestions}{value{mc@counter}}%
globaltoggletrue{questionscounted}
}%
}
newcounter{numquestions}
regtotcounter{numquestions}
xpatchcmd{env@mcquestions@process}
{mc@setQuestionAndAnswerNumbers}
{mc@setQuestionAndAnswerNumberspatch@mcquestions}
{}{}
makeatother
begin{document}
begin{center}
bfseriesLARGE Midterm Exam
end{center}
begin{framed}
centeringbfseriesLargeMakeUppercase{mctheversion}
end{framed}
mcifoutput{concept,exam}{
bigskip
noindent Name: dotfill\[.5baselineskip]
noindent Student Number: dotfill\[.5baselineskip]
noindent Program: dotfill
vspace{2baselineskip}
noindenttextbf{Instructions:}
begin{itemize}[nosep]
item This exam has total{numquestions} questions. %THIS THROWS AN UNDEFINED CONTROL SEQUENCE ERROR
end{itemize}
}
begin{mcquestions}
question What is the color of the sky?
begin{mcanswerslist}[fixlast]
answer[correct] blue
answer green
answer red
answer yellow
answer none of the above
end{mcanswerslist}
begin{mcexplanation}
If you look up to the sky and there are no clouds, you'll see it is blue.
end{mcexplanation}
begin{mcnotes}
This question had a large proportion of good answers last year.
end{mcnotes}
question Which figure is a square?
begin{mcanswers}
begin{tabular}{@{}cccc}
answer{1}{tikz{draw (-0.66,0)--(0.66,0)--(0,1)--cycle;}}&
answer{2}{tikz{draw (0,0)--(2,0)--(2,1)--(0,1)--cycle;}}&
answer[correct]{3}{tikz{draw (0,0)--(1,0)--(1,1)--(0,1)--cycle;}}&
answer{4}{tikz{draw (0,0) circle[radius=0.5];}}\
answernum{1}&answernum{2}&answernum{3}&answernum{4}\
end{tabular}
end{mcanswers}
end{mcquestions}
end{document}
mcexam
mcexam
edited 7 mins ago
Fabio Lima
133
133
asked 9 hours ago
Fabio LimaFabio Lima
485
485
It looks like you've got two separate accounts, which means you cannot edit your original post or leave comments. The Stack Exchange staff can merge them together for you.
– Kurt
3 hours ago
@Kurt i am guess merge all accounts now. Thanks for observation
– Fabio Lima
2 hours ago
By my fileforeach i in {1,...,10}{ newpage setkeys{mcexam.sty}{version=i,seed=123} begin{mcquestions} input{../path1/file1} input{../path2/file2} end{mcquestions}
} Have error compilation used this mode.
– Fabio Lima
2 hours ago
Your given code in your question compiles without problems with current MiKTeX 2.9 ... Can you please add the complete error message you get and make sure the given code in your questions results in your error please.
– Kurt
2 hours ago
add a comment |
It looks like you've got two separate accounts, which means you cannot edit your original post or leave comments. The Stack Exchange staff can merge them together for you.
– Kurt
3 hours ago
@Kurt i am guess merge all accounts now. Thanks for observation
– Fabio Lima
2 hours ago
By my fileforeach i in {1,...,10}{ newpage setkeys{mcexam.sty}{version=i,seed=123} begin{mcquestions} input{../path1/file1} input{../path2/file2} end{mcquestions}
} Have error compilation used this mode.
– Fabio Lima
2 hours ago
Your given code in your question compiles without problems with current MiKTeX 2.9 ... Can you please add the complete error message you get and make sure the given code in your questions results in your error please.
– Kurt
2 hours ago
It looks like you've got two separate accounts, which means you cannot edit your original post or leave comments. The Stack Exchange staff can merge them together for you.
– Kurt
3 hours ago
It looks like you've got two separate accounts, which means you cannot edit your original post or leave comments. The Stack Exchange staff can merge them together for you.
– Kurt
3 hours ago
@Kurt i am guess merge all accounts now. Thanks for observation
– Fabio Lima
2 hours ago
@Kurt i am guess merge all accounts now. Thanks for observation
– Fabio Lima
2 hours ago
By my file
foreach i in {1,...,10}{ newpage setkeys{mcexam.sty}{version=i,seed=123} begin{mcquestions} input{../path1/file1} input{../path2/file2} end{mcquestions}
} Have error compilation used this mode.– Fabio Lima
2 hours ago
By my file
foreach i in {1,...,10}{ newpage setkeys{mcexam.sty}{version=i,seed=123} begin{mcquestions} input{../path1/file1} input{../path2/file2} end{mcquestions}
} Have error compilation used this mode.– Fabio Lima
2 hours ago
Your given code in your question compiles without problems with current MiKTeX 2.9 ... Can you please add the complete error message you get and make sure the given code in your questions results in your error please.
– Kurt
2 hours ago
Your given code in your question compiles without problems with current MiKTeX 2.9 ... Can you please add the complete error message you get and make sure the given code in your questions results in your error please.
– Kurt
2 hours ago
add a comment |
0
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',
autoActivateHeartbeat: false,
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
});
}
});
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%2f482307%2fpackage-mcexam-random-question-from-file%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
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.
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%2f482307%2fpackage-mcexam-random-question-from-file%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
It looks like you've got two separate accounts, which means you cannot edit your original post or leave comments. The Stack Exchange staff can merge them together for you.
– Kurt
3 hours ago
@Kurt i am guess merge all accounts now. Thanks for observation
– Fabio Lima
2 hours ago
By my file
foreach i in {1,...,10}{ newpage setkeys{mcexam.sty}{version=i,seed=123} begin{mcquestions} input{../path1/file1} input{../path2/file2} end{mcquestions}
} Have error compilation used this mode.– Fabio Lima
2 hours ago
Your given code in your question compiles without problems with current MiKTeX 2.9 ... Can you please add the complete error message you get and make sure the given code in your questions results in your error please.
– Kurt
2 hours ago