Next: , Previous: Display Modes, Up: Mode Settings

6.8 Language Modes

The commands in this section change Calc to use a different notation for entry and display of formulas, corresponding to the conventions of some other common language such as Pascal or LaTeX. Objects displayed on the stack or yanked from the Calculator to an editing buffer will be formatted in the current language; objects entered in algebraic entry or yanked from another buffer will be interpreted according to the current language.

The current language has no effect on things written to or read from the trail buffer, nor does it affect numeric entry. Only algebraic entry is affected. You can make even algebraic entry ignore the current language and use the standard notation by giving a numeric prefix, e.g., C-u '.

For example, suppose the formula ‘2*a[1] + atan(a[2])’ occurs in a C program; elsewhere in the program you need the derivatives of this formula with respect to ‘a[1]’ and ‘a[2]’. First, type d C to switch to C notation. Now use C-u C-x * g to grab the formula into the Calculator, a d a[1] <RET> to differentiate with respect to the first variable, and C-x * y to yank the formula for the derivative back into your C program. Press U to undo the differentiation and repeat with a d a[2] <RET> for the other derivative.

Without being switched into C mode first, Calc would have misinterpreted the brackets in ‘a[1]’ and ‘a[2]’, would not have known that atan was equivalent to Calc's built-in arctan function, and would have written the formula back with notations (like implicit multiplication) which would not have been valid for a C program.

As another example, suppose you are maintaining a C program and a LaTeX document, each of which needs a copy of the same formula. You can grab the formula from the program in C mode, switch to LaTeX mode, and yank the formula into the document in LaTeX math-mode format.

Language modes are selected by typing the letter d followed by a shifted letter key.