6 Office

6.1 Mail

The ‘mail’ template generates a mail like Fig. 6.1. There are multiple options in the ‘mail’ template, with which you can produce different types of letters. These options can be classified into two groups: contents and themes.

A personal mail produced by the 'mail' template

Figure 6.1: A personal mail produced by the ‘mail’ template

6.1.1 Arguments for mail content

A letter has a unique structure, different from other documents. There are e.g. the sender’s and recipient’s addresses, their phones and affiliations, the opening and closing words, etc.. These must be specified in the arguments of bookdownplus():

bookdownplus(template = 'mail',
             author = "Peng Zhao",
             mail_from_address = "15 Robin Hood Lane", 
             mail_from_town = "11758  Massapequa, New York", 
             mail_from_phone = "31415926", 
             mail_from_mobile = "31415927", 
             mail_from_fax = "31415928", 
             mail_from_email = "dapengde@live.com", 
             mail_to_who = "recipient", 
             mail_to_affiliation = "University of Innsbruck", 
             mail_to_address = "recipient address", 
             mail_to_town = "100000 Beijing, China", 
             mail_opening = "Dear Sir or Madam,", 
             mail_closing = "Yours faithfully,", 
             mail_date = "25 June, 2017")

I believe these arguments are self-explanatory.

If you would like to change these pieces of information, you change revise \tex\template_mail_user.tex, which requires a little knowledge in LaTeX.

6.1.2 Mail themes

You can use several functions to decide how your mail looks.

The function mail_style() displays the available layouts of the mail:

## [1] "casual"   "classic"  "oldstyle" "banking"

You can use these layouts for the mail_style argument in bookdownplus():

bookdownplus(mail_style = 'banking')

The function mail_theme() displays the available themes for the sender’s header of the letter:

## [1] "blue"   "orange" "green"  "red"    "purple" "grey"   "black"

They are actually the colors of the sender’s name.

Some different themes might result in the same output, because they are not all supported by a certain style.

As you are writing a mail to print, it would be nice if you think about the receiver’s eyesight. You could change the font size of your mail by using the mail_font() argument for the fonts of your mail body, mail_bodysize argument for the font size of the mail body, and mail_fontsize() argument of the entire mail.

bookdownplus(mail_font = 'calligra',
             mail_fontsize = '12pt', 
             mail_bodysize = 'large')

If you are too lazy to memorize their values, you can use the following functions to remind you:

## [1] "sffamily" "calligra"
## [1] "10pt" "11pt" "12pt"
##  [1] "tiny"         "scriptsize"   "footnotesize" "small"       
##  [5] "normalsize"   "large"        "Large"        "LARGE"       
##  [9] "huge"         "Huge"

6.2 Calendar

Creating a calendar with ‘bookdown’ is challenging, but possible, if only you accept LaTeX. More or less, the ‘calendar’ template may help us see how far we can go with ‘bookdown’.

A calendar template can be created by running:

bookdownplus(template = 'calendar')

In your working directory you could now open ‘bookdownplus.Rproj’ with RStudio. Press ‘ctrl+shift+b’ to build it. Your will get a file named ‘calendar.pdf’ in ’_book/’ folder as an example. The calendar looks like Fig. 6.2.

A monthly calendar produced by the 'calendar' template.

Figure 6.2: A monthly calendar produced by the ‘calendar’ template.

The content of the calendar can be revised in ‘body.tex’. There are examples and fully explanations in it. I am not that interested in creating calendars, but I will be glad if you let me know how you like it.