Re: [O] org-mode, tikz and beamer

2015-05-25 Thread Suvayu Ali
Hello Cédric,

First, apologies for the delay.  I am swamped with a lot of things for a
while now, makes my responses rather irregular.

On Thu, May 21, 2015 at 10:33:13PM +0200, cédric ody wrote:
 Thank you for your answer.
 
 Here is the shell script (many comments are in english except the
 beginning) and the org file I use. To see how I call it, you can have
 a look at the enclosed Makefile. Note that it uses specific
 configurations files as well tex macros so it won't work without these
 files. I can prepare a short example which generates the tex and pdf
 files if needed. The script probably gives for now a good idea. You
 can also look at the enclosed generated tex file to see how the tikz
 language.

I think you forgot the Makefile.  Aside from that, I looked at the
script, and the Org file, albeit not very thoroughly.  My impression is,
it is a really nice effort but I think it's unsustainable.  You have to
duplicate a lot of work, and since you do it in a shell script, you are
limited.  Here are a few particular points:

- You reimplement the Org parser.  This of course means you do not
  support a large part of the standard syntax[1].  It's not future proof
  either.  For the same reasons, it is very brittle.  Org-element does a
  great job of parsing, you should use it.

- You seem to rely on specific cookies, like `%%%' (and maybe abusing
  tags like noexport?).  This is introducing _new_ syntax.  Again, since
  this is outside of org-element, there is no way to ensure robustness
  and reproducibility.

 Basically, the shell script looks recursively into the org file and
 creates nodes for the tikz headline mindmaps. Thus, there are parent
 nodes and children nodes.
 
 During that excursion, two kinds of files are created: the tree
 files and the contents files.
 
 The first ones are tex files with tikz mindmaps that must be inserted
 at specific locations at the final latex compilation step. One tree
 file contains the parent node with all the children files.

This part sounds good.

 The contents files are org files and are converted into tex files
 via the org-mode export command in a batch way. In the shell script,
 hyperlinks are added to these newly converted tex files.

This, I'm not completely certain.  If I got this right, you export one
file per beamer frame?  Is that right?  I also see you do a bit of
editing with sed.  Again, I think this makes it too brittle, too many
assumptions about what is present and what is not.

 At the end, the assembly of all these files is done before compiling.
 
 Numbering of sections through the recursive call is important so that
 links work properly as you notice. Links allow one to go back and
 forth the document. To go back, the idea is to click on the headline.
 If a node exists without content, the links sends you the beginning of
 the file or something like that.

This part I'm not sure I quite understand.  Shouldn't normal LaTeX
referencing mechanisms (à la \label and \ref) be able to handle this?  

Anyway, after looking at the script I'm convinced this endeavour is
better pursued in lisp.  I think it would help if you draft a document
outlining the Org elements you want to map to which specific tikz
features/commands.  You will then have a list of leftover info that tikz
still needs to achieve the end goal.  At this point others can suggest
how you could communicate these missing info to tikz.  E.g. you already
have one suggestion from Bernhard, but I think it is probably too
generic.  If you manage to pursue this, I think the outcome will be a
new Org backend, possibly derived from ox-latex or ox-beamer.

Please don't be afraid to learn lisp, although it is hard to master,
it's easy to pick up.  I think the list will be more than willing to
help you with that.  Also, I think this is not a easy project.  It will
take some iterations to get to a version that can be test widely (by say
putting in an experimental branch or something).

While proof reading my email, I just realised ox-koma-letter might be a
really nice place for you to get familiar with how to repurpose Org
syntax to translate info to the backend in different ways.  Have a look.

Hope this helps,


Footnotes:

[1] Do not underestimate this aspect, Org users have a way to come up
with interesting ways to use features that were not envisioned
during development!

-- 
Suvayu

Open source is the future. It sets us free.



Re: [O] org-mode, tikz and beamer

2015-05-22 Thread Bernhard Schmitz
Hi  Cédric,

If I understand it correctly, you want to include a graphical representation of 
you headlines into you beamer file, created via tikz/pgf.
That sounds quite similar to what I'm doing at the moment, only I create gantt 
charts instead of mind maps.
As far as I can tell, the best possibility to do that inside of emacs, is to 
use custom dynamic blocks. 
http://orgmode.org/manual/Dynamic-blocks.html
Simply create your own org-dblock-write:... function that parses the file and 
creates the tikz output you want.
You can have a look at org-dblock-write:clocktable and 
org-dblock-write:columnview for inspiration.
I think using org-element-parse-buffer and org-element-map should get you what 
you need.

You can also have a look at my gantt chart creation here:
https://github.com/HeyFlash/emacs-stuff/tree/master/experiments
(One el file and one org file for testing)
You can probably ignore most of the file, as you don't need the complex time 
calculations I do.
Keep in mind that this is wip and I'm not an experienced elisp / org person, so 
if anyone has better suggestions, listen to them.

I will be without internet from later today until the middle of next week, so 
if you have any questions I will not be responding until then.

Regards,
Bernhard

 -Ursprüngliche Nachricht-
 Von: cédric ody [mailto:cedric.lis...@gmail.com]
 Gesendet: Donnerstag, 21. Mai 2015 16:41
 An: emacs-orgmode@gnu.org
 Betreff: [O] org-mode, tikz and beamer
 
 Dear org-mode users,
 
 I have used org-mode for some months now. I find it very useful. I
 have recently used it to prepare mathematic teaching lessons using the
 beamer exporter.
 
 I wanted to combine org-mode and tikz latex's package from latex In
 order to insert some kind of mind-mapping from the headlines between
 the main parts of the lesson. I enclose an example so that you can see
 what I am talking about. Note that you can move forth and back through
 the presentation with hyperlinks. Note also only the chapter Droites
 dans le plan is filled so most of links fail.
 
 I have done that from a single org-mode file using shell scripting
 calling org-mode and emacs in a batch mode way.
 
 Before improving my shell script, I would like to know if there is a
 proper way to handle that within org-mode in lisp language. I have no
 idea about how to do that but someone may know if it is possible or
 not, and may give me hints to follow so that I could have a try.
 
 Thanks,
 
 Cédric Ody


Re: [O] org-mode, tikz and beamer

2015-05-21 Thread Suvayu Ali
On Thu, May 21, 2015 at 04:40:33PM +0200, cédric ody wrote:
 Dear org-mode users,
 
 I have used org-mode for some months now. I find it very useful. I
 have recently used it to prepare mathematic teaching lessons using the
 beamer exporter.
 
 I wanted to combine org-mode and tikz latex's package from latex In
 order to insert some kind of mind-mapping from the headlines between
 the main parts of the lesson. I enclose an example so that you can see
 what I am talking about. Note that you can move forth and back through
 the presentation with hyperlinks. Note also only the chapter Droites
 dans le plan is filled so most of links fail.

Some of the links in that chapter are not working properly I think, but
otherwise it's a very impressive start!  If you post your current shell
script with the Org file, I think others can suggest what is and is not
possible.

To put it in more words, we don't know what you are thinking.  If we can
see the Org source and the shell script, it is easier to understand how
you map Org elements to beamer/tikz environments.

I think you have started a very interesting project!

Cheers,

-- 
Suvayu

Open source is the future. It sets us free.



Re: [O] org-mode, tikz and beamer

2015-05-21 Thread cédric ody
Thank you for your answer.

Here is the shell script (many comments are in english except the
beginning) and the org file I use. To see how I call it, you can have
a look at the enclosed Makefile. Note that it uses specific
configurations files as well tex macros so it won't work without these
files. I can prepare a short example which generates the tex and pdf
files if needed. The script probably gives for now a good idea. You
can also look at the enclosed generated tex file to see how the tikz
language.

Basically, the shell script looks recursively into the org file and
creates nodes for the tikz headline mindmaps. Thus, there are parent
nodes and children nodes.

During that excursion, two kinds of files are created: the tree
files and the contents files.

The first ones are tex files with tikz mindmaps that must be inserted
at specific locations at the final latex compilation step. One tree
file contains the parent node with all the children files.

The contents files are org files and are converted into tex files
via the org-mode export command in a batch way. In the shell script,
hyperlinks are added to these newly converted tex files.

At the end, the assembly of all these files is done before compiling.

Numbering of sections through the recursive call is important so that
links work properly as you notice. Links allow one to go back and
forth the document. To go back, the idea is to click on the headline.
If a node exists without content, the links sends you the beginning of
the file or something like that.

Cheers,

Cédric


2015-05-21 20:02 UTC+02:00, Suvayu Ali fatkasuvayu+li...@gmail.com:
 On Thu, May 21, 2015 at 04:40:33PM +0200, cédric ody wrote:
 Dear org-mode users,

 I have used org-mode for some months now. I find it very useful. I
 have recently used it to prepare mathematic teaching lessons using the
 beamer exporter.

 I wanted to combine org-mode and tikz latex's package from latex In
 order to insert some kind of mind-mapping from the headlines between
 the main parts of the lesson. I enclose an example so that you can see
 what I am talking about. Note that you can move forth and back through
 the presentation with hyperlinks. Note also only the chapter Droites
 dans le plan is filled so most of links fail.

 Some of the links in that chapter are not working properly I think, but
 otherwise it's a very impressive start!  If you post your current shell
 script with the Org file, I think others can suggest what is and is not
 possible.

 To put it in more words, we don't know what you are thinking.  If we can
 see the Org source and the shell script, it is easier to understand how
 you map Org elements to beamer/tikz environments.

 I think you have started a very interesting project!

 Cheers,

 --
 Suvayu

 Open source is the future. It sets us free.




org2tex.sh
Description: Bourne shell script


coursP.org
Description: Binary data


coursP.tex
Description: TeX document