(yatexe)Defining enclosing-add-in


Prev: Defining argument-add-in Up: How the add-in function works

Defining `enclosing add-in'
...........................

  This section describes how to define the add-in function for text
enclosed by `\frac{}'.

  When enclosing the text `5/3' by `\frac{}', you might want to replace
`/' with `}{'.  Enclosing function `YaTeX::frac-region' is called with two
arguments, beginning of enclosed text and end of enclosed text.  The
function is expected to replace `/' with `}{'.  Here is an example
expression.

     (defun YaTeX::frac-region (beg end)
       (catch 'done
         (while (search-forward "/" end t)
           (goto-char (match-beginning 0))
           (if (y-or-n-p "Replace this slash(/) with `}{'")
          (throw 'done (replace-match "}{")))
           (goto-char (match-end 0)))))



automatically generated by info2www.cgi version 1.2