emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* org-mode for swi-prolog and latex export ?
@ 2014-07-20  7:54 Joseph Vidal-Rosset
  2014-07-20  8:05 ` Thorsten Jolitz
  0 siblings, 1 reply; 12+ messages in thread
From: Joseph Vidal-Rosset @ 2014-07-20  7:54 UTC (permalink / raw)
  To: Liste-emacs-orgmode@gnu.org

[-- Attachment #1: Type: text/plain, Size: 378 bytes --]

Hello the list,

Here is my question : is there a mean to use org-mode to export both the
prolog file (for example my-program.pl) and the documentation in .tex
(my-program.tex) ?

I see that there are solutions in swi-prolog but I have difficulties to
understand the documentation, and therefore I wonder if there is an
org-mode route.

I hope so.

In advance, many thanks

Jo.

[-- Attachment #2: Type: text/html, Size: 526 bytes --]

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

* Re: org-mode for swi-prolog and latex export ?
  2014-07-20  7:54 org-mode for swi-prolog and latex export ? Joseph Vidal-Rosset
@ 2014-07-20  8:05 ` Thorsten Jolitz
  2014-07-20 20:37   ` Joseph Vidal-Rosset
  0 siblings, 1 reply; 12+ messages in thread
From: Thorsten Jolitz @ 2014-07-20  8:05 UTC (permalink / raw)
  To: emacs-orgmode

Joseph Vidal-Rosset <joseph.vidal.rosset@gmail.com> writes:

> Hello the list, 
>
> Here is my question : is there a mean to use org-mode to export both
> the prolog file (for example my-program.pl) and the documentation in .
> tex (my-program.tex) ? 
>
> I see that there are solutions in swi-prolog but I have difficulties
> to understand the documentation, and therefore I wonder if there is an
> org-mode route. 

I have not seen an ob-prolog.el yet, but maybe it does exist?  If so,
exporting both code and result of its execution would be:

,----
| * My documentation
| 
| Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Donec
| hendrerit tempor tellus. Donec pretium posuere tellus. Proin quam
| nisl, tincidunt et, mattis eget, convallis nec, purus. Cum sociis
| natoque penatibus et magnis dis parturient montes, nascetur ridiculus
| mus. Nulla posuere. Donec vitae dolor. Nullam tristique diam non
| turpis. Cras placerat accumsan nulla. Nullam rutrum. Nam vestibulum
| accumsan nisl.
| 
| #+header: :exports both
| #+begin_src prolog
|  ( ... my-program ...)
| #+end_src
`----

PS
Code and documentation text is always exported together, thats what
Org Babel is for, as long as you don't specify :exports none or so. 

-- 
cheers,
Thorsten

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

* Re: org-mode for swi-prolog and latex export ?
  2014-07-20  8:05 ` Thorsten Jolitz
@ 2014-07-20 20:37   ` Joseph Vidal-Rosset
  2014-07-20 21:38     ` Thomas S. Dye
  0 siblings, 1 reply; 12+ messages in thread
From: Joseph Vidal-Rosset @ 2014-07-20 20:37 UTC (permalink / raw)
  To: Thorsten Jolitz; +Cc: Liste-emacs-orgmode@gnu.org

[-- Attachment #1: Type: text/plain, Size: 1180 bytes --]

2014-07-20 10:05 GMT+02:00 Thorsten Jolitz <tjolitz@gmail.com>:

> I have not seen an ob-prolog.el yet, but maybe it does exist?  If so,
> exporting both code and result of its execution would be:
>
> ,----
> | * My documentation
> |
> | Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Donec
> | hendrerit tempor tellus. Donec pretium posuere tellus. Proin quam
> | nisl, tincidunt et, mattis eget, convallis nec, purus. Cum sociis
> | natoque penatibus et magnis dis parturient montes, nascetur ridiculus
> | mus. Nulla posuere. Donec vitae dolor. Nullam tristique diam non
> | turpis. Cras placerat accumsan nulla. Nullam rutrum. Nam vestibulum
> | accumsan nisl.
> |
> | #+header: :exports both
> | #+begin_src prolog
> |  ( ... my-program ...)
> | #+end_src
> `----
>
> PS
> Code and documentation text is always exported together, thats what
> Org Babel is for, as long as you don't specify :exports none or so.
>

Thanks for this reply. Unfortunately, I don't see option to export into
the prolog .pl format. If someone can explain to me how export any code
(python , prolog, ocaml, etc.)  if it is possible with org-mode, I will be
thankfull.

Best regards,

Jo.

[-- Attachment #2: Type: text/html, Size: 1700 bytes --]

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

* Re: org-mode for swi-prolog and latex export ?
  2014-07-20 20:37   ` Joseph Vidal-Rosset
@ 2014-07-20 21:38     ` Thomas S. Dye
  2014-07-21  4:16       ` Nick Dokos
  0 siblings, 1 reply; 12+ messages in thread
From: Thomas S. Dye @ 2014-07-20 21:38 UTC (permalink / raw)
  To: Joseph Vidal-Rosset; +Cc: Liste-emacs-orgmode@gnu.org, Thorsten Jolitz

Aloha Jo,

Joseph Vidal-Rosset <joseph.vidal.rosset@gmail.com> writes:

> 2014-07-20 10:05 GMT+02:00 Thorsten Jolitz <tjolitz@gmail.com>:
>
>> I have not seen an ob-prolog.el yet, but maybe it does exist?  If so,
>> exporting both code and result of its execution would be:
>
> Thanks for this reply. Unfortunately, I don't see option to export into
> the prolog .pl format. If someone can explain to me how export any code
> (python , prolog, ocaml, etc.)  if it is possible with org-mode, I will be
> thankfull.

I don't see Prolog on the list of supported languages:

http://orgmode.org/worg/org-contrib/babel/languages.html

There are instructions for developing support for other languages:

http://orgmode.org/worg/org-contrib/babel/languages.html#develop

You'll want to "tangle" the .pl source code file and "export" the
documentation. 

hth,
Tom

-- 
Thomas S. Dye
http://www.tsdye.com

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

* Re: org-mode for swi-prolog and latex export ?
  2014-07-20 21:38     ` Thomas S. Dye
@ 2014-07-21  4:16       ` Nick Dokos
  2014-07-21  9:15         ` Joseph Vidal-Rosset
  0 siblings, 1 reply; 12+ messages in thread
From: Nick Dokos @ 2014-07-21  4:16 UTC (permalink / raw)
  To: emacs-orgmode

tsd@tsdye.com (Thomas S. Dye) writes:

> Aloha Jo,
>
> Joseph Vidal-Rosset <joseph.vidal.rosset@gmail.com> writes:
>
>> 2014-07-20 10:05 GMT+02:00 Thorsten Jolitz <tjolitz@gmail.com>:
>>
>>> I have not seen an ob-prolog.el yet, but maybe it does exist?  If so,
>>> exporting both code and result of its execution would be:
>>
>> Thanks for this reply. Unfortunately, I don't see option to export into
>> the prolog .pl format. If someone can explain to me how export any code
>> (python , prolog, ocaml, etc.)  if it is possible with org-mode, I will be
>> thankfull.
>
> I don't see Prolog on the list of supported languages:
>
> http://orgmode.org/worg/org-contrib/babel/languages.html
>
> There are instructions for developing support for other languages:
>
> http://orgmode.org/worg/org-contrib/babel/languages.html#develop
>
> You'll want to "tangle" the .pl source code file and "export" the
> documentation. 
>

The first sentence of the doc that Tom pointed to is:

,----
| The core Babel functions (viewing, export, tangling, etc…) are language
| agnostic and will work even for languages that are not explicitly
| supported. Explicit language-specific support is required only for
| evaluation of code blocks in a language.
`----

So maybe nothing more is needed for just exporting and tangling
(completely untested).
-- 
Nick

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

* Re: org-mode for swi-prolog and latex export ?
  2014-07-21  4:16       ` Nick Dokos
@ 2014-07-21  9:15         ` Joseph Vidal-Rosset
  2014-07-21 10:01           ` Thorsten Jolitz
  0 siblings, 1 reply; 12+ messages in thread
From: Joseph Vidal-Rosset @ 2014-07-21  9:15 UTC (permalink / raw)
  To: Nick Dokos; +Cc: Liste-emacs-orgmode@gnu.org

[-- Attachment #1: Type: text/plain, Size: 701 bytes --]

2014-07-21 6:16 GMT+02:00 Nick Dokos <ndokos@gmail.com>:

> The first sentence of the doc that Tom pointed to is:
>
> ,----
> | The core Babel functions (viewing, export, tangling, etc…) are language
> | agnostic and will work even for languages that are not explicitly
> | supported. Explicit language-specific support is required only for
> | evaluation of code blocks in a language.
> `----
>
> So maybe nothing more is needed for just exporting and tangling
> (completely untested).
>


Yes, but I do not know how to define such and such language to export. When
I Cc -Ce  I can export to latex and html for example , but I do not know
how to extend this list.

Best

Jo.

[-- Attachment #2: Type: text/html, Size: 1175 bytes --]

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

* Re: org-mode for swi-prolog and latex export ?
  2014-07-21  9:15         ` Joseph Vidal-Rosset
@ 2014-07-21 10:01           ` Thorsten Jolitz
  2014-07-21 10:19             ` Nick Dokos
  0 siblings, 1 reply; 12+ messages in thread
From: Thorsten Jolitz @ 2014-07-21 10:01 UTC (permalink / raw)
  To: emacs-orgmode

Joseph Vidal-Rosset <joseph.vidal.rosset@gmail.com> writes:

> 2014-07-21 6:16 GMT+02:00 Nick Dokos <ndokos@gmail.com>:
>
>     The first sentence of the doc that Tom pointed to is:
>     
>     ,----
>     | The core Babel functions (viewing, export, tangling, etc…) are
>     language
>     | agnostic and will work even for languages that are not
>     explicitly
>     | supported. Explicit language-specific support is required only
>     for
>     | evaluation of code blocks in a language.
>     `----
>     
>     So maybe nothing more is needed for just exporting and tangling
>     (completely untested).
>
> Yes, but I do not know how to define such and such language to export.
> When I Cc -Ce I can export to latex and html for example , but I do
> not know how to extend this list. 

This is a (lisp)programmers task. The usual proceeding would be to look
at the list of extisting ob-<language>.el files and pick a language that
is very similar to the new one (in case of prolog maybe a difficult
task?). Then try to adapt this file to your new language -> ob-prolog.el.

-- 
cheers,
Thorsten

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

* Re: org-mode for swi-prolog and latex export ?
  2014-07-21 10:01           ` Thorsten Jolitz
@ 2014-07-21 10:19             ` Nick Dokos
  2014-07-21 10:34               ` Joseph Vidal-Rosset
  0 siblings, 1 reply; 12+ messages in thread
From: Nick Dokos @ 2014-07-21 10:19 UTC (permalink / raw)
  To: emacs-orgmode

Thorsten Jolitz <tjolitz@gmail.com> writes:

> Joseph Vidal-Rosset <joseph.vidal.rosset@gmail.com> writes:
>
>> 2014-07-21 6:16 GMT+02:00 Nick Dokos <ndokos@gmail.com>:
>>
>>     The first sentence of the doc that Tom pointed to is:
>>     
>>     ,----
>>     | The core Babel functions (viewing, export, tangling, etc…) are
>>     language
>>     | agnostic and will work even for languages that are not
>>     explicitly
>>     | supported. Explicit language-specific support is required only
>>     for
>>     | evaluation of code blocks in a language.
>>     `----
>>     
>>     So maybe nothing more is needed for just exporting and tangling
>>     (completely untested).
>>
>> Yes, but I do not know how to define such and such language to export.
>> When I Cc -Ce I can export to latex and html for example , but I do
>> not know how to extend this list. 
>

I don't understand: what language are you trying to export to? My take
was that you export the doc to latex/pdf/html and you tangle the code
fragments to some arbitrary file (a file that can be fed to a prolog
interpeter to be executed).

> This is a (lisp)programmers task. The usual proceeding would be to look
> at the list of extisting ob-<language>.el files and pick a language that
> is very similar to the new one (in case of prolog maybe a difficult
> task?). Then try to adapt this file to your new language -> ob-prolog.el.

Assuming that the statement I quoted is true, one should be able to
export files that contain prolog code fragments:

#+BEGIN_SRC prolog
foo
#+END_SRC

One has to do `:exports code' since exporting results would require
evaluation which *would* require that one write an ob-prolog.el.

Also, one should be able to tangle the prolog code fragment(s) into
files (no ob-prolog.el needed).

Exporting and tangling  are generic services that babel provides even if
there is no evaluation for that language.

But as I said, I have not tried it: I am only trying to interpret what
the doc is saying, so when the eating comes, the pudding may be stale.
If the interpretation is wrong, I would love to be corrected. If the
interpretation is right, but the exporting/tangling does not work, then
that would be a babel bug.

Nick

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

* Re: org-mode for swi-prolog and latex export ?
  2014-07-21 10:19             ` Nick Dokos
@ 2014-07-21 10:34               ` Joseph Vidal-Rosset
  2014-07-21 13:40                 ` Nick Dokos
  0 siblings, 1 reply; 12+ messages in thread
From: Joseph Vidal-Rosset @ 2014-07-21 10:34 UTC (permalink / raw)
  To: Nick Dokos; +Cc: Liste-emacs-orgmode@gnu.org

[-- Attachment #1: Type: text/plain, Size: 1790 bytes --]

Dear Nick,

2014-07-21 12:19 GMT+02:00 Nick Dokos <ndokos@gmail.com>:

> I don't understand: what language are you trying to export to? My take
> was that you export the doc to latex/pdf/html and you tangle the code
> fragments to some arbitrary file (a file that can be fed to a prolog
> interpeter to be executed).
>

You have quite correctly undersood me.


>
> > This is a (lisp)programmers task. The usual proceeding would be to look
> > at the list of extisting ob-<language>.el files and pick a language that
> > is very similar to the new one (in case of prolog maybe a difficult
> > task?). Then try to adapt this file to your new language -> ob-prolog.el.
>
> Assuming that the statement I quoted is true, one should be able to
> export files that contain prolog code fragments:
>
> #+BEGIN_SRC prolog
> foo
> #+END_SRC
>
> One has to do `:exports code' since exporting results would require
> evaluation which *would* require that one write an ob-prolog.el.
>
> Also, one should be able to tangle the prolog code fragment(s) into
> files (no ob-prolog.el needed).
>

It is only because I do not understand how to "tangle the (prolog) code". I
know the export function but I know nothing about tangle. Do not feel
forced to answer. I know that I have to read the documentation first and I
apologize.


> Exporting and tangling  are generic services that babel provides even if
> there is no evaluation for that language.
>
> But as I said, I have not tried it: I am only trying to interpret what
> the doc is saying, so when the eating comes, the pudding may be stale.
> If the interpretation is wrong, I would love to be corrected. If the
> interpretation is right, but the exporting/tangling does not work, then
> that would be a babel bug.
>

I do not know.

Best wishes,

Jo.

[-- Attachment #2: Type: text/html, Size: 2912 bytes --]

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

* Re: org-mode for swi-prolog and latex export ?
  2014-07-21 10:34               ` Joseph Vidal-Rosset
@ 2014-07-21 13:40                 ` Nick Dokos
  2014-07-21 17:49                   ` Joseph Vidal-Rosset
  0 siblings, 1 reply; 12+ messages in thread
From: Nick Dokos @ 2014-07-21 13:40 UTC (permalink / raw)
  To: emacs-orgmode

Joseph Vidal-Rosset <joseph.vidal.rosset@gmail.com> writes:

> It is only because I do not understand how to "tangle the (prolog)
> code". I know the export function but I know nothing about tangle. Do
> not feel forced to answer. I know that I have to read the
> documentation first and I apologize.
>

C-c C-v C-t

or

M-x org-babel-tangle

-- 
Nick

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

* Re: org-mode for swi-prolog and latex export ?
  2014-07-21 13:40                 ` Nick Dokos
@ 2014-07-21 17:49                   ` Joseph Vidal-Rosset
  2014-07-21 18:27                     ` Nick Dokos
  0 siblings, 1 reply; 12+ messages in thread
From: Joseph Vidal-Rosset @ 2014-07-21 17:49 UTC (permalink / raw)
  To: Nick Dokos; +Cc: Liste-emacs-orgmode@gnu.org

[-- Attachment #1: Type: text/plain, Size: 456 bytes --]

2014-07-21 15:40 GMT+02:00 Nick Dokos <ndokos@gmail.com>:

>
> > It is only because I do not understand how to "tangle the (prolog)
> > code". I know the export function but I know nothing about tangle. Do
> > not feel forced to answer. I know that I have to read the
> > documentation first and I apologize.
> >
>
> C-c C-v C-t
>
> or
>
> M-x org-babel-tangle


Dear Nick,

Many thanks for your impressive patience with newbies like me.

Best wishes

Jo.

[-- Attachment #2: Type: text/html, Size: 1013 bytes --]

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

* Re: org-mode for swi-prolog and latex export ?
  2014-07-21 17:49                   ` Joseph Vidal-Rosset
@ 2014-07-21 18:27                     ` Nick Dokos
  0 siblings, 0 replies; 12+ messages in thread
From: Nick Dokos @ 2014-07-21 18:27 UTC (permalink / raw)
  To: emacs-orgmode

Joseph Vidal-Rosset <joseph.vidal.rosset@gmail.com> writes:

> 2014-07-21 15:40 GMT+02:00 Nick Dokos <ndokos@gmail.com>:
>
>     > It is only because I do not understand how to "tangle the (prolog)
>     > code". I know the export function but I know nothing about tangle. Do
>     > not feel forced to answer. I know that I have to read the
>     > documentation first and I apologize.
>     >
>    
>     C-c C-v C-t
>    
>     or
>    
>     M-x org-babel-tangle
>
> Dear Nick,
>
> Many thanks for your impressive patience with newbies like me.
>

No problem - btw, I tried tangling the following and it worked with no
problems:

--8<---------------cut here---------------start------------->8---
#+PROPERTY: :exports code

* Documentation

This is documentation. It refers to a Prolog code
block which we want to tangle:

#+BEGIN_SRC prolog :tangle yes
foo :- bar.
#+END_SRC

#+BEGIN_SRC emacs-lisp :tangle yes
(setq foo bar)
#+END_SRC

#+name: preamble
#+begin_src latex :tangle preamble.tex
  % code goes here
#+end_src


--8<---------------cut here---------------end--------------->8---

Nick

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

end of thread, other threads:[~2014-07-21 18:30 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-07-20  7:54 org-mode for swi-prolog and latex export ? Joseph Vidal-Rosset
2014-07-20  8:05 ` Thorsten Jolitz
2014-07-20 20:37   ` Joseph Vidal-Rosset
2014-07-20 21:38     ` Thomas S. Dye
2014-07-21  4:16       ` Nick Dokos
2014-07-21  9:15         ` Joseph Vidal-Rosset
2014-07-21 10:01           ` Thorsten Jolitz
2014-07-21 10:19             ` Nick Dokos
2014-07-21 10:34               ` Joseph Vidal-Rosset
2014-07-21 13:40                 ` Nick Dokos
2014-07-21 17:49                   ` Joseph Vidal-Rosset
2014-07-21 18:27                     ` Nick Dokos

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).