# 2015-10-24 Yanking from Calc

Using Emacs Calc for calculations is one thing. Yanking the results into the document is another, and very often quite useful.

There are a few ways to do that. Probably the simplest one is to press `y` while in Calc; it just puts the number at the top of the stack into your last editing buffer. (See the manual for the exact meaning of “your last editing buffer”, and for the interpretation of prefix arguments.) Interestingly, you can also call that command by pressing `C-x * y` in any buffer, which will yank the top of the stack into the current buffer.

Sometimes, however, you don’t really want to fire up the whole Calc buffer etc. – you may just want to multiply two numbers and put the result at point. Then, you can use Calc’s “quick” variant: just press `C-u C-x * q`, type your calculation (in “algebraic” mode, i.e., with normal, infix syntax). The prefix argument will make it insert the result into your current buffer instead of just showing it in the echo area.

Another way of putting the result of Calc operations into an arbitrary buffer is the so-called embedded mode. It is quite a sophisticated and powerful concept. For instance, you can type `\$sin(30)\$` (note: the dollar signs are there so that Calc knows the boundaries of the formula, the buffer doesn’t have to be in any of TeX modes), put the point somewhere in this formula, and press `C-x * e` to have it replaced by `\$0.5\$`. (You have to press `C-x * e` again to exit Calc’s embedded mode.) Read the manual for details; Embedded mode definitely satisfies Clarke's Third Law (as does Calc itself).

There are also ways to put things from a buffer into Calc, but this is another story. Anyway, if you have never used Calc, and if you do need a calculator from time to time, definitely check out Calc. It’s fairly easy to use, it is well integrated into Emacs, and it’s surprisingly powerful.