GNU TeXmacsUser manualReferenceAboutEnglish·中文
Common errors and syntax correction

By default, the semantic editing mode “understands” most classical mathematical notations. This is achieved through the use of a carefully designed grammar for mainstream mathematics. Obviously, the use of a fixed grammar may cause the following problems:

Besides these intrinsically hard to avoid problems, the following common and “easy-to-make” mistakes are a further source of trouble for associating semantics to mathematical formulas:

After activation of the semantic editing mode, you may check whether a formula is correct by positioning your cursor inside it and looking at the color of the bounding box of the semantic focus: a green color corresponds to a correct formula and a red color indicates an error in the formula. Alternatively, assuming that the focus is on a mathematical formula, you may select Focus\(\rightarrow\)Preferences\(\rightarrow\)Highlight incorrect formulas, in which all incorrect formulas are highlighted inside red boxes.

For the second kind of “easy-to-make” errors, TeXmacs includes an automatic syntax corrector. Assuming that your cursor is inside a formula, you may use Edit\(\rightarrow\)Correct\(\rightarrow\)Correct all for the correction of all formulas in your document, or the correction of the current selection. If the versioning tool is activated, then you may use Edit\(\rightarrow\)Correct\(\rightarrow\)Correct manually to show the differences between the original and the corrected versions. You may then use the versioning tool to go through these differences and select the preferred versions.

The precise algorithms which are used for the correction may be enabled or disabled from Edit\(\rightarrow\)Preferences\(\rightarrow\)Mathematics\(\rightarrow\)Manual correction:

Remove superfluous invisible operators

This algorithm is used in order to remove any superfluous function applications or multiplications. For instance, users who are accustomed to editing ASCII files often type spaces around binary infixes such as addition. Such “function applications” will be removed by this algorithm.

Insert missing invisible operators

In LaTeX, multiplications and function applications are never entered explicitly. When importing a LaTeX document, it is therefore important to detect and insert missing multiplications and function applications.

Homoglyph substitutions

This algorithm may perform some other useful substitutions of symbols by visually similar, but semantically distinct symbols. For instance, the backslash symbol \(\backslash\) is replaced by the binary set differences infix (as in \(X \setminus Y\)), whenever appropriate.

From the Edit\(\rightarrow\)Preferences\(\rightarrow\)Mathematics\(\rightarrow\)Automatic correction, you may also select those corrections algorithms which should be applied automatically whenever you open a file. The various corrections are always carried out when importing a LaTeX file.

After syntax correction, the remaining errors indicate genuine typos at worst or non standard or non supported notations at best. We also notice that “correct” formulas do not necessarily have the intended meaning. In order to check whether the operators indeed apply to the intended arguments, you should keep an eye on the current focus while typing your formulas.

Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.1 or any later version published by the Free Software Foundation; with no Invariant Sections, with no Front-Cover Texts, and with no Back-Cover Texts. A copy of the license is included in the section entitled "GNU Free Documentation License".