auctex
[Top][All Lists]

## [AUCTeX] embed preview<ed>-latex into FriCAS mode

 From: Martin Rubey Subject: [AUCTeX] embed preview-latex into FriCAS mode Date: 20 Oct 2008 19:42:12 +0200 User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.4

Dear all,

first of all, a BIG thank you to all the contributors of AUCTeX.  I'm using
(and recommending) it roughly since I use emacs and LaTeX (which is probably
about 10 years now), and I'm still delighted, every day.

Thank you!

Now, it's been a very short while that I have written my very first emacs mode,
which is a specialised mode to communicate with FriCAS, a computer algebra
system.  FriCAS is able to output LaTeX, and it would be extremely nice if I
could put things together, so that the typeset LaTeX is rendered nicely
in-line.

To make things a little more concrete, you can find a sample session at the
bottom of this mail.  The prompt looks like "(2) ->", then the user can type in
his request, FriCAS replies, fricas.el has an output filter that puts things
into the buffer, in a way that the background is coloured nicely, output is

In the sample session below, after "(3) -> ", I instructed FriCAS to output
LaTeX additionally.  It would be relatively straightforward to capture
everything which is LaTeX (i.e., the stuff between the $$'s) in this output filter, but I do not know how to insert it as a picture into emacs. Is preview-latex the right package to do so, or is there a better / easier method to accomplish that task? Help is much appreciated, Martin Rubey (1) -> (1) -> Value = (LAMBDA-CLOSURE () () () (X &OPTIONAL ARGS) (PRINC (CODE-CHAR 27)) (COND ((AND (EQ X '|startKeyedMsg|) (MEMBER (CAR ARGS) '('S2GL0012 'S2GL0013 'S2GL0014))) (PRINC "|startTypeTime|")) ((AND (EQ X '|endOfKeyedMsg|) (MEMBER (CAR ARGS) '('S2GL0012 'S2GL0013 'S2GL0014))) (PRINC "|endOfTypeTime|")) (T (PRIN1 X))) (PRINC #\Newline)) (1) -> concat(["AUCTeX", " is ", "wonderful"]) (1) "AUCTeX is wonderful" Type: String (2) -> log((sin(x/2) + 1)/cos(x/2)) - asinh(sin(x)/(cos(x) + 1)) x sin(-) + 1 2 sin(x) (2) log(----------) - asinh(----------) x cos(x) + 1 cos(-) 2 Type: Expression(Integer) (3) -> )se ou tex on (3) -> %% 2 x sin(-) + 1 2 sin(x) (3) log(----------) - asinh(----------) x cos(x) + 1 cos(-) 2$$
{\log
\left(
{{{{\sin
\left(
{{x \over 2}}
\right)}+1}
\over {\cos
\left(
{{x \over 2}}
\right)}}}
\right)}
-{asinh
\left(
{{{\sin
\left(
{x}
\right)}
\over {{\cos
\left(
{x}
\right)}+1}}}
\right)}
\leqno(3)
$$Type: Expression(Integer) (4) -> 3*3 (4) 9$$
9
\leqno(4)


Type: PositiveInteger
(5) ->