emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [BUG] ob-doc-maxima.org and ob-maxima.el


From: Ihor Radchenko
Subject: Re: [BUG] ob-doc-maxima.org and ob-maxima.el
Date: Fri, 04 Nov 2022 03:38:48 +0000

Leo Butler <Leo.Butler@umanitoba.ca> writes:

>> You basically need to evaluate the code block manually to have it
>> present in the original file without a need to evaluate during export.
>>
>> I do not have maxima on my system. It would be welcome if you evaluate
>> the code blocks with missing results manually and submit a patch with.
>
> Attached.

There is no need to wrap the results into example blocks. They will
better be as is. Org export will take care about choosing what to
export: code, results, or both.

>> Using graphics together with file does not make sense.
>
> Ok. But I am not sure the code agrees with you. In ob-core.el,
> `org-babel-graphical-output-file' is defined as:

Let's discuss it in a separate thread. I will need to study the code a
bit more to understand what we promise in the manual vs. actual state of
the code.

>  #+name: 3d-maxima
>  #+header: :file images/maxima-3d.png
> -#+header: :results graphics
>  #+header: :exports results
> +#+header: :results file
>  #+begin_src maxima 
>    programmode: false;
>    
> plot3d(atan(-x^2+y^3/4),[x,-4,4],[y,-4,4],[grid,50,50],[gnuplot_pm3d,true]);
>  #+end_src
>  
> -#+results: 3d-maxima
> +Which produces the code:
> +
> +#+begin_example
> +,#+RESULTS: 3d-maxima
>  [[file:images/maxima-3d.png]]
> +#+end_example
> +
> +and the image:
> +
> +#+RESULTS: 3d-maxima
> +[[https://orgmode.org/worg/org-contrib/babel/languages/images/maxima-3d.png]]
> +

I am a bit confused here. Did you hand-craft the results?
  
> -#+NAME: solve-maxima
> +#+NAME: tex-maxima
>  #+HEADER: :exports results
>  #+BEGIN_SRC maxima :results raw
>    tex(exp(-x)/x);
>  #+END_SRC
>  
> +Which produces the code:
> +#+begin_example
> +,#+RESULTS: tex-maxima
> +$${{e^ {- x }}\over{x}}$$
> +#+end_example
> +that is rendered as:
> +#+RESULTS: tex-maxima
> +$${{e^ {- x }}\over{x}}$$

Please make #+RESULTS a separate paragraph. It may otherwise not be
correctly recognized.

> --- a/lisp/ob-maxima.el
> +++ b/lisp/ob-maxima.el
> @@ -77,6 +77,9 @@
>    "Execute a block of Maxima entries with org-babel.
>  This function is called by `org-babel-execute-src-block'."
>    (message "Executing Maxima source code block")
> +  ;; Make `:results file' imply `:results graphics file'
> +  (when (member "file" (assq :result-params params))
> +    (push "graphics" (alist-get :result-params params)))
>    (let ((result-params (split-string (or (cdr (assq :results params)) "")))
>       (result
>        (let* ((cmdline (or (cdr (assq :cmdline params)) ""))

Let's move the ob-maxima changes and discussion about graphics to a
separate thread.

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>



reply via email to

[Prev in Thread] Current Thread [Next in Thread]