<\body> Until now, we have always considered interfaces between and applications which are intended to be used interactively in shell sessions. But there also exists a command <\scheme-fragment> (plugin-eval ) for evaluating an expression using the application. Here > is the name of the plug-in, > the name of the session and > a expression which represents a tree. plug-in> Background evaluations may for instance be used in order to provide a feature which allows the user to select an expression and replace it by its evaluation. For instance, the plug-in converts mathematical expressions into , and it provides the keyboard shortcut for replacing a selected text by its conversion. The plug-in consists of the following files <\verbatim> \ \ \ \ \ \ \ \ \ \ \ \ The main evaluation loop of simply consists of <\cpp-fragment> char buffer[100]; cin.getline (buffer, 100, '\\n'); cout \\ DATA_BEGIN; cout \\ "latex:$" \\ buffer \\ "$"; cout \\ DATA_END; fflush (stdout); Moreover, the configuration file contains the following code for replacing a selected region by its evaluation <\scheme-fragment> (define (substitute-substitute) \ \ (import-from (texmacs plugin plugin-cmd)) \ \ (if (selection-active-any?) \ \ \ \ \ \ (let* ((t (tree-\stree (the-selection))) \ \ \ \ \ \ \ \ \ \ \ \ \ (u (plugin-eval "substitute" "default" t))) \ \ \ \ \ \ \ \ (clipboard-cut "primary") \ \ \ \ \ \ \ \ (insert (stree-\tree u))))) as well as the keyboard shortcut for : <\scheme-fragment> (kbd-map \ \ ("C-F12" (substitute-substitute))) Notice that these routines should really be defined in a separate module for larger plug-ins. plug-in> Another example of using an interface in the background is the plug-in which consists of the files <\verbatim> \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ Just as above, the main program just converts mathematical expressions to . The module contains the routine : <\scheme-fragment> (tm-define (latexer s) \ \ (:type (tree -\ object)) \ \ (:synopsis "convert LaTeX string to TeXmacs tree using plugin") \ \ (:secure #t) \ \ (plugin-eval "secure" "default" (tree-\string s))) It is important to define as being secure, so that it can be used in order to define additional markup using the primitive. This is done in the style file : <\tm-fragment> <\inactive*> See a LaTeX math command as a TeXmacs expression via plug-in >>> After compilation, installation, relaunching and selecting , you will now be able to use as a new primitive. The primitive takes a mathematical expression as its argument and displays its conversion. <\initial> <\collection>