emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* How to export both Asymptote code and its result
@ 2012-05-30  7:13 Vladimir Lomov
  2012-05-30  7:31 ` Nick Dokos
  0 siblings, 1 reply; 4+ messages in thread
From: Vladimir Lomov @ 2012-05-30  7:13 UTC (permalink / raw)
  To: Emacs Org Mode

* Asymptote example

Hello, can someone enlighten me what's the problem with the following
example:

I want to export both the Asymptote code and its (PNG) result:
#+NAME: fig1
#+BEGIN_SRC asymptote :export code
size(100);

draw((0,0)--(1,0)--(1,1)--cycle);
#+END_SRC

This must be the result:
#+CALL: fig1 :file "fig1.png"

What I expect: the (highlighted) code and below it the resulted image.

I added Asymptote to the list of Babel "active" languages
#+BEGIN_SRC emacs-lisp
;;; Before lines are skipped
(org-babel-do-load-languages
  'org-babel-load-languages
  '((emacs-lisp . t)
    (gnuplot . t)
    (asymptote . t)
    (latex . t)
    (perl . t)
    (sh . t))
)
;;; Rest lines are too.
#+END_SRC

When I export to HTML I confirm the code evaluation,
but instead of the code and result I get nothing.

If I comment the =asymptote= setting in above code then I get the code
but not the image.

Is it limitation of Asymptote support or I do something wrong?

Also, I don't understand why viewer is run to show me the result of
code evaluation (actually I know, because of ~-V~ option passed to
~asy~, but why it is passed to it?).

My env:
Emacs 24.1.50.1 (compiled from BZR trunk)
Org-mode version 7.8.11 (=release_7.8.11-18-g244331 @ /usr/share/emacs/site-lisp/org/=)

---
WBR, Vladimir Lomov


-- 
You got to pay your dues if you want to sing the blues,
And you know it don't come easy ...
I don't ask for much, I only want trust,
And you know it don't come easy ...

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: How to export both Asymptote code and its result
  2012-05-30  7:13 How to export both Asymptote code and its result Vladimir Lomov
@ 2012-05-30  7:31 ` Nick Dokos
  2012-05-30  8:01   ` Vladimir Lomov
  0 siblings, 1 reply; 4+ messages in thread
From: Nick Dokos @ 2012-05-30  7:31 UTC (permalink / raw)
  To: Vladimir Lomov; +Cc: Emacs Org Mode

Vladimir Lomov <lomov.vl@gmail.com> wrote:

> * Asymptote example
> 
> Hello, can someone enlighten me what's the problem with the following
> example:
> 
> I want to export both the Asymptote code and its (PNG) result:
> #+NAME: fig1
> #+BEGIN_SRC asymptote :export code

This should be ``:exports both''

See
	(info "(org) exports")

Nick

> size(100);
> 
> draw((0,0)--(1,0)--(1,1)--cycle);
> #+END_SRC
> 
> This must be the result:
> #+CALL: fig1 :file "fig1.png"
> 
> What I expect: the (highlighted) code and below it the resulted image.
> 
> I added Asymptote to the list of Babel "active" languages
> #+BEGIN_SRC emacs-lisp
> ;;; Before lines are skipped
> (org-babel-do-load-languages
>   'org-babel-load-languages
>   '((emacs-lisp . t)
>     (gnuplot . t)
>     (asymptote . t)
>     (latex . t)
>     (perl . t)
>     (sh . t))
> )
> ;;; Rest lines are too.
> #+END_SRC
> 
> When I export to HTML I confirm the code evaluation,
> but instead of the code and result I get nothing.
> 
> If I comment the =asymptote= setting in above code then I get the code
> but not the image.
> 
> Is it limitation of Asymptote support or I do something wrong?
> 
> Also, I don't understand why viewer is run to show me the result of
> code evaluation (actually I know, because of ~-V~ option passed to
> ~asy~, but why it is passed to it?).
> 
> My env:
> Emacs 24.1.50.1 (compiled from BZR trunk)
> Org-mode version 7.8.11 (=release_7.8.11-18-g244331 @ /usr/share/emacs/site-lisp/org/=)
> 
> ---
> WBR, Vladimir Lomov
> 
> 
> -- 
> You got to pay your dues if you want to sing the blues,
> And you know it don't come easy ...
> I don't ask for much, I only want trust,
> And you know it don't come easy ...
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: How to export both Asymptote code and its result
  2012-05-30  7:31 ` Nick Dokos
@ 2012-05-30  8:01   ` Vladimir Lomov
  2012-05-30 15:22     ` Eric Schulte
  0 siblings, 1 reply; 4+ messages in thread
From: Vladimir Lomov @ 2012-05-30  8:01 UTC (permalink / raw)
  To: Nick Dokos; +Cc: Emacs Org Mode

Hello,
** Nick Dokos [2012-05-30 03:31:02 -0400]:

> Vladimir Lomov <lomov.vl@gmail.com> wrote:

>> * Asymptote example

>> Hello, can someone enlighten me what's the problem with the following
>> example:

>> I want to export both the Asymptote code and its (PNG) result:
>> #+NAME: fig1
>> #+BEGIN_SRC asymptote :export code

> This should be ``:exports both''

> See
> 	(info "(org) exports")

> Nick

Thanks Nick, a typo :)

I changed that and added ``:file "fig1.png"'' in header so now HTML has both: code
and image.

>> size(100);

>> draw((0,0)--(1,0)--(1,1)--cycle);
>> #+END_SRC

>> This must be the result:
>> #+CALL: fig1 :file "fig1.png"

So I don't get the idea of ``#+CALL''. It doesn't work in this case. I
thought I can show code and after small explanation the resulted
image. But seems I'm allowed to get PNG file only with BEGIN|END_SRC
block while image be placed right after the block.

I came to this:

#+NAME: fig1
#+BEGIN_SRC asymptote :exports both :results silent :file "fig1.png"
<<CODE>>
#+END_SRC

Result:\\
[[./fig1.png]]

This is essential that I want.

Thanks again.

>> What I expect: the (highlighted) code and below it the resulted image.

>> I added Asymptote to the list of Babel "active" languages
>> #+BEGIN_SRC emacs-lisp
>> ;;; Before lines are skipped
>> (org-babel-do-load-languages
>>   'org-babel-load-languages
>>   '((emacs-lisp . t)
>>     (gnuplot . t)
>>     (asymptote . t)
>>     (latex . t)
>>     (perl . t)
>>     (sh . t))
>> )
>> ;;; Rest lines are too.
>> #+END_SRC

>> When I export to HTML I confirm the code evaluation,
>> but instead of the code and result I get nothing.

>> If I comment the =asymptote= setting in above code then I get the code
>> but not the image.

>> Is it limitation of Asymptote support or I do something wrong?

>> Also, I don't understand why viewer is run to show me the result of
>> code evaluation (actually I know, because of ~-V~ option passed to
>> ~asy~, but why it is passed to it?).

>> My env:
>> Emacs 24.1.50.1 (compiled from BZR trunk)
>> Org-mode version 7.8.11 (=release_7.8.11-18-g244331 @ /usr/share/emacs/site-lisp/org/=)

---
WBR, Vladimir Lomov

-- 
A prisoner of war is a man who tries to kill you and fails, and then
asks you not to kill him.
		-- Sir Winston Churchill, 1952

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: How to export both Asymptote code and its result
  2012-05-30  8:01   ` Vladimir Lomov
@ 2012-05-30 15:22     ` Eric Schulte
  0 siblings, 0 replies; 4+ messages in thread
From: Eric Schulte @ 2012-05-30 15:22 UTC (permalink / raw)
  To: Vladimir Lomov; +Cc: Nick Dokos, Emacs Org Mode

Vladimir Lomov <lomov.vl@gmail.com> writes:
>
> So I don't get the idea of ``#+CALL''. It doesn't work in this case. I
> thought I can show code and after small explanation the resulted
> image. But seems I'm allowed to get PNG file only with BEGIN|END_SRC
> block while image be placed right after the block.
>

The placement of header arguments in #+call lines can be tricky.  What
you want to do is possible, please review the syntax of call lines in
the manual.

http://orgmode.org/manual/Evaluating-code-blocks.html

>
> I came to this:
>
> #+NAME: fig1
> #+BEGIN_SRC asymptote :exports both :results silent :file "fig1.png"
> <<CODE>>
> #+END_SRC
>
> Result:\\
> [[./fig1.png]]
>
> This is essential that I want.
>

If your main goal is simply to separate the code block and the result
you do not need to use call lines.  With a names code block the result
may live *anywhere* in the Org-mode file and need not immediately follow
the code block.

Best,

>
> Thanks again.
>
>>> What I expect: the (highlighted) code and below it the resulted image.
>
>>> I added Asymptote to the list of Babel "active" languages
>>> #+BEGIN_SRC emacs-lisp
>>> ;;; Before lines are skipped
>>> (org-babel-do-load-languages
>>>   'org-babel-load-languages
>>>   '((emacs-lisp . t)
>>>     (gnuplot . t)
>>>     (asymptote . t)
>>>     (latex . t)
>>>     (perl . t)
>>>     (sh . t))
>>> )
>>> ;;; Rest lines are too.
>>> #+END_SRC
>
>>> When I export to HTML I confirm the code evaluation,
>>> but instead of the code and result I get nothing.
>
>>> If I comment the =asymptote= setting in above code then I get the code
>>> but not the image.
>
>>> Is it limitation of Asymptote support or I do something wrong?
>
>>> Also, I don't understand why viewer is run to show me the result of
>>> code evaluation (actually I know, because of ~-V~ option passed to
>>> ~asy~, but why it is passed to it?).
>
>>> My env:
>>> Emacs 24.1.50.1 (compiled from BZR trunk)
>>> Org-mode version 7.8.11 (=release_7.8.11-18-g244331 @ /usr/share/emacs/site-lisp/org/=)
>
> ---
> WBR, Vladimir Lomov

-- 
Eric Schulte
http://cs.unm.edu/~eschulte

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2012-05-30 15:22 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-05-30  7:13 How to export both Asymptote code and its result Vladimir Lomov
2012-05-30  7:31 ` Nick Dokos
2012-05-30  8:01   ` Vladimir Lomov
2012-05-30 15:22     ` Eric Schulte

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).