Mixima

Mixima is a minimalistic interface for Python-based mathematical computations, with considerable support for tagging and linking. It is aimed as a Python-wise counterpart to the TGM Minima software. As for now, Mixima supports evaluations via batches and via continuous sessions, and (both local and remote) linking.

The evaluations are run in batches or in continuous sessions: set run mode (one of two forms of batches or continuous interactive session), and input dealing (left/copied/moved) at the top bar, or via Ctrl-\ and Alt-\ respectively.

Choose the automatically imported packages and their modules at the bottom bar. Notice that settings for the imported packages is used at run starts only. Thus when a (continuous) interactive session is running, the "import" settings (at the bottom-bar) are kept fixed. The settings can be preset via Mixima startup options too.

Then evaluations are started by Ctrl/Shift+Enter. In both cases the code is taken from the lower (command-sheet) field, and results are put into the upper (text) field:

Notice that Ctrl+/ switches between the use of the whole command-sheet content and the selected parts of it. And if a running (continuous) session gets idle at a non-completed Python statement, Alt+Enter sends empty line into that running session to finish the statement (meant if the non-finished state is due to missing empty line, and not due to being at a multi-line string).

If an empty command is (accidentally) sent otherwise, the status label (cca middle of the upper bar) gets transiently blue-colored. Likewise it gets blueish on a request to send a command to a non-idle running session, since commands are only sent once a previous evaluation is done.

A situation when Python of the running session considers the current input Python statement as non-complete, is highlighted via blueish color of the current-line highlighting (at command sheets). When a running (continuous) session undergoes an evaluation, the whole command sheets have a blue background.

If an error occurs during evaluations, it is put into the error widget; see the left-most button at the right-hand part of the top bar. The whole inputs, incl. the automatically imported modules are put into the history widget (right off the error-widget button).

Common text search at the loaded documents can be done via the search input (top bar). It can be focused by Ctrl+F (or Ctrl+Shift+F, Shift for copying selected text in). Then the search is run by Enter, possibly with Shift and Alt modifiers. Shift is for searching backwards from the text cursor, Alt is for search at the current (lower) command sheet.

Seeking the same-as-the-last searched strings (if any such present) in the document can be done by Ctrl+G (or Ctrl+Shift+G, Shift for going backwards).

Organizing the Mixima documents (contents of the upper text field) can be underwent in two ways:

  1. by section lines (for text parts) and tilde lines (for computation blocks within the text field),
    where the sections/blocks are partitioned in a schematic way;
  2. semantics is added by regular tags and links to them, where the tagging is for marking particular parts of text according to its meaning.
Use of the two document organizing ways is optional, and Mixima can be used just as an evaluation tool, without any structuring put in.

Regarding section lines, they are forms that visually split the document: lines that consist solely of at least ten #, =, or * letters. Highlighted computation blocks are started by at least three tildes (~~~), and are ended either by another tilde line or by a section line, whatever comes first.

Tags, i.e. semantics-oriented annotations, and links to tags are described below. Notice that links can target both tags within the current document (labeled as local links), and within arbitrary documents (labeled as remote links). Regarding remote links, *.twt files are searched by default.

When the (upper) text cursor is on a link, Ctrl+L (or Ctrl+Shift+L) follows the link. The Shift modifier is for: going backwards in the document in the case of local links, and searching within *.txt files (along with *.twt files) in the case of remote links.

Local links can be run from the search input (top bar) too, via Ctrl+Enter (or Ctrl+Shift+Enter). Notice that when the search input contains a valid local link, the background color of the search input turns blueish.

Remote links can be run from the (upper) input at the remote-linking window (opened by Ctrl+R). Notice that when the remote-linking input contains a valid remote link, the background color of that input turns blueish. Then remote links can be run by Enter (or Shift+Enter, Shift for considering .txt files along with .twt files).

The middle part of the remote-linking widget contains a (limited) list of the previously executed remote links. Enter and double-click copy the entry into the topwise input there. The lower part of the remote-linking contains a list of found files for the respective remote links (i.e. list of files that contain the specified tags). Enter and double-click load the specified file as the current document, and seek the respective tag there.

Once a tag gets targeted in a document, seeking the other tags that are pointed by the starting link (if any such tags are present there) can be done by Ctrl+N (or Ctrl+Shift+N, Shift for going backwards). This holds regardless of the onset of the linking; i.e. for all the links run from documents, from search input, and from the remote-linking window.

Use of tags and links:

Tags are structured as: [#tag_type:tag value] with
tag types: simple word-like, allowed chars: a-zA-Z0-9_
tag values: a more-free form, with next restrictions:
            without any nesting of (links to) tags, without \ { } letters,
            and [] () "" only allowed when simply (without nesting) pair-matched.

The 'doc(ument)' and 'top(ic)' tag types are supposed to annotate
the whole documents, large parts of them, respectively.
Then the 'sec' type is supposed to serve for semantic (sub)sections, like:
[#sec:/part/subpart/subsubpart] etc.

Links can be either to single tags or to pairs of tags;
and the tag pairing can be either within whole documents,
or the tags can be required to be located within the same (sub)sections.

Local links: [@tag_type:(part of) tag value]
Remote links: [@...dir_part.../...glob_part...\tag_type:(part of) tag value]

Regarding local links, i.e. links to tags within (current) documents:
use @ instead of # (and without putting the directory/glob part in).

Regarding remote links, i.e. links between documents:
add 'dir/glob\' part in between link start (again by @) and the linked tag.
Here dir can be both relative and absolute ('~/subdir' can be used for starting the dir
from home directory), and glob can contain the '*' wildcard character.
If using drive spec in the dir part, it has to be preceded by slash, like: /Z:/dir

The '*' wildcard is put automatically to the end of glob part, thus e.g. [@./\sec:some]
looks for [#sec:some...] tags at all Mixima documents in the directory where the current
document is located. If '=' is put to the glob end, the '*' is not added there.

When ':' char is put at the start of the dir part, it puts several upward
(three by default) directories into the search. The 'upwards' count can be specified,
e.g. [@:2/name_start\sec:some] looks for files with names starting by "name_start"
in the current and two upwards directories (checking [#sec:some*] tag presence there).

The ':' or ':number' specifier can be used by the end of the glob part (before \) too.
There it is for testing files in subdirectories (':' is for three subdirs by default).
In such a case the first subdirectories (along the files there) are filtered by the glob
(if the glob itself is specified).

Matching is done case-insensitive for tag names (filesystem part in remote links
depends on the ways of operating systems). And comparisons among links and tags
is (by default) limited to the extents put into the links: [@sec:some] links to
[#sec:some], [#sec:some section], etc. This can be changed by adding '=' to link
ends (where the added '=' is only used for declaring the non-limited comparisons),
and similarly a trailing '*' is considered to explicitly state the limited
(that is default) way of comparisons.

The '*' wildcard can be put into the tag type end too (that is just before the ":" char).
Thus e.g. both [@*:*] and [@*:] local links look for all tags within the loaded document;
and alike for remote links.

Up to two tag specifications can be put in links, separated by \ or \\
and requiring tags of both specs to be present in the searched document,
and (final) seeking is to tags of the second tag spec.

 • The \\ inter-tag connective allows tags of the two specs to be wherever in documents,
 • while the \ inter-tag connective requires occurrences within the same (sub)sections;
   (sub)section nesting goes as "# > = > * > ~" and by section-line lengths then;

Thus e.g. the [@tag:some=\*:*] link looks for all tags at all document sections
(delimited by section lines) where the [#tag:some] tag is located.
Recall that sections for tag pairs are defined by the section/tilde lines,
that is not by possibly present tags with "sec" type.

When a document is saved, contents of command sheets (that are set for saving) are added to the saved file. To switch the command sheet-saving state, use Alt-M (or the bottom-right square button left off the size grip). Notice that (in the saved files) a separator is put between the text from the (upper) text field and texts from the (lower) command sheets (that are saved). When loaded again, menus opened on the separators allow moving the respective texts back to the command sheets.

List of key-bindings:

Ctrl+, to focus the upper part,
Ctrl+. to focus the lower part,
Ctrl+Q for closing the application,
Esc closing (focused) auxiliary window, leaving the search input,

Ctrl+Enter runs command (if idle), output targeted to the end of the text field,
Shift+Enter runs command (if idle), output targeted to the cursor at the text field,
Alt+Enter sends empty line (if idle and at a non-finished statement),
Ctrl+K interrupts current evaluation (if any runs, for Linux/Unix systems),
Ctrl+Shift+K to kill the current evaluation (if any runs),

Ctrl+\ switches between the "batch" / "batch with -i option" / "continuous interactive-session" modes,
Alt+\ switches between "input left" / "input copied" / "input moved" modes,
Ctrl+/ switches between use of whole command sheet and its selected parts as evaluation input,
Alt+P switches expression printing (only when SymPy import is set "on", and when a session is not currently running),

Ctrl+* to open window with evaluation errors,
Ctrl+' to open window with history of evaluation commands,
Ctrl+? to open the "about" window,

Ctrl+`, Ctrl+~ to insert a tilde line (~~~ line) into the (upper) text field,
Alt+L switches line-wrapping at the (upper) text field,
Ctrl+1/2/3 to switch to the 1/2/3 command sheet,

Ctrl+Z, Ctrl+Y for undo, redo of text editing.
Ctrl+X, Ctrl+C, Ctrl+V for cut, copy, paste,

Ctrl+O for file-open action,
Ctrl+S for file-save action,
Ctrl+Shift+S for file save-as action,
Alt+M switches whether the current command sheet-content is set for saving,
Alt+T switches between "file-name" and "directory" display of the currently open file (if any) at window title,

Ctrl+L, Ctrl+Shift+L follows link under the text cursor,
Ctrl+N, Ctrl+Shift+N seeks another tag that is targeted by the last linking,
Ctrl+R opens the remote-linking window,

Ctrl+F, Ctrl+Shift+F targets the search input,
Ctrl+G, Ctrl+Shift+G seeks another string that is targeted by the last text search,
Alt+S switches case-sensitive state of the common text search,
Alt+W switches whole-words search state of the common text search,

when search input focused:
Enter, Shift+Enter, Alt+Enter, Alt+Shift+Enter for common text search,
Ctrl+Enter, Ctrl+Shift+Enter for running local link (if put at the search entry),

when input of the remote-linking widget focused:
Enter, Shift+Enter for running remote link (if put at the input entry there),
when middle part of the remote-linking widget focused:
Enter, double-click to copy current link into the input part
when lower part of the remote-linking widget focused:
Enter, double-click loads the respective file as the (newly) opened document,

Mixima admits next command-line options:

  -h, --help            show this help message and exit
  --python PYTHON       the Python used for evaluations
  --eval-dir EVAL_DIR   directory in which evaluations are run
  --file-dir FILE_DIR   default directory for file save/open
  --tab-length TAB_LENGTH
                        length (2 to 8) used for tab key
  --qt-style QT_STYLE   (non-default) Qt style to be applied
  --batch-cursor {start,below}
                        where to put cursor by batch output: at "start",
                        "below" (default) the results
  --license             shows the license and exits
  --version             shows the version and exits
  --unicode [{yes,no}]  whether to set "use_unicode" at SymPy's expression
                        printing
  --fixed-imp [{yes,no}]
                        default setting for keeping import levels the same
                        among sheets
  --sym-print {no,short,long,latex}
                        default expression-printing mode
  --imp-sym {0,1,2}     default level of SymPy import
  --imp-sym-mod {0,1,2}
                        default level of import of additional SymPy modules
  --imp-sym-phys {0,1,2}
                        default level of import of physics SymPy modules
  --imp-sym-xyz {0,1,2}
                        default level of import of SymPy symbols for variables
  --imp-mp {0,1,2}      default level of import of multi-precision packages
  --mp-dps MP_DPS       mpmath's mp.dps value (default: 30)
  --gmp-prec GMP_PREC   gmpy2's precision value (default: 100)
  --imp-sci {0,1,2}     default level of SciPy import
  --imp-sci-mod {0,1,2}
                        default level of import of additional SciPy modules
  --imp-num {0,1,2}     default level of NumPy import
  --imp-ephem {0,1,2}   default level of *Ephem import
  --imp-astro {0,1,2}   default level of Astropy import
  --imp-stat {0,1,2}    default level of import of statistics packages
  --imp-r {0,1,2}       default level of rpy2 import
  --imp-plot {0,1,2}    default level of import of plotting packages
  --imp-io {0,1,2}      default level of import of I/O packages
  --imp-astro-io {0,1,2}
                        default level of import of astronomy-related I/O
                        packages
  --imp-cv {0,1,2}      default level of import of computer-vision packages
  --imp-user {0,1,2}    default level of import of user-defined packages
  --imp-common {0,1,2}  the (fixed) extent of always-imported packages
  --imp-user-1 IMP_USER_1 [IMP_USER_1 ...]
                        commands for level-1 of user-defined imports
  --imp-user-2 IMP_USER_2 [IMP_USER_2 ...]
                        commands for level-2 of user-defined imports
  --paths-pre PATHS_PRE [PATHS_PRE ...]
                        search path(s) for packages, added to start of
                        sys.path
  --paths-add PATHS_ADD [PATHS_ADD ...]
                        search path(s) for packages, appended to the end of
                        sys.path
  --sheet-save [{yes,no}]
                        default setting for command-sheets content saving
  --sheet-lines [{yes,no}]
                        to show command-sheet line numbers by default
  --text-wrap [{yes,no}]
                        default setting for line-wrapping at the text field
  --search-cs [{yes,no}]
                        sets the "case-sensitive" search option
  --search-words [{yes,no}]
                        sets the "match-words" search option
  --eval-sel [{yes,no}]
                        default setting on slections vs. whole sheets as input
  --eval-mode {batch,batch-int,int}
                        default mode of the evaluation runs
  --eval-input {leave,copy,move}
                        default dealing with input of evaluations
  --font-pixels FONT_PIXELS
                        size of font in pixels (for text/command fields)
  --font-points FONT_POINTS
                        size of font in points (for text/command fields)

additional shell-only option:
  --ui-python=<path>
      mixima.py is called via the requested <path> command,
      otherwise the inner-specified (python3) is used

Mixima website: mixima.tangloid.net