wikiparse: Parse Wikimath

Description Usage Arguments Details Value Author(s) References See Also Examples

Description

Parse wikimath, optionally overriding default style arguments.

Usage

 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
wikiparse(
	x, 
	sim = "~", 
	dot = "*", 
	pregreek = "", 
	sup = "^", 
	openSup = "{", 
	closeSup = "}", 
	sub = "_", 
	openSub = "{", 
	closeSub = "}", 
	wrap = "", 
	...
)
wiki2latex(
	x,
	sim='\\\\sim',
	dot='\\\\cdot',
	pregreek = '\\\\',
	wrap=c('$\\mathrm{','}$'),
	...
)
wiki2plotmath(
	x,
	sim='%~~%',
	dot='%.%',
	sub='',
	openSub='[',
	closeSub=']',
	...
)
wiki2label(x,...)
wiki2parameter(x,...)

Arguments

x

character

sim

replaces wikimath tilde

dot

replaces wikimath asterisk

pregreek

prefixes theta, omega, sigma, eta

sup

invokes superscript

openSup

begins superscript content

closeSup

ends superscript content

sub

invokes subscript

openSub

begins subscript content

closeSub

ends subscript content

wrap

wraps entire string

...

ignored

Details

Wikimath is a text coding convention for simple model statements of the form "V_c /F (L * h^-1 ) ~theta_1 *(WT/70)^theta_2". The functions wiki2latex and wiki2plotmath are wrappers for wikiparse that intend to give nearly identical visual representations in latex and plotmath contexts, respectively. The functions wiki2label and wiki2parameter are extraction functions that give, e.g., “V_c/F” and “THETA1”.

The point of a wikimath statement is to express a mathematical model definition for a quantity of interest, usually in terms of a parameter. Generally, a representation of the quantity is to the left of a tilde, optionally with units in parentheses. To the right of the tilde is a submodel including relevant parameters and constants. Parameters are limited to theta, omega, sigma, and eta, which should be subscripted. The subscript operator in wikimath is the underscore. The superscript operator is the "hat". Arithmetic operators generally represent themselves.

Subscripts and superscripts may be nested to somewhat arbitrary depth. However, to avoid ambiguity, nested levels must be terminated explicitly by means of a space character. Thus “V_c /F” is different from “V_c/F ”: in the latter, “/F” is erroneously part of the subscript.

Value

character

Author(s)

Tim Bergsma

References

http://metrumrg.googlecode.com

See Also

Examples

1
2
3
4
5
6
wiki <- "V_c /F (L * h^-1 ) ~theta_1 *(WT/70)^theta_2"
wiki2latex(wiki)
wiki2plotmath(wiki)
wiki2label(wiki)
wiki2parameter(wiki)
## Not run: metrumrgURL('example/wikimath/wikimath.pdf')

metrumrg documentation built on May 2, 2019, 5:55 p.m.