Dan_Jacobson@ATT.COM (02/11/91)
[Followup-To: comp.emacs,comp.text.tex. Sorry to disturb sci.math'ers, but the Frequently Asked Questions posting didn't mention calculators.] I just noticed that I can turn a line of C into Fortran into Pascal into TeX ... with daveg@csvax.cs.caltech.edu's calc program for GNU Emacs. [Write Dave for details, not me.] I haven't explored this too deeply yet beyond trying it out. It just impressed me. (Perhaps this is no big deal[?]) Here's part of the 300 page calc manual. ------ File: calc Node: Language Modes, Prev: Display Modes, Up: Mode Settings 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 TeX. 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. 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 `calc-yank' to grab the formula into the Calculator, `a d a[1] RET' to differentiate with respect to the first variable, and `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 legal for a C program. As another example, suppose you are maintaining a C program and a TeX document, each of which needs a copy of the same formula. You can grab the formula from the program in C mode, switch to TeX mode, and yank the formula into the document in TeX math-mode format. Language modes are selected by typing the letter `d' followed by a shifted letter key. * Menu: * Normal Language Modes:: * C Fortran Pascal:: * Tex Language Mode:: * Mathematica Language Mode:: -- Dan_Jacobson@ATT.COM Naperville IL USA +1 708-979-6364