Open Jazzpirate opened 3 years ago
Update: Things get tricky with associative arguments.
Possible solution 1: \operator
just takes arbitrarily many arguments in general (via \ifnextchar[
and \ifnextchar{
- need to check whether the latter works even). Inelegant, but would probably work.
Possible solution 2: an associative argument takes arbitrarily many comma-separated arguments, every other of which is considered a verbalization component. E.g. for flexary \plus
, an application could look something like
\plus[the sum of ]{a,{,},b, and ,c}
Example sentence
\operator
a semantic macro that takes n arguments. e.g.:\implication
, n=2.\operator
behaves as usual (e.g.$\implication{A}{B}$
expands to (ignoring semantics)$A \Rightarrow B$
- see https://github.com/KWARC/FoMID/issues/3)\operator
to arguments arg_1,...,arg_n e.g. p = "A natural number $N$ is even, if its square is even." arg_1="its square is even", arg_2="A natural number $N$ is even"Requirements
\operator
in text mode needs n arguments. The n arguments are subsequences of p in arbitrary order, interleaved with subsequences that do not represent an argument. e.g. first argument of\implication
is "its square is even", second argument is "A natural number $N$ is even", and ", if" does not represent an argument - these are considered verbalization components of\operator
.\natpow
in "its square" is 2, which is not explicitly represented in the text.\even
is "$N$", not "natural number"!Ideas
\operator
takes n{}
arguments, representing the operator arguments, interleaved with optional[]
arguments in between (including leading and trailing) representing verbalization components. e.g.\even{its square}[is even]
=> "its square" is the argument, "is even" is just a verbalization component.*[
k]
indicates that what follows is the k-th argument rather than the next one. e.g.\implication*[2]{A natural number $N$ is even}[, if]{its square is even}
indicates that the second argument comes first.*
is invisible e.g.\natpow{its}[ square]*{2}
==\natpow{its}*{2}[ square]
==\natpow*[2]*{2}{its}[ square]
=>
\implication*[2]{\even{A \NaturalNumbers[natural number] $N$}[ is even]}[, if]{\even{\natpow{its}*{2}[ square]}[ is even]}
.Remaining questions
OMV(N)
, whereN
has type\NaturalNumbers
and is universally quantified. How to represent this? (see https://github.com/KWARC/FoMID/issues/5 )