|
From: Eduardo O. <edu...@gm...> - 2021-12-22 15:18:47
|
On Wed, 22 Dec 2021 at 11:45, Leo Butler <leo...@um...> wrote:
>
> Leo Butler <leo...@um...> writes:
>
> > Eduardo Ochs <edu...@gm...> writes:
> >
> >> People,
> >>
> >> what are your favourite ways to convert a part of a log of a Maxima
> >> session to LaTeX? Let me explain what I did and what I need...
> >>
> >> I am on Debian and besides having Maxima installed from the Debian
> >> packages I also have a clone of the git repository of Maxima in the
> >> directory ~/bigsrc/maxima/. I was able to compile EMaximaIntro.tex
> >> with:
> >>
> >> rm -Rv /tmp/emaxima/
> >> mkdir /tmp/emaxima/
> >> cd /tmp/emaxima/
> >> cp -v ~/bigsrc/maxima/doc/emaxima/EMaximaIntro.tex .
> >> cp -v ~/bigsrc/maxima/interfaces/emacs/emaxima/emaxima.sty .
> >> pdflatex EMaximaIntro.tex
> >> pdflatex EMaximaIntro.tex
> >>
> >> I followed the instructions in the pages 3 and 10 of EMaximaIntro.pdf
> >> and created a .tex file whose important parts were:
> >>
> >> \usepackage{emaxima}
> >> ...
> >> \begin{maximasession}
> >> diff(sin(x),x);
> >> integrate(cos(x),x);
> >> \maximaoutput*
> >> \i5. diff(sin(x),x); \\
> >> \o5. \cos x \\
> >> \i6. integrate(cos(x),x); \\
> >> \o6. \sin x \\
> >> \end{maximasession}
> >>
> >> When I LaTeXed it I got exactly the kind of output that I was looking
> >> for.
> >>
> >> My question is: how do I generate a maximasession block like the one
> >> above from inside a Maxima session? Can you recommend me a low-level
> >> way to do that?
>
> Another (low-level) way to do this is to load emaxima.lisp and set
> dispaly2d to emaxima.
>
> (%i2) load("emaxima.lisp");
>
> (%o2) "emaxima.lisp"
> (%i3) display2d:'emaxima;
> (%o3) \mathrm{emaxima}
> (%i4) integrate(x^2,x);
> (%o4) {{x^3}\over{3}}
> (%i5) diff(sin(x),x);
> (%o5) \cos x
> (%i6) diff(cos(x),x);
> (%o6) -\sin x
>
> It is pretty straightforward to convert that output into the
> maximasession data you get from using emaxima-mode.
>
> Leo
Thanks!!!
A question on your first solution... I am using this to make sure
that an imaxima process is running and to switch to its buffer:
(defun find-imaximaprocess (&rest rest)
(require 'imaxima)
(imaxima)
(find-ebuffer ;; this is similar to switch-to-buffer
(if imaxima-use-maxima-mode-flag
"*maxima*"
"*imaxima*")))
I took the
(if imaxima-use-maxima-mode-flag "*maxima*" "*imaxima*")
from the (cl-defun imaxima () ...). Is there a better way to find
the name of the imaxima buffer?
Btw, eev now supports imaxima (yay!), but it may be better to
rewrite the code above a bit... here are some details, for the
sake of completeness:
http://angg.twu.net/eev-intros/find-eepitch-intro.html#2.3
(find-eepitch-intro "2.3. `eepitch'")
About your second solution: it was exactly what I needed! I was
able to convert its output by hand to the format that emaxima.sty
expects in just a minute. =) =) =)
Cheers,
Eduardo Ochs
http://angg.twu.net/#eev
|