latex_helper: Supporting functions for math LaTeX output

lsumprodR Documentation

Supporting functions for math LaTeX output

Description

lsumprod creates a latex printout of \sum_i x_i y_i with brackets if x_i or y_i starts with a -.

lsum creates a latex printout of x as sum.

lprod creates a latex printout of x as product.

lmean creates a latex printout as \frac{x_1+...+x_n}{n}.

lvar creates a latex printout as \frac{(x_1-xbar)^2+...+(x_n-xbar)^2}{n}.

lbr creates a latex printout of x with brackets if x starts with a -.

lsgn creates a latex printout of x with a plus or minus at the beginning.

Usage

lsumprod(..., br = "(")

lsum(x)

lprod(x)

lmean(x)

lvar(x, mu = NULL, br = "(")

lbr(x, br = c("(", "[", "{", "|", "||", "<", "a", "c", "f"), subset = NULL)

lsgn(x)

Arguments

...

further input values

br

character: which brackets to use, either

  • ( (default) uses ⁠\left(⁠ and ⁠\right(⁠,

  • [ use ⁠\left[⁠ and ⁠\right]⁠,

  • { use ⁠\left\{⁠ and ⁠\right\}⁠,

  • | use ⁠\left|⁠ and ⁠\right|⁠,

  • || uses ⁠\left\|⁠ and ⁠\right\|⁠,

  • <, a use ⁠\left\langle⁠ and ⁠\right\rangle⁠,

  • c use ⁠\left\lceil⁠ and ⁠\right\rceil⁠, and

  • f use ⁠\left\lfloor⁠ and ⁠\right\rfloor⁠.

x

numeric: input values

mu

numeric: population mean (default: NULL)

subset

logical: indicates to which elements brackets are added (default: NULL = all elements statrting with -); missing values are taken as false.

Value

character

Examples

lsumprod(-2:2, (1:5)/10)
lbr(-2:2)
lsum(-2:2)
lmean(-2:2)

sigbertklinke/exams2moodle documentation built on July 6, 2023, 3:26 p.m.