Discussion:
[AUCTeX] [Maxima-discuss] Maxima within LaTeX
e***@openmail.cc
2016-03-08 20:16:35 UTC
Permalink
Hi. This is a preliminary question. As some of you know, I'm interested
in being able to work on my LaTeX documents with Maxima code as if they
were part of the same thing. There are many players here:
(1) emacs:
(1.a) AucTeX.
(1.b) imaxima (may be it could be extended for LaTeX.
(2) LaTeX
(3) Maxima
(4) Although I use emacs, I don't know what I'm doing half of the time.

The question is: to whom should I ask? I don't want to bother people
who need to focus on other things. If I ask to multiple parties, do I
have to let everyone know about it (put every mailing list in the
thread?). And finally, do you have the time for this or is it better to
just stick to my yanking (copy-paste) activities? Thanks in advance.
I need to think about this. I have a question: Are you thinking of a
document where you have blocks of maxima code, the code does some
computations, and then in subsequent blocks you have access to the
results of these computations?
Yes, without loosing the ability to be able to print LaTeX with the
block itself (as it is done already). I send some examples below.
E.g.
\begin{maxima*}
p : primes(1,10);
\maximaoutput
[2,3,5,7]
\end{maxima*}
I don't know if producing the output here is necessary, even if it is
not printed in the final version (dvi, ps or pdf). It could be useful
when reading the code, but it should be optional. There is an example
further down.
The list of the primes between 1 and 10 is
\[
\mvalue{p}
\]
?
(The maxima* environment produces no output; \mvalue is undefined but
it
would produce tex(p)).
Yes, precisely. I think that it should be the first step. Then it
would even
make something like this
An identity matrix is shown in \cref{eq:A}
\begin{equation}\label{eq:A}
\begin{maxicode}
A: ident(3)$ /* This prints nothing */
'A = A; /* This prints tex('A = A), A is a matrix */
\end{maxicode}
\end{equation}
May be even, to show the same output \cref{eq:B} the code could be
condensed
\begin{maxieq}\label{eq:B}
B: ident(3)$ /* This prints nothing */
'B = B; /* This prints tex('B = B), B is a matrix */
\end{maxieq}
In a similar way, the product of an identity matrix ($C$) with the
third prime ($p_{3}$) would be in \cref{eq:C}, \cref{eq:D2} or
\cref{eq:E2}.
\begin{maxima*}
p : primes(1,10); /* This line should send the TeX code already */
\maximaoutput % Optional (no need to C-c C-u C ; never printed
% Optional in dvi, ps or pdf, even without *, and
[2,3,5,7] % Optional just for visual confirmation while
writing)
\end{maxima*}
In the code above, I think that the line after maximaoutput should
just be for visual confirmation while writing, so that the user
doesn't need to C-c C-u C or C-c C-u A . However, evaluating it should
be possible to make sure that the output is correct while writing (as
a preview without compiling). Now, if the preview is not possible, I
deem the evaluation and the proper rendering of the equation more
important, and would drop the preview.
I think that it should work with align, subequations and the autonum
package, also.
\begin{align}\label{eq:C}
\begin{maxicode}
C: ident(3)$
\end{maxicode}
\mvalue{'C*p[3]} &= \mvalue{C}\,\mvalue{p[3]} \\ % C\,p &=
tex(C)\,tex(p)
&= \mvalue{C*p[3]} % &= tex(C*p[3])
\end{equation}
Now, this is just an idea, and I know it's too much right now, but may
be this could come later (instead of the code for \cref{eq:C})
\begin{maxialn}[breqn]\label{eq:D}
D: ident(3)$
\op{'D*p[3]} &= \op{D*p[3]}; \\ % C\,p &= tex(C)\,tex(p)
&= \val{D*p[3]}; % &= tex(C*p[3])
\end{maxialn}
or something like
\begin{subequations}\label{eq:E}
\begin{maxialn}
E: ident(3)$
\op{'E*p[3]} &= \op{E*p[3]}; \label{eq:E1} \\ /* This would work
with */
&= \val{E*p[3]}; \label{eq:E2} /* autonum (no
number */
/* next to eq:E1)
*/
\begin{maxialn}
\end{subequations}
What I'm trying to show with the last two blocks is that may be it
could start becoming almost inevident that there is something in the
background doing the calculations. I'm just being imaginative.
-------------------------------------------------

ONLY AT VFEmail! - Use our Metadata Mitigator to keep your email out of the NSA's hands!
$24.95 ONETIME Lifetime accounts with Privacy Features!
15GB disk! No bandwidth quotas!
Commercial and Bulk Mail Options!
Robert Dodier
2016-03-09 20:31:09 UTC
Permalink
Post by e***@openmail.cc
The question is: to whom should I ask? I don't want to bother people
who need to focus on other things. If I ask to multiple parties, do I
have to let everyone know about it (put every mailing list in the
thread?). And finally, do you have the time for this or is it better to
just stick to my yanking (copy-paste) activities? Thanks in advance.
It makes sense to me to post any Maxima-related questions on this
mailing list, even if Maxima is only part of the picture. As ever,
there's no guarantee that anyone will be able to answer, but that's
nothing new.

As to combining Maxima and LaTeX, one way to do that which might be
suitable for your purposes is to use Jupyter (formerly IPython) which
presents a notebook interface. I've devised a Maxima kernel (i.e.
backend) for Jupyter and I believe it might be easier to get that
working that to put together the entire tool chain. Maybe you've
already considered that, if so, sorry for the noise. In case it's
relevant, see: https://github.com/robert-dodier/maxima-jupyter

best

Robert Dodier
Jorge A. Alfaro-Murillo
2016-03-09 20:47:23 UTC
Permalink
Post by Robert Dodier
As to combining Maxima and LaTeX, one way to do that which might
be suitable for your purposes is to use Jupyter (formerly
IPython) which presents a notebook interface.
You could also try notebooks of SageMathCloud that already include
Maxima and LaTeX support: https://cloud.sagemath.com/

If you install sage locally, then you can also use the sagetex
package that would allow you to just write LaTeX but use Maxima
code inside the LaTeX file:

http://doc.sagemath.org/html/en/tutorial/sagetex.html

and check this on how to run Maxima code with sage:

http://doc.sagemath.org/html/en/tutorial/interfaces.html

Best,
--
Jorge.
Loading...