On 2014-12-01 22:43, Leo Butler wrote:
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.