list.settings: format ordered and unordered lists

Description Usage Arguments Details See Also Examples

View source: R/Lists.R

Description

Create a description used to format ordered and unordered lists in object documents.

Usage

1
2
3
4
5
list.settings(ol.left = seq(from = 0, by = 0.4, length.out = 9),
  ol.hanging = rep(0.4, 9), ol.format = rep("decimal", 9),
  ol.pattern = paste0("%", 1:9, "."), ul.left = seq(from = 0, by = 0.4,
  length.out = 9), ul.hanging = rep(0.4, 9), ul.format = c("disc", "circle",
  "square", "disc", "circle", "square", "disc", "circle", "square"))

Arguments

ol.left

left indent values (in inches) for each level of an ordered list. Length must be 9 as there are 9 elements to define (from level1 to level9).

ol.hanging

space values (in inches) between numbering label (argument ol.format) and content for each level of an ordered list. Length must be 9 as there are 9 elements to define (from level1 to level9).

ol.format

type of numbering for ordered levels, values can be 'decimal' or 'upperRoman' or 'lowerRoman' or 'upperLetter' or 'lowerLetter'. Length must be 9 as there are 9 elements to define (from level1 to level9).

ol.pattern

numbering pattern for ordered levels. A level numbering has the following syntax: "%1" (numbering of level1), "%2" (numbering of level2), ..., "%9" (numbering of level9).

ul.left

left indent values for each level of an unordered list. Length must be 9 as there are 9 elements to define (from level1 to level9). Length must be 9 as there are 9 elements to define (from level1 to level9).

ul.hanging

space values (in inches) between bullet symbol (argument ul.format) and content for each level of an unordered list. Length must be 9 as there are 9 elements to define (from level1 to level9).

ul.format

type of bullet for unordered levels, values can be 'disc' or 'circle' or 'square'. Length must be 9 as there are 9 elements to define (from level1 to level9).

Details

List settings are used to configure formatting of list in documents.

It can be set in R session options or as a parameter in docx or pptx.

See Also

addParagraph, ReporteRs

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
if( check_valid_java_version() ){
numbering.pattern = c( "%1.", "%1. %2.", "%1. %2. %3.",
  "%4.", "%5.", "%6.", "%7.", "%8.", "%9." )

ordered.formats = rep( c( "decimal", "upperRoman", "upperLetter"), 3 )

unordered.formats = rep( c( "square", "disc", "circle"), 3 )

left.indent = seq( from = 0, by = 0.5, length.out = 9)

options("ReporteRs-list-definition" = list(
  ol.left = left.indent,
  ol.hanging = rep( 0.4, 9 ),
  ol.format = ordered.formats,
  ol.pattern = numbering.pattern,
  ul.left = left.indent,
  ul.hanging = rep( 0.4, 9 ),
  ul.format = unordered.formats
  )
)


doc.filename = "ex_list.docx"
doc <- docx()

doc <- addTitle( doc, "List example", level = 1 )

# define some text
text1 = "Lorem ipsum dolor sit amet, consectetur adipiscing elit."
text2 = "In sit amet ipsum tellus. Vivamus arcu sit amet faucibus auctor."
text3 = "Quisque dictum tristique ligula."

# define parProperties with list properties
ordered.list.level1 = parProperties(list.style = "ordered",
                                    level = 1 )
ordered.list.level2 = parProperties(list.style = "ordered",
                                    level = 2 )

# define parProperties with list properties
unordered.list.level1 = parProperties(list.style = "unordered",
                                      level = 1 )
unordered.list.level2 = parProperties(list.style = "unordered",
                                      level = 2 )

# add ordered list items
doc = addParagraph( doc, value = text1,
                    par.properties = ordered.list.level1 )
doc = addParagraph( doc, value = text2,
                    par.properties = ordered.list.level2 )

# add ordered list items without restart renumbering
doc = addParagraph( doc, value = c( text1, text2, text3),
                    par.properties = ordered.list.level1 )

# add ordered list items and restart renumbering
doc = addParagraph( doc, value = c( text1, text2, text3),
                    restart.numbering = TRUE, par.properties = ordered.list.level1 )

# add unordered list items
doc = addParagraph( doc, value = text1,
                    par.properties = unordered.list.level1 )
doc = addParagraph( doc, value = text2,
                    par.properties = unordered.list.level2 )

writeDoc( doc, file = doc.filename )

}

davidgohel/ReporteRs documentation built on Dec. 4, 2018, 5:10 p.m.