|
From: Robert D. <rob...@gm...> - 2025-03-03 02:28:30
|
On Sat, Mar 1, 2025 at 8:28 PM Jinsong Zhao <js...@ye...> wrote:
> Also, I don't know if my code can handle the results of the different
> display methods provided by maxima. I'd actually prefer it to handle
> tex(...) result, but I don't know how to write that result to with_stdout.
I'm not sure what you mean by handling the output of tex using
with_stdout. I think with_stdout already captures output produced by
tex, e.g. with_stdout(my_output, tex(...)), so I guess you must mean
something else, but I don't know what.
I noticed in the code that there is
extract_output(code_block, stream) := block(
file_output_append:false,
tmp_file: sconcat(maxima_tempdir,"/tmp.out"),
with_stdout(tmp_file, print(eval_string(code_block))),
tmp_str: openr(tmp_file),
while (tmp_line: readline(tmp_str)) # false do (
printf(stream, "~a~%", tmp_line)
),
close(tmp_str)
);
and there is a comment to the effect that you would like to simplify
this code. Towards that end, you can replace the function definition
with
extract_output (code_block, stream) := with_stdout (stream, print
(eval_string (code_block))));
since with_stdout also accepts an output stream as an argument in
addition to a file name.
As you work through various issues with tex output, you might find it
helpful to look set_tex_environment and set_tex_environment_default.
There are some other TeX-related functions; ?? tex will find them (and
other functions which happen to have "tex" in their names).
Hope this helps,
Robert
|