www.delorie.com/gnu/docs/calc/calc_14.html | search |
Buy the book! | |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Embedded Mode is a way to use Calc directly from inside an editing buffer. Suppose you have a formula written as part of a document like this:
The derivative of ln(ln(x)) is |
and you wish to have Calc compute and format the derivative for you and store this derivative in the buffer automatically. To do this with Embedded Mode, first copy the formula down to where you want the result to be:
The derivative of ln(ln(x)) is ln(ln(x)) |
Now, move the cursor onto this new formula and press M-# e. Calc will read the formula (using the surrounding blank lines to tell how much text to read), then push this formula (invisibly) onto the Calc stack. The cursor will stay on the formula in the editing buffer, but the buffer's mode line will change to look like the Calc mode line (with mode indicators like `12 Deg' and so on). Even though you are still in your editing buffer, the keyboard now acts like the Calc keyboard, and any new result you get is copied from the stack back into the buffer. To take the derivative, you would type a d x RET.
The derivative of ln(ln(x)) is 1 / ln(x) x |
To make this look nicer, you might want to press d = to center the formula, and even d B to use "big" display mode.
The derivative of ln(ln(x)) is % [calc-mode: justify: center] % [calc-mode: language: big] 1 ------- ln(x) x |
Calc has added annotations to the file to help it remember the modes that were used for this formula. They are formatted like comments in the TeX typesetting language, just in case you are using TeX. (In this example TeX is not being used, so you might want to move these comments up to the top of the file or otherwise put them out of the way.)
As an extra flourish, we can add an equation number using a righthand label: Type d } (1) RET.
% [calc-mode: justify: center] % [calc-mode: language: big] % [calc-mode: right-label: " (1)"] 1 ------- (1) ln(x) x |
To leave Embedded Mode, type M-# e again. The mode line and keyboard will revert to the way they were before. (If you have actually been trying this as you read along, you'll want to press M-# 0 [with the digit zero] now to reset the modes you changed.)
The related command M-# w operates on a single word, which generally means a single number, inside text. It uses any non-numeric characters rather than blank lines to delimit the formula it reads. Here's an example of its use:
A slope of one-third corresponds to an angle of 1 degrees. |
Place the cursor on the `1', then type M-# w to enable Embedded Mode on that number. Now type 3 / (to get one-third), and I T (the Inverse Tangent converts a slope into an angle), then M-# w again to exit Embedded mode.
A slope of one-third corresponds to an angle of 18.4349488229 degrees. |
See section 17. Embedded Mode, for full details.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
webmaster donations bookstore | delorie software privacy |
Copyright © 2003 by The Free Software Foundation | Updated Jun 2003 |