<\body> The meta-format allows application output to contain structured text like mathematical formulas. In a similar way, you may use general content as the input for your application. By default, only the text part of such content is kept and sent to the application as a string. Moreover, all characters in the range 0--31 are ignored, except for and which are transformed into spaces. There are two methods to customize the way input is sent to your application. First of all, the configuration option <\scm-code> (:serializer ,) specifies a scheme function for converting trees to string input for your application, thereby overriding the default method. This method allows you for instance to treat multi-line input in a particular way or the perform transformations on the tree. The option is a very powerful, but also a very abstract way to customize input: it forces you to write a complete input transformation function. In many circumstances, the user really wants to rewrite two dimensional mathematical input to a more standard form, like rewriting > to . Therefore, a second way for customizing the input is to use the command <\scm-code> \ (plugin-input-converters \ \ \ ) This command specifies input conversion rules for > for ``mathematical input'' and reasonable defaults are provided by . Each rule is of one of the following two forms: <\description> Given two strings > and >, the rule <\scm-code> (> >) specifies that the symbol > should be converted to >. Given a symbol > and a function >, the rule <\scm-code> ( ) specifies that > will be used as the conversion routine for >. This routine should just write a string to the standard output. The function may be used for the recursive transformation of the arguments of the tag. plug-in> The plug-in demonstrates the use of customized mathematical input. It consists of the files <\verbatim> \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ The configuration code in is given by <\scm-code> (plugin-configure input \ \ (:require (url-exists-in-path? "input.bin")) \ \ (:launch "input.bin") \ \ (:session "Input")) \; (when (supports-initialize?) \ \ (lazy-input-converter (input-input) input)) The predicate tests whether the plug-in is indeed operational (that is, whether exists in the path). The conversion rules in the module are added in a lazy manner. In other words, the file will only be loaded when we explicitly request to make a conversion. The conversion rules in are given by <\scm-code> (plugin-input-converters input \ \ (frac input-input-frac) \ \ (special input-input-special) \ \ ("\vee\" "\|\|") \ \ ("\wedge\" "&&")) This will cause > and > to be rewritten as and respectively. Fractions > are rewritten as using the routine <\scm-code> (define (input-input-frac t) \ \ (display "((") \ \ (plugin-input (car t)) \ \ (display "):(") \ \ (plugin-input (cadr t)) \ \ (display "))")) In the additional style file we also defined some additional markup : <\tm-fragment> |>>>>>>>> This tag is rewritten using the special conversion rule <\scm-code> (define (input-input-special t) \ \ (display "[[[SPECIAL:") \ \ (plugin-input (car t)) \ \ (display "]]]")) As to the code in , the startup banner automatically puts the shell session in mathematical input mode: <\cpp-code> cout \\ DATA_BEGIN \\ "verbatim:"; cout \\ DATA_BEGIN \\ "command:(session-use-math-input #t)" \ \ \ \ \ \\ DATA_END; cout \\ "Convert mathematical input into plain text"; cout \\ DATA_END; cout.flush (); In the main loop, we content ourselves the reproduce the input as output: <\cpp-code> char buffer[100]; cin.getline (buffer, 100, '\\n'); cout \\ DATA_BEGIN \\ "verbatim:"; cout \\ buffer; cout \\ DATA_END; cout.flush (); <\initial> <\collection>