Skip to contents

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.”:

  • glossr.format.preamble indicates the styling for the (optional) first line, where the “source” variable is rendered.

  • glossr.format.a indicates the styling of the first gloss line.

  • glossr.format.b indicates the styling of the second gloss line.

  • glossr.format.c indicates the styling of the third gloss line.

  • glossr.format.translation indicates the styling of the translation line.

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.

  • source and preamble are both valid names to set the format of the first optional line, where the source variable is rendered.

  • a and first are both valid names for the first gloss line.

  • b and second are both valid names for the second gloss line.

  • c and third are both valid names for the third gloss line.

  • ft, trans and translation are all valid names for the free translation line.

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 setup 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 = ""
))

Second, “numbering = FALSE” when the output is not PDF allows you to remove the numbering of examples, e.g. in slides.

Latex-specific features

The expex documentation shows a number of parameters that can be manipulated to adjust the spacing of the different parts of a gloss. In all cases the default value is 0, but you can increase them (or reduce them, if some other setting in your template sets a different default value) by providing the right instructions to use_glossr().

The variables that you can manipulate are the following:

  • exskip (also called par_spacing in this package) defines the space above and below the example.
  • belowglpreambleskip defines the pace under the preamble (where the source is printed).
  • aboveglftskip defines the spacing above the free translation.
  • extraglskip defines the spacing between the types of lines, e.g. between the source and the aligned lines, between the aligned lines and the translation, and between the groups of lines if your example is long enough to take more than one line.

For instance, the following sets a spacing of 6pt above and below the example and a spacing of 15pt between the different sections of the example:

use_glossr(styling = list(
  exskip = 6,
  extraglskip = 15
))