write.murl: Write a .tex file of recipient information to be processed by... In muRL: Mailmerge using R, LaTeX, and the Web

Description

Reads an R dataframe of letter recipient- and position-specific data, such as the output of read.murl. Creates a .tex file of the relevant data and LaTeX code, which can then be processed directly by pdflatex, for example.

Usage

 1 2 3 4 5 6 write.murl(object, file.name = "mailmerge.tex", salutation = "Dear", sal.punct = ":", address.string = "123 Venus Flytrap Way\\\\Cincinnati, OH 45201\\\\ \\texttt{[email protected]}\\\\ \\texttt{http://www.wkrp.edu/jfever}\\\\513-555-5664", date = "\\today", letter.file = NULL, letter.text = NULL, valediction = "Sincerely,", signature = "Johnny Fever", opening = "", include.opening = FALSE, verbose = TRUE) 

Arguments

 object a dataframe of mailmerge data, such as an output from read.murl(). file.name a character string specifying the file name (and optionally, path) for the output .tex file. See Details below for more. salutation a character string specifying the salutation to be used in the letters. sal.punct a character string specifying the punctuation to be used at the end of the salutation. address.string a character string specifying the return address to be used in the letters. Note that two slashes (\\) should be used for every one usual LaTeX slash. date an optional character string specifying the date. Defaults to the current date. letter.file an optional character string specifying a file containing the body text of the letters. See Details below for more. letter.text an optional character string containing the body text of the letters. See Details below for more. valediction a character string specifying the valediction to be used in the letters. signature a character string specifying the signature to be used in the letters. opening a character string specifying the opening line to be used in the letters. See Details below for more. include.opening a logical indicating whether an opening, customized line is to be used in the letters. See Details below for more. verbose a logical indicating whether the file.name and the current working directory should be printed after the file has been created.

Details

The dataframe used by write.murl should include columns for recipients' titles, first names, last names, addresses, cities, states, and ZIP codes, as well as information specific to the position for which the letter is in application. write.murl is intended to operate on the output of read.murl, and thus requires that the column names for the fields above be “title”, “fname”, “lname”, “address1” (and “address2”, etc.), “city”, “state”, “zip”, “position”, “subfield”, “dept”, and “institution”. These field names are automatically created by read.murl.

The user may define the main body text of the letter in at least three ways. First, write.murl includes some sample text by default. The user could simply edit this text in the .tex file created by write.murl. Second, the user could write the body text in a separate file (such as a .txt file) and specify that file's name using the letter.file argument. Third, the user could define the entire body text as a string passed to the letter.text argument.

If both letter.file and letter.text are specified, write.murl appends the value of letter.string below the contents of the file specified by letter.file.

The opening line specified by argument opening should be of a grammatical form consistent with “I write to apply for the position in”. This phrase will then be followed by customized input, using the fields “position”, “subfield”, “dept”, and “institution”, as in the example in Value below. To omit such a customized opening line, set the include.opening toggle to FALSE (the default). The example in Value below, and thus each letter, will include only the content defined in the LaTeX-defined “body”.

Value

A .tex file of LaTeX code and recipient-specific content, to be processed directly by LaTeX. Using the included murljobs.csv sample data, the .tex file created by write.murl includes for each position one code snippet that looks like the following:

 1 2 3 4 5 6 \begin{letter} {Dr. Richard Sanders\\Graduate Admissions Committee\\123 Hello Way\\Frederick MD 21701} \opening{Dear Dr. Sanders:} \body \closing{Sincerely,} \end{letter} 

Author(s)

Ryan T. Moore [email protected] and Andrew Reeves [email protected]

read.murl
  1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 data(murljobs) ## Create mailmerge.tex required for LaTeX import write.murl(murljobs) ## Specify a file containing the letters' body text ## write.murl(murljobs, letter.file = "mybodytext.txt") ## Specify a string containing the letters' body text write.murl(murljobs, letter.text = "This is the whole body of my letters.") ## Specify salutation, valediction options (overwrites previous mailmerge.tex) write.murl(murljobs, file.name = "mailmerge.tex", salutation = "Greetings", sal.punct = ",", valediction = "Truly Yours,", include.opening = FALSE) ## Specify opening line also (overwrites previous mailmerge.tex) write.murl(murljobs, file.name = "mailmerge.tex", salutation = "Greetings", sal.punct = ",", valediction = "Truly Yours,", opening = "I am applying for the job in", include.opening = TRUE)