AMCcreateelements: Generate AMC LaTeX question group ("element") codes

Description Usage Arguments Value Examples

View source: R/AMCcreateelements.R

Description

Generate AMC LaTeX question group ("element") codes

Usage

1
2
3
AMCcreateelements(element = "general", shufflequestions = TRUE,
  sections = TRUE, output = "message", filepath = "elements.tex",
  append = FALSE, messages = TRUE)

Arguments

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).

Value

Commands to add the question groups in AMC-LaTeX code.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
#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")

Example output

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%| List of elements |%%%%%%%%%
%%% (copy & paste after questions) %%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section*{1}
\shufflegroup{1}
\insertgroup{1}
\section*{2}
\shufflegroup{2}
\insertgroup{2}
\section*{3}
\shufflegroup{3}
\insertgroup{3}
\section*{4}
\shufflegroup{4}
\insertgroup{4}

[1] "\\section*{1}\n\\shufflegroup{1}\n\\insertgroup{1}\n"
[2] "\\section*{2}\n\\shufflegroup{2}\n\\insertgroup{2}\n"
[3] "\\section*{3}\n\\shufflegroup{3}\n\\insertgroup{3}\n"
[4] "\\section*{4}\n\\shufflegroup{4}\n\\insertgroup{4}\n"
[1] "\\section*{1}\n\\shufflegroup{1}\n\\insertgroup{1}\n"
[2] "\\section*{2}\n\\shufflegroup{2}\n\\insertgroup{2}\n"
[3] "\\section*{3}\n\\shufflegroup{3}\n\\insertgroup{3}\n"
[1] "\\section*{1}\n\\insertgroup{1}\n" "\\section*{2}\n\\insertgroup{2}\n"
[3] "\\section*{3}\n\\insertgroup{3}\n" "\\section*{4}\n\\insertgroup{4}\n"
[1] "\\shufflegroup{1}\n\\insertgroup{1}\n"
[2] "\\shufflegroup{2}\n\\insertgroup{2}\n"
[3] "\\shufflegroup{3}\n\\insertgroup{3}\n"
[4] "\\shufflegroup{4}\n\\insertgroup{4}\n"
[1] "\\shufflegroup{1}\n\\insertgroup{1}\n"               
[2] "\\shufflegroup{2}\n\\insertgroup{2}\n"               
[3] "\\shufflegroup{3}\n\\insertgroup{3}\n"               
[4] "\\section*{4}\n\\shufflegroup{4}\n\\insertgroup{4}\n"

AMCTestmakeR documentation built on May 1, 2019, 10:19 p.m.