Title: | Generate LaTeX Code for Auto-Multiple-Choice (AMC) |
---|---|
Description: | Generate code for use with the Optical Mark Recognition free software Auto Multiple Choice (AMC). More specifically, this package provides functions that use as input the question and answer texts, and output the LaTeX code for AMC. |
Authors: | Nils Myszkowski |
Maintainer: | Nils Myszkowski <[email protected]> |
License: | GPL-3 |
Version: | 1.0.0 |
Built: | 2025-02-20 04:44:11 UTC |
Source: | https://github.com/nilsmy/amctestmaker |
Generate AMC LaTeX question group ("element") codes
AMCcreateelements(element = "general", shufflequestions = TRUE, sections = TRUE, output = "message", filepath = "elements.tex", append = FALSE, messages = TRUE)
AMCcreateelements(element = "general", shufflequestions = TRUE, sections = TRUE, output = "message", filepath = "elements.tex", append = FALSE, messages = TRUE)
element |
A character value or vector of question groups ("elements") to generate input code for. Default is "general". |
shufflequestions |
A logical value or vector to indicate whether to shuffle questions inside a question group. Defaults to TRUE. |
sections |
A character value or vector to indicate whether to create a new LaTeX section for each element (defaults to TRUE). |
output |
A character value to indicate how to output the LaTeX commands. Use "message" (default) to get a console message that can be directly copy-and-pasted to the LaTeX mais file. Use "list" to get a list object. Use "file" to output to a .tex file (the path can be changed with the "filepath" command). Defaults to "message |
filepath |
A character value with the file path for the .tex file to be created (defaults to "elements.tex"). |
append |
A logical value indicating if the code should be appended (append=TRUE) to an existing .tex file. Defaults to FALSE, thus overwriting the file. |
messages |
A logical to indicate whether instructions should be output (defaults to TRUE). |
Commands to add the question groups in AMC-LaTeX code.
#To output a message (not visible in documentation) AMCcreateelements(c(1:4)) #To output a list AMCcreateelements(c(1:4), output = "list") #Duplicates are automatically removed AMCcreateelements(rep(1:3, 5), output = "list") #To cancel shuffling AMCcreateelements(c(1:4), output = "list", shufflequestions = FALSE) #To remove sections at each element AMCcreateelements(c(1:4), sections = FALSE, output = "list") #To add sections for only last element AMCcreateelements(c(1:4), sections = c(FALSE,FALSE,FALSE,TRUE), output = "list")
#To output a message (not visible in documentation) AMCcreateelements(c(1:4)) #To output a list AMCcreateelements(c(1:4), output = "list") #Duplicates are automatically removed AMCcreateelements(rep(1:3, 5), output = "list") #To cancel shuffling AMCcreateelements(c(1:4), output = "list", shufflequestions = FALSE) #To remove sections at each element AMCcreateelements(c(1:4), sections = FALSE, output = "list") #To add sections for only last element AMCcreateelements(c(1:4), sections = c(FALSE,FALSE,FALSE,TRUE), output = "list")
Generate AMC LaTeX question codes in the console, in a LaTeX file, or as a vector.
AMCcreatequestions(question, correctanswers, incorrectanswers, element = "general", code = paste(codeprefix, c(1:length(question)), sep = ""), codeprefix = "Q", output = "message", filepath = "questions.tex", questiontype = "single", append = F, multicols = 2, messages = T, listelements = T, scoringcorrect = 1, scoringincorrect = 0, scoringnoresponse = 0, scoringincoherent = scoringincorrect, scoringbottom = scoringincorrect, shuffleanswersonce = T)
AMCcreatequestions(question, correctanswers, incorrectanswers, element = "general", code = paste(codeprefix, c(1:length(question)), sep = ""), codeprefix = "Q", output = "message", filepath = "questions.tex", questiontype = "single", append = F, multicols = 2, messages = T, listelements = T, scoringcorrect = 1, scoringincorrect = 0, scoringnoresponse = 0, scoringincoherent = scoringincorrect, scoringbottom = scoringincorrect, shuffleanswersonce = T)
question |
A character value or vector containing the questions. |
correctanswers |
A character (value, vector) containing the correct answer. A vector (or list) of character vectors can be passed, in the case of multiple correct answers. |
incorrectanswers |
A character (value, vector) containing the wrong answer. A vector (or list) of character vectors can be passed, in the case of multiple wrong answers. |
element |
A character value or vector to define the category of the entire set of questions (character value) or of each question (character vector). Defaults to "general. |
code |
A character value or vector to identify each question (note that AMC requires each code to be unique in a questionnaire). Defaults to "Q1", "Q2", "Q3", etc. (the prefix "Q" can be changed with the "codeprefix" argument). |
codeprefix |
A character value to be used to generate automatically question codes, when not provided with the "code" argument. |
output |
A character value to indicate what type of output is desired. "message" (default) outputs the questions as a message (suitable for direct copy-and-paste from console into LaTeX file). "file" outputs a questions .tex file (which can then be pointed to in the main LaTeX document). "list" and "vector" output a character vector of questions (suitable for further manipulation in R). |
filepath |
A character value with the file path for the .tex file to be created (defaults to "questions.tex"). |
questiontype |
A character value or vector to indicate the type of all questions (character value) or of each (character vector) question. Use "single" for single-choice, and "multiple" for multiple-answer. So far open questions are not supported. |
append |
A logical value indicating if the code should be appended (append=TRUE) to an existing .tex file. Defaults to FALSE, thus overwriting the file. |
multicols |
A numeric (or numeric vector) indicating the desired number of columns for the presentation of the correct and incorrect answers (note that the LaTeX environment multicols must be called in the main ".tex" document for more than 1 columns). Defaults to 1, which does not require the LaTeX multicols environnment. |
messages |
A logical to indicate whether instructions should be output (defaults to TRUE). |
listelements |
A logical to indicate whether instructions should be output (use the AMCcreateelements() function for more options). |
scoringcorrect |
A numeric value or vector to indicate the scoring for the correct answer(s). Defaults to 1. |
scoringincorrect |
A numeric value or vector to indicate the scoring for an incorrect answer(s). Defaults to 0. |
scoringnoresponse |
A numeric value or vector to indicate the scoring for non-responding. Defaults to 0. |
scoringincoherent |
A numeric value or vector to indicate the scoring for incoherent answer(s) (e.g. two boxes checked for a single-answer questionnaire). Defaults to 0. |
scoringbottom |
A numeric value or vector to indicate the minimum score for the question(s). Especially useful when attributing negative points to incorrect answers in a multiple-answer questionnaire, to ensure students do not lose too many points on one question. Defaults to 0. |
shuffleanswersonce |
A logical value to indicate whether to shuffle answers for each question directly in the LaTeX code (useful if the answers are not randomized by examinee by AMC). Defaults to TRUE. |
A character value or vector (output = "list" or "vector"), a copy-and-pastable message (output = "message") or a LaTeX .tex file (output = "file") containing AMC LaTeX code for questions and answers.
#Creating a single question AMCcreatequestions("How much is $1+1$?",2,list("3", "11")) #Presenting answers in multiple columns (LaTeX environment 'multicols' is used) AMCcreatequestions("How much is $1+1$?",2,list("3","11"),multicols = 2) #Creating an entire questionnaire from a dataset of questions ## Defining the questions (don't forget to escape R special characters) question <- c("How much is $1+1$ ?", "How much is $1 \\times 1$ ?", "How much is $\\frac{1}{2}$ ?") correct <- c(2,1,0.5) incorrect1 <- c(3,4,10) incorrect2 <- c(1,3,100) incorrect3 <- c(4,8,NA) #Empty values (NA and "") are skipped ## Generating the AMC LaTeX code AMCcreatequestions( question = question, correctanswers = correct, incorrectanswers = list(incorrect1,incorrect2,incorrect3)) #Changing the code prefix from "Q" to "MATH" AMCcreatequestions( question = question, correctanswers = correct, incorrectanswers = list(incorrect1,incorrect2,incorrect3), codeprefix = "MATH")
#Creating a single question AMCcreatequestions("How much is $1+1$?",2,list("3", "11")) #Presenting answers in multiple columns (LaTeX environment 'multicols' is used) AMCcreatequestions("How much is $1+1$?",2,list("3","11"),multicols = 2) #Creating an entire questionnaire from a dataset of questions ## Defining the questions (don't forget to escape R special characters) question <- c("How much is $1+1$ ?", "How much is $1 \\times 1$ ?", "How much is $\\frac{1}{2}$ ?") correct <- c(2,1,0.5) incorrect1 <- c(3,4,10) incorrect2 <- c(1,3,100) incorrect3 <- c(4,8,NA) #Empty values (NA and "") are skipped ## Generating the AMC LaTeX code AMCcreatequestions( question = question, correctanswers = correct, incorrectanswers = list(incorrect1,incorrect2,incorrect3)) #Changing the code prefix from "Q" to "MATH" AMCcreatequestions( question = question, correctanswers = correct, incorrectanswers = list(incorrect1,incorrect2,incorrect3), codeprefix = "MATH")
groups.tex
), a file for questions (questions.tex
), a file for elements (elements.tex
.Create a full Auto-Multiple-Choice test with a main .tex file (groups.tex
), a file for questions (questions.tex
), a file for elements (elements.tex
.
AMCcreatetest(question, correctanswers, incorrectanswers, element = "general", code = paste(codeprefix, c(1:length(question)), sep = ""), codeprefix = "Q", questiontype = "single", multicols = 2, scoringcorrect = 1, scoringincorrect = 0, scoringnoresponse = 0, scoringincoherent = scoringincorrect, scoringbottom = scoringincorrect, shufflequestions = T, shuffleanswers = T, shuffleanswersonce = T, sections = T, title = "Test", filepath = "source.tex", messages = T, fontsize = 10, instructions = T, paper = "letter", identifier = "Name", separateanswersheet = F, answersheettitle = "Answer sheet", answersheetinstructions = T, twosided = T, lettersinsidebox = F, box = T, facilitatemanualadd = T)
AMCcreatetest(question, correctanswers, incorrectanswers, element = "general", code = paste(codeprefix, c(1:length(question)), sep = ""), codeprefix = "Q", questiontype = "single", multicols = 2, scoringcorrect = 1, scoringincorrect = 0, scoringnoresponse = 0, scoringincoherent = scoringincorrect, scoringbottom = scoringincorrect, shufflequestions = T, shuffleanswers = T, shuffleanswersonce = T, sections = T, title = "Test", filepath = "source.tex", messages = T, fontsize = 10, instructions = T, paper = "letter", identifier = "Name", separateanswersheet = F, answersheettitle = "Answer sheet", answersheetinstructions = T, twosided = T, lettersinsidebox = F, box = T, facilitatemanualadd = T)
question |
A character value or vector containing the questions. |
correctanswers |
A character (value, vector) containing the correct answer. A vector (or list) of character vectors can also be passed, in the case of multiple correct answers. |
incorrectanswers |
A character (value, vector) containing the wrong answer. A vector (or list) of character vectors can also be passed, in the case of multiple wrong answers. |
element |
A character value or vector to define the category of the entire set of questions (character value) or of each question (character vector). Defaults to "general. |
code |
A character value or vector to identify each question (note that AMC requires each code to be unique in a questionnaire). Defaults to "Q1", "Q2", "Q3", etc. (the prefix "Q" can be changed with the "codeprefix" argument). |
codeprefix |
A character value to be used to generate automatically question codes, when not provided with the "code" argument. |
questiontype |
A character value or vector to indicate the type of all questions (character value) or of each (character vector) question. Use "single" for single-choice, and "multiple" for multiple-answer. So far open questions are not supported. |
multicols |
A numeric (or numeric vector) indicating the desired number of columns for the presentation of the correct and incorrect answers (note that the LaTeX environment multicols must be called in the main ".tex" document for more than 1 columns). Defaults to 1, which does not require the LaTeX multicols environnment. |
scoringcorrect |
A numeric value or vector to indicate the scoring for the correct answer(s). Defaults to 1. |
scoringincorrect |
A numeric value or vector to indicate the scoring for an incorrect answer(s). Defaults to 0. |
scoringnoresponse |
A numeric value or vector to indicate the scoring for non-responding. Defaults to 0. |
scoringincoherent |
A numeric value or vector to indicate the scoring for incoherent answer(s) (e.g. two boxes checked for a single-answer questionnaire). Defaults to 0. |
scoringbottom |
A numeric value or vector to indicate the minimum score for the question(s). Especially useful when attributing negative points to incorrect answers in a multiple-answer questionnaire, to ensure students do not lose too many points on one question. Defaults to 0. |
shufflequestions |
A logical value or vector to indicate whether to shuffle questions inside a question group. Defaults to TRUE. |
shuffleanswers |
A logical value or vector to indicate whether to shuffle answers per examinee. Defaults to TRUE. If set to FALSE, it is recommended to shuffle once for all examinee with shuffle the answers once with 'shuffleanswersonce = TRUE'. |
shuffleanswersonce |
A logical value to indicate whether to shuffle answers for each question directly in the LaTeX code (useful if the answers are not randomized by examinee by AMC). Defaults to TRUE. |
sections |
A character value or vector to indicate whether to create a new LaTeX section for each element (defaults to TRUE). |
title |
A character value indicating a title for the test (default is "Test"). |
filepath |
A character value indicating the path for the main .tex file output. Most often, in AMC, it is |
messages |
A logical value to indicate whether to output messages and reports (default is TRUE). |
fontsize |
A numeric value to indicate the font size of the output document. Default is 10. Note: Above 12 pt, the LaTeX package "extarticle" is automatically used in lieu of "article". |
instructions |
A logical value to add a block of preliminary instructions to the students (for example, how to fill the questionnaire). Defaults to TRUE. |
paper |
A character value indicating what type of paper to use. Default is "letter", but "a4" can also be used. |
identifier |
A character value indicating what to ask for to pair the exam sheets. The default is "Name", but other values like "Student ID Number" may be more appropriate. |
separateanswersheet |
A logical value to indicate whether to use a separate answer sheet. Defaults to FALSE. |
answersheettitle |
A character value to indicate the title of the separate answer sheet. Defaults to "Answer sheet". |
answersheetinstructions |
A logical or character value to add default (TRUE), remove (FALSE) or customize (character value) instructions given on the separate answer sheet. Default is TRUE, which indicates that the students shall answer on the answer sheet. |
twosided |
A logical value to indicate whether the exam will be printed two sided. This is notably important when printing on a separate answer sheet, to have the answer sheet printed on a separate page. Defaults to TRUE. |
lettersinsidebox |
A logical value to indicate whether to put letters inside boxes. Defaults to FALSE. |
box |
A logical value to indicate whether to box the questions and answers, to ensure that they are always presented on the same page. Defaults to TRUE. |
facilitatemanualadd |
A logical indicating whether to add LaTeX code to facilitate adding questions and elements manually. If TRUE, creates .tex files where questions and elements can be input manually without changing the main files. Defaults to FALSE. |
Writes 3 .tex documents (source.tex
, questions.tex
and elements.tex
)) for direct use in Auto-Multiple-Choice.
# Create all LaTeX files ## Not run: AMCcreatetest( # Arguments passed to AMCcreatequestions() question = "How much is $1+1$?", correctanswers = 2, incorrectanswer = list("3", "11", "4"), # Arguments passed to AMCcreateelements() shufflequestions = T, sections = F, # Part used for test options title = "Exam", #Custom title fontsize = 11, #change fontsize identifier = "ID Number", #change identifier twosided = F, #print in one sided instructions = T, #show an instructions block to students separateanswersheet = F, #use a separate answer sheet answersheettitle = "Respond Here", #Change answer sheet title answersheetinstructions = "Fill the boxes" #Answer sheet instructions ) ## End(Not run)
# Create all LaTeX files ## Not run: AMCcreatetest( # Arguments passed to AMCcreatequestions() question = "How much is $1+1$?", correctanswers = 2, incorrectanswer = list("3", "11", "4"), # Arguments passed to AMCcreateelements() shufflequestions = T, sections = F, # Part used for test options title = "Exam", #Custom title fontsize = 11, #change fontsize identifier = "ID Number", #change identifier twosided = F, #print in one sided instructions = T, #show an instructions block to students separateanswersheet = F, #use a separate answer sheet answersheettitle = "Respond Here", #Change answer sheet title answersheetinstructions = "Fill the boxes" #Answer sheet instructions ) ## End(Not run)