This function personalizes a 'LaTeX' document with data from a table,
generating a new file for each row which is saved on the outputDirectory.
GenerateHomework(
x,
Table,
CommandNames,
ColumnNames,
outputDirectory,
outputBaseName
)Character vector with the file names of the output.
A character vector, each element represents one line of the latex document
Data frame from which to extract the information
Character vector with the same length as columnNames
Character vector with the names of the columns to be used
The directory in which the output will be placed
The starting name for the output files
The files will look like
<outputDirectory>/<outputBaseName>_00<number>.tex
Where the number of zeros is the minimum number of zeros required to have a different version number for each file. (i.e., if there is only 45 files, it is 01-45; but with 132 files, it would be 001-132)
The command names should be 'LaTeX' commands that are being defined through
\newcommand{\<CommandNames[i]>}{<previous definition>}
The definition of these commands will be changed to be
\newcommand{\<CommandNames[i]>}{<Table[ColumnNames[i]][file #]>}
And it will output one file for each command.
The intent of this function was to populate information into a generic homework to personalize it for every student using 'LaTeX'. (It actually generalizes to maybe other problems).
ReplaceFromTable to get a better idea of how the replacement is made. To see examples of how to use it, look at the code in jsonhwparser