emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* org-exp-block patch and Graphviz Demo
@ 2009-05-27 19:09 Russell Adams
  2009-05-28  7:48 ` Carsten Dominik
  2009-05-28 18:03 ` Org Mode List
  0 siblings, 2 replies; 14+ messages in thread
From: Russell Adams @ 2009-05-27 19:09 UTC (permalink / raw)
  To: Org Mode List

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

I updated org-exp-block.el to support other Graphviz output types (ie:
neato, fdp, twopi, and circo.), and created a test document to
demonstrate each type.

Attached is a tar file containing the demo, diff, and updated
org-exp-block.el. It could use some tuning before being permanently
applied, see the comments within.

I considered posting this to Worg, but was concerned that it would
bomb without the updated block support. After its added to core, I'd
be happy to post this into Worg.


My next question relates to using Graphviz between HTML and Latex
export. When I do HTML I don't mind using PNG, however with Latex it
is better to export to EPS. That way you export to a vector format
that looks superb in the final PDF. This requires a postprocessing
step that I'm not sure how to integrate.

From one of my Makefiles, I use this line to fix the EPS so that Latex
can import it:

sed -i -e 's/PS-Adobe-2.0/PS-Adobe-2.0 EPSF-1.2/1' $@

Comments?

Thanks.

------------------------------------------------------------------
Russell Adams                            RLAdams@AdamsInfoServ.com

PGP Key ID:     0x1160DCB3           http://www.adamsinfoserv.com/

Fingerprint:    1723 D8CA 4280 1EC9 557F  66E8 1154 E018 1160 DCB3

[-- Attachment #2: DotTest.tar.gz --]
[-- Type: application/octet-stream, Size: 130596 bytes --]

[-- Attachment #3: Type: text/plain, Size: 204 bytes --]

_______________________________________________
Emacs-orgmode mailing list
Remember: use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode

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

* Re: org-exp-block patch and Graphviz Demo
  2009-05-27 19:09 org-exp-block patch and Graphviz Demo Russell Adams
@ 2009-05-28  7:48 ` Carsten Dominik
  2009-05-28 13:44   ` Eric Schulte
  2009-05-28 18:03 ` Org Mode List
  1 sibling, 1 reply; 14+ messages in thread
From: Carsten Dominik @ 2009-05-28  7:48 UTC (permalink / raw)
  To: Russell Adams; +Cc: Org Mode List


On May 27, 2009, at 9:09 PM, Russell Adams wrote:

> I updated org-exp-block.el to support other Graphviz output types (ie:
> neato, fdp, twopi, and circo.), and created a test document to
> demonstrate each type.
>
> Attached is a tar file containing the demo, diff, and updated
> org-exp-block.el. It could use some tuning before being permanently
> applied, see the comments within.
>
> I considered posting this to Worg, but was concerned that it would
> bomb without the updated block support. After its added to core, I'd
> be happy to post this into Worg.
>
>
> My next question relates to using Graphviz between HTML and Latex
> export. When I do HTML I don't mind using PNG, however with Latex it
> is better to export to EPS. That way you export to a vector format
> that looks superb in the final PDF. This requires a postprocessing
> step that I'm not sure how to integrate.
>
> From one of my Makefiles, I use this line to fix the EPS so that Latex
> can import it:
>
> sed -i -e 's/PS-Adobe-2.0/PS-Adobe-2.0 EPSF-1.2/1' $@

Maybe this needs a bug report to the Graphviz people???

I guess the best solution would actually be to allow a lisp
function to do the formatting, and it should return the
link to be used.  then you can implement whatever is needed.

Eric, would that make sense?

- Carsten

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

* Re: org-exp-block patch and Graphviz Demo
  2009-05-28  7:48 ` Carsten Dominik
@ 2009-05-28 13:44   ` Eric Schulte
  2009-05-28 14:23     ` Eric Schulte
  0 siblings, 1 reply; 14+ messages in thread
From: Eric Schulte @ 2009-05-28 13:44 UTC (permalink / raw)
  To: Carsten Dominik; +Cc: Russell Adams, Org Mode List

Carsten Dominik <carsten.dominik@gmail.com> writes:

> On May 27, 2009, at 9:09 PM, Russell Adams wrote:
>
>> I updated org-exp-block.el to support other Graphviz output types (ie:
>> neato, fdp, twopi, and circo.), and created a test document to
>> demonstrate each type.
>>
>> Attached is a tar file containing the demo, diff, and updated
>> org-exp-block.el. It could use some tuning before being permanently
>> applied, see the comments within.
>>
>> I considered posting this to Worg, but was concerned that it would
>> bomb without the updated block support. After its added to core, I'd
>> be happy to post this into Worg.
>>

Hi Russel,

Thanks for the update, and for the clear exposition in the org demo
file.  I think that rather than changing the specification of the dot
block (which will break existing org files) we should create new block
files.  Either create a single graphviz file, which will accept an
argument indicating which command to use, or create a new block type for
each command.  I'm not sure which of these approaches would be
preferred...  They should both require only small changes to your
existing code.  If we were starting from scratch my preference would be
a single graphviz block type, however in order to maintain functionality
for existing org-mode documents, in this case I would lean towards
generating a block type for each command.  I suppose we could support
both options.

any suggestions?

I certainly agree that a change along these lines should be added to the
version of org-exp-block.el distributed with org mode.

Also, sorry about the delayed reply, I was waiting until I found the
time to actually look over your attached files.

>>
>>
>> My next question relates to using Graphviz between HTML and Latex
>> export. When I do HTML I don't mind using PNG, however with Latex it
>> is better to export to EPS. That way you export to a vector format
>> that looks superb in the final PDF. This requires a postprocessing
>> step that I'm not sure how to integrate.
>>
>> From one of my Makefiles, I use this line to fix the EPS so that Latex
>> can import it:
>>
>> sed -i -e 's/PS-Adobe-2.0/PS-Adobe-2.0 EPSF-1.2/1' $@
>
> Maybe this needs a bug report to the Graphviz people???
>

+1

>
> I guess the best solution would actually be to allow a lisp
> function to do the formatting, and it should return the
> link to be used.  then you can implement whatever is needed.
>
> Eric, would that make sense?
>

Yes,

Although I'm not sure how best to automatically associate a lisp (or
shell) function as a post processing step, and to then pass the file
path used in this block to said function... Possibly a something along
the lines of a #+postprocessing: line immediately preceding the block.

However that would be a general solution.  If our goal is just to allow
post processing in this instance, I believe that using defadvice would
be the easiest hack.  Make sure that the last statement in
`org-export-blocks-format-dot' returns the file path, and then try
something like the following...

--8<---------------cut here---------------start------------->8---
(defadvice org-export-blocks-format-dot (around fix-eps-org-export-blocks-format-dot activate)
  "Fix graphviz eps output."
  (let ((file ad-do-it))
    (shell-command (format "sed -i -e 's/PS-Adobe-2.0/PS-Adobe-2.0 EPSF-1.2/1' %s" file))))
--8<---------------cut here---------------end--------------->8---

Cheers -- Eric

>
> - Carsten

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

* Re: org-exp-block patch and Graphviz Demo
  2009-05-28 13:44   ` Eric Schulte
@ 2009-05-28 14:23     ` Eric Schulte
  0 siblings, 0 replies; 14+ messages in thread
From: Eric Schulte @ 2009-05-28 14:23 UTC (permalink / raw)
  To: Carsten Dominik; +Cc: Russell Adams, Org Mode List

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

"Eric Schulte" <schulte.eric@gmail.com> writes:

> Carsten Dominik <carsten.dominik@gmail.com> writes:
>
>> On May 27, 2009, at 9:09 PM, Russell Adams wrote:
>>
[...]
>
> Hi Russel,
>
> Thanks for the update, and for the clear exposition in the org demo
> file.  I think that rather than changing the specification of the dot
> block (which will break existing org files) we should create new block
> files.  Either create a single graphviz file, which will accept an
> argument indicating which command to use, or create a new block type for
> each command.  I'm not sure which of these approaches would be
> preferred...  They should both require only small changes to your
> existing code.  If we were starting from scratch my preference would be
> a single graphviz block type, however in order to maintain functionality
> for existing org-mode documents, in this case I would lean towards
> generating a block type for each command.  I suppose we could support
> both options.
>

The attached version of org-exp-blocks.el should support both graphviz
blocks (accepting each command as the first header argument), as well as
block types for all of the commands (see the monolithic mapc statement).

> 
> If our goal is just to allow post processing in this instance, I
> believe that using defadvice would be the easiest hack.  Make sure
> that the last statement in `org-export-blocks-format-dot' returns the
> file path, and then try something like the following...
>
> (defadvice org-export-blocks-format-dot (around fix-eps-org-export-blocks-format-dot activate)
>   "Fix graphviz eps output."
>   (let ((file ad-do-it))
>     (shell-command (format "sed -i -e 's/PS-Adobe-2.0/PS-Adobe-2.0 EPSF-1.2/1' %s" file))))
>

I was mistaken about the return value of org-export-blocks-format-dot,
perhaps a defadvice more like the following would be preferable.

;; untested
(defadvice org-export-blocks-format-dot (around fix-eps-org-export-blocks-format-dot activate)
  "Fix graphviz eps output."
  (let ((out-file (if headers (car headers))))
    ad-do-it
    (if (string-match "\\.eps" out-file)
        (shell-command (format "sed -i -e 's/PS-Adobe-2.0/PS-Adobe-2.0 EPSF-1.2/1' %s" out-file)))))

-- Eric


[-- Attachment #2: org-exp-blocks.el --]
[-- Type: application/emacs-lisp, Size: 17102 bytes --]

[-- Attachment #3: Type: text/plain, Size: 204 bytes --]

_______________________________________________
Emacs-orgmode mailing list
Remember: use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode

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

* Re: org-exp-block patch and Graphviz Demo
  2009-05-27 19:09 org-exp-block patch and Graphviz Demo Russell Adams
  2009-05-28  7:48 ` Carsten Dominik
@ 2009-05-28 18:03 ` Org Mode List
  2009-05-28 22:47   ` Russell Adams
  1 sibling, 1 reply; 14+ messages in thread
From: Org Mode List @ 2009-05-28 18:03 UTC (permalink / raw)
  To: Org Mode List

Hello,

I could be wrong, but org-exp-block.el already provides support for any
Graphviz command since you can add the option -K as an argument to dot.

Then again, I can have mistaken your point.

-- 
Nicolas Goaziou

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

* Re: org-exp-block patch and Graphviz Demo
  2009-05-28 18:03 ` Org Mode List
@ 2009-05-28 22:47   ` Russell Adams
  2009-05-28 22:57     ` Eric Schulte
  0 siblings, 1 reply; 14+ messages in thread
From: Russell Adams @ 2009-05-28 22:47 UTC (permalink / raw)
  To: emacs-orgmode

Nicolas,

You're right! I'd never seen -K, and its not in the manual page
either. But clearly enough:

$ dot --help
Usage: dot [-Vv?] [-(GNE)name=val] [-(KTlso)<val>] <dot files>

...

 -Kv         - Set layout engine to 'v' (overrides default based on command name)

I just tried it in the example I had supplied, and it worked properly!

#+BEGIN_dot dot neato.png -Tpng -Kneato
digraph test {

a -> { b c d e };
e -> { f g h i };

};

#+END_dot

Perhaps the patch and changes for that are pointless after all!

I went back and checked the postscript / EPS issue, and it is still
present.

Thanks for that neat tip!


On Thu, May 28, 2009 at 08:03:23PM +0200, Org Mode List wrote:
> Hello,
> 
> I could be wrong, but org-exp-block.el already provides support for any
> Graphviz command since you can add the option -K as an argument to dot.
> 
> Then again, I can have mistaken your point.
> 
> -- 
> Nicolas Goaziou
> 
> 
> 
> _______________________________________________
> Emacs-orgmode mailing list
> Remember: use `Reply All' to send replies to the list.
> Emacs-orgmode@gnu.org
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode
> 


------------------------------------------------------------------
Russell Adams                            RLAdams@AdamsInfoServ.com

PGP Key ID:     0x1160DCB3           http://www.adamsinfoserv.com/

Fingerprint:    1723 D8CA 4280 1EC9 557F  66E8 1154 E018 1160 DCB3

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

* Re: org-exp-block patch and Graphviz Demo
  2009-05-28 22:47   ` Russell Adams
@ 2009-05-28 22:57     ` Eric Schulte
  2009-06-09 15:50       ` Russell Adams
  0 siblings, 1 reply; 14+ messages in thread
From: Eric Schulte @ 2009-05-28 22:57 UTC (permalink / raw)
  To: emacs-orgmode


That's fantastic, much simpler than the patch!

Russell Adams <RLAdams@AdamsInfoServ.Com> writes:

> Nicolas,
>
> You're right! I'd never seen -K, and its not in the manual page
> either. But clearly enough:
>
> $ dot --help
> Usage: dot [-Vv?] [-(GNE)name=val] [-(KTlso)<val>] <dot files>
>
> ...
>
>  -Kv         - Set layout engine to 'v' (overrides default based on command name)
>
> I just tried it in the example I had supplied, and it worked properly!
>
> #+BEGIN_dot dot neato.png -Tpng -Kneato
> digraph test {
>
> a -> { b c d e };
> e -> { f g h i };
>
> };
>
> #+END_dot
>
> Perhaps the patch and changes for that are pointless after all!
>
> I went back and checked the postscript / EPS issue, and it is still
> present.
>
> Thanks for that neat tip!
>
>
> On Thu, May 28, 2009 at 08:03:23PM +0200, Org Mode List wrote:
>> Hello,
>> 
>> I could be wrong, but org-exp-block.el already provides support for any
>> Graphviz command since you can add the option -K as an argument to dot.
>> 
>> Then again, I can have mistaken your point.
>> 
>> -- 
>> Nicolas Goaziou
>> 
>> 
>> 
>> _______________________________________________
>> Emacs-orgmode mailing list
>> Remember: use `Reply All' to send replies to the list.
>> Emacs-orgmode@gnu.org
>> http://lists.gnu.org/mailman/listinfo/emacs-orgmode
>> 
>
>
> ------------------------------------------------------------------
> Russell Adams                            RLAdams@AdamsInfoServ.com
>
> PGP Key ID:     0x1160DCB3           http://www.adamsinfoserv.com/
>
> Fingerprint:    1723 D8CA 4280 1EC9 557F  66E8 1154 E018 1160 DCB3
>
>
> _______________________________________________
> Emacs-orgmode mailing list
> Remember: use `Reply All' to send replies to the list.
> Emacs-orgmode@gnu.org
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode

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

* Re: org-exp-block patch and Graphviz Demo
  2009-05-28 22:57     ` Eric Schulte
@ 2009-06-09 15:50       ` Russell Adams
  2009-06-10 14:51         ` Eric Schulte
  0 siblings, 1 reply; 14+ messages in thread
From: Russell Adams @ 2009-06-09 15:50 UTC (permalink / raw)
  To: emacs-orgmode

I've looked, and it appears that the sed line is no longer required,
it was an old hack.

Regarding graphviz inclusion in PDF, the best output is still obtained
by dot -> EPS, and then epstopdf -> PDF, and its inclusion in latex.

How would you handle that in org-exp-block.el?

Thanks.

On Thu, May 28, 2009 at 03:57:42PM -0700, Eric Schulte wrote:
> 
> That's fantastic, much simpler than the patch!
> 
> Russell Adams <RLAdams@AdamsInfoServ.Com> writes:
> 
> > Nicolas,
> >
> > You're right! I'd never seen -K, and its not in the manual page
> > either. But clearly enough:
> >
> > $ dot --help
> > Usage: dot [-Vv?] [-(GNE)name=val] [-(KTlso)<val>] <dot files>
> >
> > ...
> >
> >  -Kv         - Set layout engine to 'v' (overrides default based on command name)
> >
> > I just tried it in the example I had supplied, and it worked properly!
> >
> > #+BEGIN_dot dot neato.png -Tpng -Kneato
> > digraph test {
> >
> > a -> { b c d e };
> > e -> { f g h i };
> >
> > };
> >
> > #+END_dot
> >
> > Perhaps the patch and changes for that are pointless after all!
> >
> > I went back and checked the postscript / EPS issue, and it is still
> > present.
> >
> > Thanks for that neat tip!
> >
> >
> > On Thu, May 28, 2009 at 08:03:23PM +0200, Org Mode List wrote:
> >> Hello,
> >> 
> >> I could be wrong, but org-exp-block.el already provides support for any
> >> Graphviz command since you can add the option -K as an argument to dot.
> >> 
> >> Then again, I can have mistaken your point.
> >> 
> >> -- 
> >> Nicolas Goaziou
> >> 
> >> 
> >> 
> >> _______________________________________________
> >> Emacs-orgmode mailing list
> >> Remember: use `Reply All' to send replies to the list.
> >> Emacs-orgmode@gnu.org
> >> http://lists.gnu.org/mailman/listinfo/emacs-orgmode
> >> 
> >
> >
> > ------------------------------------------------------------------
> > Russell Adams                            RLAdams@AdamsInfoServ.com
> >
> > PGP Key ID:     0x1160DCB3           http://www.adamsinfoserv.com/
> >
> > Fingerprint:    1723 D8CA 4280 1EC9 557F  66E8 1154 E018 1160 DCB3
> >
> >
> > _______________________________________________
> > Emacs-orgmode mailing list
> > Remember: use `Reply All' to send replies to the list.
> > Emacs-orgmode@gnu.org
> > http://lists.gnu.org/mailman/listinfo/emacs-orgmode
> 
> 
> _______________________________________________
> Emacs-orgmode mailing list
> Remember: use `Reply All' to send replies to the list.
> Emacs-orgmode@gnu.org
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode
> 


------------------------------------------------------------------
Russell Adams                            RLAdams@AdamsInfoServ.com

PGP Key ID:     0x1160DCB3           http://www.adamsinfoserv.com/

Fingerprint:    1723 D8CA 4280 1EC9 557F  66E8 1154 E018 1160 DCB3

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

* Re: org-exp-block patch and Graphviz Demo
  2009-06-09 15:50       ` Russell Adams
@ 2009-06-10 14:51         ` Eric Schulte
  2009-06-10 15:29           ` Russell Adams
  0 siblings, 1 reply; 14+ messages in thread
From: Eric Schulte @ 2009-06-10 14:51 UTC (permalink / raw)
  To: emacs-orgmode

Russell Adams <RLAdams@AdamsInfoServ.Com> writes:

> I've looked, and it appears that the sed line is no longer required,
> it was an old hack.
>
> Regarding graphviz inclusion in PDF, the best output is still obtained
> by dot -> EPS, and then epstopdf -> PDF, and its inclusion in latex.
>
> How would you handle that in org-exp-block.el?
>

#+begin_dot out.pdf -Tpdf
digraph test {
a -> { b c d e };
e -> { f g h i };
};
#+end_dot

can be used with the current setup to go straight from dot -> PDF.

Since you would rather go to EPS as an intermediary step, then I would
recommend defining a new block type which can handle this two-stage
process.  There are instructions in org-exp-blocks.el, and I would
recommend using `org-export-blocks-format-dot' in
contrib/lisp/org-exp-blocks.el as your starting point.  It should be
possible to achieve the result your want with only one or two lines of
new elisp probably inserted right after the following line

  (shell-command (concat "dot " data-file " " args " -o " out-file))

Cheers -- Eric

>
> Thanks.
>
> On Thu, May 28, 2009 at 03:57:42PM -0700, Eric Schulte wrote:
>> 
>> That's fantastic, much simpler than the patch!
>> 
>> Russell Adams <RLAdams@AdamsInfoServ.Com> writes:
>> 
>> > Nicolas,
>> >
>> > You're right! I'd never seen -K, and its not in the manual page
>> > either. But clearly enough:
>> >
>> > $ dot --help
>> > Usage: dot [-Vv?] [-(GNE)name=val] [-(KTlso)<val>] <dot files>
>> >
>> > ...
>> >
>> >  -Kv         - Set layout engine to 'v' (overrides default based on command name)
>> >
>> > I just tried it in the example I had supplied, and it worked properly!
>> >
>> > #+BEGIN_dot dot neato.png -Tpng -Kneato
>> > digraph test {
>> >
>> > a -> { b c d e };
>> > e -> { f g h i };
>> >
>> > };
>> >
>> > #+END_dot
>> >
>> > Perhaps the patch and changes for that are pointless after all!
>> >
>> > I went back and checked the postscript / EPS issue, and it is still
>> > present.
>> >
>> > Thanks for that neat tip!
>> >
>> >
>> > On Thu, May 28, 2009 at 08:03:23PM +0200, Org Mode List wrote:
>> >> Hello,
>> >> 
>> >> I could be wrong, but org-exp-block.el already provides support for any
>> >> Graphviz command since you can add the option -K as an argument to dot.
>> >> 
>> >> Then again, I can have mistaken your point.
>> >> 
>> >> -- 
>> >> Nicolas Goaziou
>> >> 
>> >> 
>> >> 
>> >> _______________________________________________
>> >> Emacs-orgmode mailing list
>> >> Remember: use `Reply All' to send replies to the list.
>> >> Emacs-orgmode@gnu.org
>> >> http://lists.gnu.org/mailman/listinfo/emacs-orgmode
>> >> 
>> >
>> >
>> > ------------------------------------------------------------------
>> > Russell Adams                            RLAdams@AdamsInfoServ.com
>> >
>> > PGP Key ID:     0x1160DCB3           http://www.adamsinfoserv.com/
>> >
>> > Fingerprint:    1723 D8CA 4280 1EC9 557F  66E8 1154 E018 1160 DCB3
>> >
>> >
>> > _______________________________________________
>> > Emacs-orgmode mailing list
>> > Remember: use `Reply All' to send replies to the list.
>> > Emacs-orgmode@gnu.org
>> > http://lists.gnu.org/mailman/listinfo/emacs-orgmode
>> 
>> 
>> _______________________________________________
>> Emacs-orgmode mailing list
>> Remember: use `Reply All' to send replies to the list.
>> Emacs-orgmode@gnu.org
>> http://lists.gnu.org/mailman/listinfo/emacs-orgmode
>> 
>
>
> ------------------------------------------------------------------
> Russell Adams                            RLAdams@AdamsInfoServ.com
>
> PGP Key ID:     0x1160DCB3           http://www.adamsinfoserv.com/
>
> Fingerprint:    1723 D8CA 4280 1EC9 557F  66E8 1154 E018 1160 DCB3
>
>
> _______________________________________________
> Emacs-orgmode mailing list
> Remember: use `Reply All' to send replies to the list.
> Emacs-orgmode@gnu.org
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode

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

* Re: org-exp-block patch and Graphviz Demo
  2009-06-10 14:51         ` Eric Schulte
@ 2009-06-10 15:29           ` Russell Adams
  2009-06-10 16:06             ` Eric Schulte
  2009-06-10 17:54             ` Mark Elston
  0 siblings, 2 replies; 14+ messages in thread
From: Russell Adams @ 2009-06-10 15:29 UTC (permalink / raw)
  To: emacs-orgmode

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

> Since you would rather go to EPS as an intermediary step, then I would
> recommend defining a new block type which can handle this two-stage
> process.  There are instructions in org-exp-blocks.el, and I would
> recommend using `org-export-blocks-format-dot' in
> contrib/lisp/org-exp-blocks.el as your starting point.  It should be
> possible to achieve the result your want with only one or two lines of
> new elisp probably inserted right after the following line
> 
>   (shell-command (concat "dot " data-file " " args " -o " out-file))
> 
> Cheers -- Eric

I'm still just teething in lisp, but I'll give it a peek.

Have you compared the output between dot going straight to pdf, vs dot
to eps to pdf?

Attached are a pair of pdf's for comparison. The default font in eps
is better, and the line style is blunted and looks better vs the
arrows showing up going through the nodes. Perhaps I can control these
in the dot file, I'll look into it.

Thanks.


------------------------------------------------------------------
Russell Adams                            RLAdams@AdamsInfoServ.com

PGP Key ID:     0x1160DCB3           http://www.adamsinfoserv.com/

Fingerprint:    1723 D8CA 4280 1EC9 557F  66E8 1154 E018 1160 DCB3

[-- Attachment #2: DOTtoPDF.pdf --]
[-- Type: application/pdf, Size: 25295 bytes --]

[-- Attachment #3: EPStoPDF.pdf --]
[-- Type: application/pdf, Size: 19293 bytes --]

[-- Attachment #4: Type: text/plain, Size: 204 bytes --]

_______________________________________________
Emacs-orgmode mailing list
Remember: use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode

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

* Re: org-exp-block patch and Graphviz Demo
  2009-06-10 15:29           ` Russell Adams
@ 2009-06-10 16:06             ` Eric Schulte
  2009-06-10 16:22               ` Russell Adams
  2009-06-10 17:54             ` Mark Elston
  1 sibling, 1 reply; 14+ messages in thread
From: Eric Schulte @ 2009-06-10 16:06 UTC (permalink / raw)
  To: emacs-orgmode

Russell Adams <RLAdams@AdamsInfoServ.Com> writes:

>> Since you would rather go to EPS as an intermediary step, then I would
>> recommend defining a new block type which can handle this two-stage
>> process.  There are instructions in org-exp-blocks.el, and I would
>> recommend using `org-export-blocks-format-dot' in
>> contrib/lisp/org-exp-blocks.el as your starting point.  It should be
>> possible to achieve the result your want with only one or two lines of
>> new elisp probably inserted right after the following line
>> 
>>   (shell-command (concat "dot " data-file " " args " -o " out-file))
>> 
>> Cheers -- Eric
>
> I'm still just teething in lisp, but I'll give it a peek.
>

This *should* be a good gentle introduction to lisp programming, and
probably shouldn't include much more than the introduction of another
call to `shell-command' which calls eps on the out-file.

If you run into problems feel free to email me off list, and I'd be
happy to try to share pointers.

>
> Have you compared the output between dot going straight to pdf, vs dot
> to eps to pdf?
>
> Attached are a pair of pdf's for comparison. The default font in eps
> is better, and the line style is blunted and looks better vs the
> arrows showing up going through the nodes.

I see what you mean, subtle but definitely looks nicer through EPS.

> 
> Perhaps I can control these in the dot file, I'll look into it.
>

Really it would probably be much easier to do this with a new block
type... what do the commands look like when you do this by hand?

Cheers -- Eric

>
> Thanks.
>
>
> ------------------------------------------------------------------
> Russell Adams                            RLAdams@AdamsInfoServ.com
>
> PGP Key ID:     0x1160DCB3           http://www.adamsinfoserv.com/
>
> Fingerprint:    1723 D8CA 4280 1EC9 557F  66E8 1154 E018 1160 DCB3
>
>
> _______________________________________________
> Emacs-orgmode mailing list
> Remember: use `Reply All' to send replies to the list.
> Emacs-orgmode@gnu.org
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode

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

* Re: org-exp-block patch and Graphviz Demo
  2009-06-10 16:06             ` Eric Schulte
@ 2009-06-10 16:22               ` Russell Adams
  2009-06-10 17:12                 ` Eric Schulte
  0 siblings, 1 reply; 14+ messages in thread
From: Russell Adams @ 2009-06-10 16:22 UTC (permalink / raw)
  To: emacs-orgmode

On Wed, Jun 10, 2009 at 09:06:09AM -0700, Eric Schulte wrote:
> Really it would probably be much easier to do this with a new block
> type... what do the commands look like when you do this by hand?
> 
> Cheers -- Eric

dot -Teps -o file.eps file.dot
epstopdf file.eps

Quick and simple.

------------------------------------------------------------------
Russell Adams                            RLAdams@AdamsInfoServ.com

PGP Key ID:     0x1160DCB3           http://www.adamsinfoserv.com/

Fingerprint:    1723 D8CA 4280 1EC9 557F  66E8 1154 E018 1160 DCB3

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

* Re: org-exp-block patch and Graphviz Demo
  2009-06-10 16:22               ` Russell Adams
@ 2009-06-10 17:12                 ` Eric Schulte
  0 siblings, 0 replies; 14+ messages in thread
From: Eric Schulte @ 2009-06-10 17:12 UTC (permalink / raw)
  To: emacs-orgmode

Russell Adams <RLAdams@AdamsInfoServ.Com> writes:

> On Wed, Jun 10, 2009 at 09:06:09AM -0700, Eric Schulte wrote:
>> Really it would probably be much easier to do this with a new block
>> type... what do the commands look like when you do this by hand?
>> 
>> Cheers -- Eric
>
> dot -Teps -o file.eps file.dot
> epstopdf file.eps
>
> Quick and simple.
>

I just posted a patch to org-exp-blocks.el that fixes a small typo/bug.

After that patch is applied, the code below[1] can be used to add a new
block type which will automatically process blocks with dot then eps.
For example the following block specification will create out-w-eps.eps
and org-w-eps.pdf files on export.

#+begin_dot-and-eps out-w-eps
digraph test {
a -> { b c d e };
e -> { f g h i };
};
#+end_dot-and-eps

Cheers -- Eric

[1]
(defun org-export-blocks-format-dot-and-eps (body &rest headers)
  "Pass block BODY to the dot graphing utility creating an eps
file which is then processed by eps to create a pdf.  Specify the
path at which the final pdf image should be created as the first
element of headers, any additional elements of headers will be
passed to the dot utility as command line arguments.

#+begin_dot_and_eps duh
digraph test {
a -> { b c d e };
e -> { f g h i };
};
#+end_dot"
  (message "dot-and-eps-formatting...")
  (let ((out-file (if headers (car headers)))
	(args (if (cdr headers) (mapconcat 'identity (cdr headers) " ")))
	(data-file (make-temp-file "org-dot")))
    (cond
     ((or htmlp latexp docbookp)
      (with-temp-file data-file (insert body))
      (shell-command (message (concat "dot -Teps " data-file " " args " -o " out-file ".eps")))
      (shell-command (message (concat "epstopdf " out-file ".eps")))
      (format "\n[[file:%s.pdf]]\n" out-file))
     (t (concat
	 "\n#+BEGIN_EXAMPLE\n"
	 body (if (string-match "\n$" body) "" "\n")
	 "#+END_EXAMPLE\n")))))

(org-export-blocks-add-block '(dot-and-eps org-export-blocks-format-dot-and-eps nil))

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

* Re: org-exp-block patch and Graphviz Demo
  2009-06-10 15:29           ` Russell Adams
  2009-06-10 16:06             ` Eric Schulte
@ 2009-06-10 17:54             ` Mark Elston
  1 sibling, 0 replies; 14+ messages in thread
From: Mark Elston @ 2009-06-10 17:54 UTC (permalink / raw)
  To: org-mode emacs-orgmode

Russell,

Russell Adams wrote:
> Have you compared the output between dot going straight to pdf, vs dot
> to eps to pdf?
> 
> Attached are a pair of pdf's for comparison. The default font in eps
> is better, and the line style is blunted and looks better vs the
> arrows showing up going through the nodes. 

OTOH, the curves are cleaner in the PDF-only version...

 > Perhaps I can control these in the dot file, I'll look into it.
> 

I would like to hear about it if you find anything out from this...

Mark

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

end of thread, other threads:[~2009-06-10 17:55 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-05-27 19:09 org-exp-block patch and Graphviz Demo Russell Adams
2009-05-28  7:48 ` Carsten Dominik
2009-05-28 13:44   ` Eric Schulte
2009-05-28 14:23     ` Eric Schulte
2009-05-28 18:03 ` Org Mode List
2009-05-28 22:47   ` Russell Adams
2009-05-28 22:57     ` Eric Schulte
2009-06-09 15:50       ` Russell Adams
2009-06-10 14:51         ` Eric Schulte
2009-06-10 15:29           ` Russell Adams
2009-06-10 16:06             ` Eric Schulte
2009-06-10 16:22               ` Russell Adams
2009-06-10 17:12                 ` Eric Schulte
2009-06-10 17:54             ` Mark Elston

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