(yatexe)How the add-in function works


Next: How the function is called Prev: Add-in functions Up: Add-in functions

How the add-in function works
-----------------------------

There are three types of add-in.

  1. Option add-in
  2. argument add-in
  3. enclosing add-in

"Option add-in" returns the LaTeX's optional parameters such as optional
strings after `\begin{ENV}', optional strings between a section-type
command and its first argument, and optional strings just after type
maketitle-type command.  The following illustrates the name of add-in
functions, where underlined strings are generated by add-in functions.

     \begin{table}[ht]		(Function name: YaTeX:table)
                  ~~~~
     \put(100,200){}		(Function name: YaTeX:put)
         ~~~~~~~~~
     \sum_{i=0}^{n}		(Function name: YaTeX:sum)
         ~~~~~~~~~~

  Obviously, the function name is decided by concatenating the prefix
`YaTeX:' and LaTeX command's name.

  Another add-in type is "argument add-in", which completes arguments for
section-type commands.

     \newcommand{\foo}{bar}	(Function name: YaTeX::newcommand)
                 ~~~~  ~~~

  When the section-type command is inputted, the function named by
concatenating `YaTeX::' and section-type command, is called automatically
with an integer argument which indicates which argument of section-type
command is being read.  Thus the add-in should determine the job referring
the value of its argument.

  "enclosing add-in" is for modifying and/or checking the region that will
be enclosed by section-type commands via `[prefix] S'.  An enclosing
add-in function will be called with two arguments, beginning of the
enclosed region and end of the region.  Suppose you want to enclose the
existing text `(a+b)/c' by `\frac{}'.

     a/c
     |  |
     A  B

You do set-mark-command at point A and then move to point B.  Typing
`[prefix] S' and input `frac' enclose the region like this;

     \frac{a/c}

Normally, the expression `a/c' is translated to
`\frac{a}{c}'. An enclosing add-in is useful for modifying
`/' to `}{'.

* Defining option-add-in
* Defining argument-add-in
* Defining enclosing-add-in

automatically generated by info2www.cgi version 1.2