![]() |
Supporting your system inside TeXmacs | ![]() |
Assume that you have successfully written a first interface with TeXmacs as explained in the previous section. Then it is time now to include support for your system in the standard TeXmacs distribution, after which further improvements can be made.
It is quite easy to adapt your interface in such a way that it can be directly integrated into TeXmacs. The idea is to create a directory
$TEXMACS_HOME_PATH/plugins/myplugin |
where myplugin is the name of your plug-in. Here we recall that $TEXMACS_HOME_PATH is bound to ~/.TeXmacs, by default. In the directory $TEXMACS_PATH/plugins you can find all standard plug-ins, which are shipped with your TeXmacs distribution (in the source code of TeXmacs, they can be found in
src/plugins
). These provide good examples which you may imitate.
The above myplugin directory should contain a similar subdirectory structure as $TEXMACS_PATH itself, but you may omit directories which you do not actually use. In any case, you need to provide a file progs/init-myplugin.scm which describes how to initialize your plug-in. Usually, this file contains a Scheme instruction of the following form:
(plugin-configure myplugin
(:require (url-exists-in-path? "myplugin"))
(:launch "myplugin --texmacs")
(:session "Myplugin")) |
The first instruction is a predicate which checks whether your plug-in can be used on a particular system. Usually, it tests whether a certain program is available in the path. The remainder of the instructions is only executed if the requirement is fulfilled. The :launch instruction specifies that your plug-in should be launched using the given shell command, which is usually of the form myplugin --texmacs. The :session instruction makes shell sessions available for your plug-in from the menu Insert\(\rightarrow\)Session\(\rightarrow\)Myplugin.
By default, the input is sent to your program as a single line of plain text, and the output of your program is interpreted according to the formats specified in its DATA_BEGIN-DATA_END blocks (verbatim, latex, scheme, html, ps and others). The input format can be customized using the :serializer option and the mathematical input converters; notice that an option :format for specifying the input and output formats, which existed in early versions of TeXmacs, is no longer supported. The complete list of options is given in the summary of configuration options.
If everything works well, and you wish to make it possible for others to use your system inside the official TeXmacs distribution, then contact the TeXmacs developers.