An important feature of TeXmacs is it's ability to communicate with extern systems. For computer algebra systems or other scientific computation systems, this is typically done in shell-like sessions, in which it is possible to evaluate commands and display the results in a nice, graphical way. Some systems can also be used more in the background as scripting languages.
See
A session can be started from the
A session consists of a sequence of input and output fields and possible text between them. When pressing Return inside an input field of a session, the text inside the environment is evaluated and the result is displayed in an output field.
When entering a command in a session, the application attempts to execute it. Several commands may be launched concurrently in the same document, but the output will only be active in the session where the cursor is and at the place of the cursor. Therefore, we recommend to use different buffers for parallel executions.
For each type of extern application, one may choose between sharing a
single process by different sessions, or launching a separate process
for each different session. More precisely, when inserting a session
using
In order to finish the process which underlies a given session, you
may use
In order to evaluate all fields of e.g. a previously
created session, you may use
Inside input fields of sessions, the cursor keys have a special meaning: when moving upwards or downwards, you will move to previous or subsequent input fields. When moving to the left or to the right, you will never leave the input field; you should rather use the mouse for this.
Some facilities for editing input, output and text fields are
available in the
It is possible to create “subsessions” using
Notice that input/output fields and subsessions are foldable: when
clicking on the prompt with the mouse, you may fold or unfold the
entry to hide or show the output. For laptop presentations, this
folding and unfolding process is done automatically when traversing
your presentation. It is also possible to fold or unfold all fields in
a session using
Other useful editing operations are
(%i1)
diff (x^x^x, x)
(%i2)
integrate (%o1, x)
(%i3)
integrate (x^5 / (x^2 - x + 17), x)
By default, TeXmacs will attempt to evaluate the input field when
pressing Return. Multiline input can be created
using Shift+Return. Alternatively, when selecting
the multiline input mode using
Certain applications allow you to type the mathematical input in a
graphical, two dimensional form. This feature can be used by selecting
(%i1)
(%i2)
(%i3)
TeXmacs provides a few other kinds of additional interfaces to
external systems in addition to shell-like interfaces. First of all,
it is possible to insert a so called “executable switch”
anywhere in the document using
For instance, if
. You may enter a
. Using Return, you may now switch
back and forth between the unevaluated input and the evaluated output
. Using Shift+Return, you
enable multi-line input. This kind of executable switches are very
useful for plug-ins such as
diff(x^x,x)
Some plug-ins such as
If a plug-in can be used as a scripting language, then it is possible
to create executable switches with links between them. More precisely,
assuming that you selected a scripting language from
Contrary to executable switches, you may attach an identifier to the
executable input field by deactivating the field or by editing the
Ref field in the focus bar. Inside other executable input
fields, you may then refer to the value of the field by inserting a
field reference using \?
or
The derivative of equals diff(function,x).
The second derivative is given by diff(derivative,x).
yields
The derivative of equals .
The second derivative is given by .
Of course, if the reader changes the input function into something else and presses Return, then the first and second derivatives will be updated automatically.
TeXmacs provides rudimentary spreadsheet-like facilities with the
advantage that the computations can be carried out using any of the
plug-ins that can be used as a scripting language. In order to use the
spreadsheet facilities, you should therefore start with the selection
of a scripting language in the menu
As soon as you have selecting a scripting language, such as
In addition, when preceding the contents of a cell by =, then cell will be considered as an input-output switch. More precisely, the input is a formula which will be evaluated using the current scripting language. After the evaluation, only the result of the evaluation is shown in the cell. After pressing Return a second time in the cell, it will be possible switch back and edit the input. In the formulas, one may refer to the others using names such as c5 for the third row and the fifth column.
|
||||||||||||
|
||||||||
TeXmacs supports a few special notations for applying operations on
all cells in a subtable. For instance, as in
|
||||||||||||||||||||||||||||||
Notice that copying and pasting of subtables works in the same way as for ordinary tables, with the additional features that the names of the cells and references to cells in the formulas are renumbered automatically. Similarly, automatic renumbering is used when inserting new columns or rows, or when removing existing columns or rows.
We also notice that field references can be used inside spreadsheet cells in order to refer to some computational markup outside the table. Inversely, each spreadsheet also carries an invisible Ref field which can be edited by deactivating the spreadsheet or from the focus bar (when selecting the entire spreadsheet). The Ref field of the spreadsheet is used as a prefix for referring to the contents of cells outside the table or from within other spreadsheets. For instance, if Ref equals sheet, then sheet-c4 will refer to the field c4 inside the spreadsheet.
It sometimes happens that certain plug-ins are only installed on a remote computer. In many cases, it will still be possible to use such a plug-in inside TeXmacs over an SSH connection.
In order to make this work, you first have to make sure that SSH is installed on both computers and that connecting by SSH to the remote machine can be done automatically, without having to type a password. This can be done by copying your public identity on the local server to the remote server into the file ~/.ssh/authorized_keys; see the documentation on SSH for more information.
As the next step, you have to make sure that TeXmacs has been installed on both computers. The remote TeXmacs installation will mainly be used in order to detect which plug-ins can be used on the remote computer.
When everything has been set up correctly in this way, select
Servers which have been added to the list of remote plug-in servers
will be remembered at the next time when you start TeXmacs. You may
use the buttons