# [TxMt] math bundle feature request

Benny Kjær Nielsen benny at diku.dk
Fri Dec 8 05:43:54 UTC 2006

```On Dec 8, 2006, at 10:29 AM, janssen at ccr.jussieu.fr wrote:

> I am a plain textmate user and a complete computer/programming
> illiterate who
> searches advice and input from other, potentially more experienced
> users of
> textmate. When writing latex based papers using the wonderful latex
> bundle I
> frequently want to do a quick and simple calculation.
> Unfortunately, this often
> involves other formats than those provided by the existing math
> bundle and I
> have to invoke an external calculator. Would it be possible to
> extend the math
> bundle to normal calculator capabilities? IE providing
> exponential/logarhithmic,
> power function, trigonometric functions, numbers in ecponential
> notation
> etc. ?

You have received other answers to your question, but unless I have
misunderstood your question then the math bundle already has the
functionality you are looking for. The math bundle uses the unix
utlility 'bc' to do its calculations. See the manual by writing 'bc'
in TextMate and then press ⌃h

If you look through the man file you will see that bc is quite
powerful although the function names chosen might be a bit non-
standard. Here is an excerpt:

s (x) The sine of x, x is in radians.
c (x) The cosine of x, x is in radians.
a (x) The arctangent of x, arctangent returns radians.
l (x) The natural logarithm of x.
e (x) The exponential function of raising e to the value x.

You can also set the number of decimals wanted for the result. E.g.,
to get the logarithm of 10 with 5 decimals, you could write:

scale=5;
l(10)

Mark both lines (or put them on one) and then press ⌃⇧C.

You can even write programs which are C-like in syntax and you can
define functions. This could be used to alter the Math bundle to
always define some set of functions that you often use. Note though
that there is no syntax highlighting for the bc language, yet :-)

But it does not seem to support exponential notation. I guess this
could be added by piping it through some conversion utility first.

I hope this helps.

Kind regards, Benny

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 1924 bytes
Desc: not available
URL: <http://lists.macromates.com/textmate/attachments/20061208/a73d8182/attachment.p7s>
```

More information about the textmate mailing list