Styling glosses

Mariana Montes

2022-08-19

Line styling

By default, glosses produced with glossr don’t have italics or bold (this may change in the future, by user request). However, it is fairly easy to adapt that at the document level.

The formatting of different lines is stored in options(), with variables starting with “glossr.format.”:

Each of these options can either take a value setting italics (“i”, “it”, “italics” or “textit”) or one setting boldface (“b” “bf”, “bold”, “textbf”).

If you’re familiar with options(), you can set your preference by entering something like this in a chunk:

options(glossr.format.a = "i") # italics in the first line

Alternatively, use_glossr() offers a friendlier interface with a wider variety of names, so you can choose the mnemonic that works for you. The argument “styling” must be a named list, with a key pointing to the line you want to style and the same range of values mentioned above.

If you would like to add other alternatives, let me know!

As an example, if you run the following chunk:

library(glossr)
use_glossr(styling = list(
  source = "b",
  first = "i"
))

…you will set all first lines to italics and the sources to boldface. The next one, on the other hand:

use_glossr(styling = list(
  first = "i",
  trans = "i"
))

…will set the first line and the free translation in italics.

You can always annul a setting by typing options(glossr.format.a = NULL), for example. But this set-up is meant to encourage/enforce you to keep the same style across a given file.

Other formatting

Next to the line formatting options, the styling argument can take two other elements.

First, “trans_quotes” (also to be set as options(glossr.trans.quotes = "whatever")) defines the character you want to surround your translation with. By default, this is double quotes, but you might want to select single quotes instead, or remove them altogether. The following chunk of code sets italics in the first line and single quotes for the translation:

use_glossr(styling = list(
  first = "i",
  trans_quotes = "'"
))

And the following removes quotes altogether:

use_glossr(styling = list(
  first = "i",
  trans_quotes = ""
))

Finally, “par_spacing” (also to be set as options(glossr.par.spacing = 0)) defines the space above and below the glosses in PDF output, which by default is 0. Depending on the settings of your template, you might want to add more spacing.