emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* conditional export based on target
@ 2010-10-07  4:24 Ezequiel Birman
  2010-10-23 23:46 ` Juan Pechiar
  0 siblings, 1 reply; 4+ messages in thread
From: Ezequiel Birman @ 2010-10-07  4:24 UTC (permalink / raw)
  To: emacs-orgmode

Is there something like conditional export? I'd like to use tikz when
exporting to latex but my own hand-made ascii drawing when exporting to
ascii/latin1/utf8.

-- 
Ezequiel Birman

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

* Re: conditional export based on target
  2010-10-07  4:24 conditional export based on target Ezequiel Birman
@ 2010-10-23 23:46 ` Juan Pechiar
  2010-11-02 19:41   ` Ezequiel Birman
  0 siblings, 1 reply; 4+ messages in thread
From: Juan Pechiar @ 2010-10-23 23:46 UTC (permalink / raw)
  To: Ezequiel Birman; +Cc: emacs-orgmode

On Thu, Oct 07, 2010 at 01:24:28AM -0300, Ezequiel Birman wrote:
> Is there something like conditional export? I'd like to use tikz when
> exporting to latex but my own hand-made ascii drawing when exporting to
> ascii/latin1/utf8.

Hi,

I've been thinking on your request, and today this appeared on the
list which is quite similar:

http://lists.gnu.org/archive/html/emacs-orgmode/2010-10/msg01106.html

It seems as if block settings can be lisp function calls rather than a
fixed string.

So, for example:

//------------------------------------------------------------
** Test conditional export

#+source: test_output
#+begin_src octave :results value vector :exports (if (and (boundp 'htmlp) htmlp) "none" "results" )
rand(2)
#+end_src

#+results: test_output
| 0.3982018019389448 | 0.3879818701032038 |
| 0.8053847746148466 | 0.3333630867175288 |
------------------------------------------------------------

Will export nothing to HTML, and the resulting output to other
formats.

Values for 'exports' can be 'both', 'none', 'code' or 'results'; and
there are export flags latexp, htmlp, asciip, docbookp.

I tested the above example, and it "mostly" works. Sometimes not, and
I don't yet know why.

BR
.j.

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

* Re: conditional export based on target
  2010-10-23 23:46 ` Juan Pechiar
@ 2010-11-02 19:41   ` Ezequiel Birman
  2010-11-02 23:37     ` Juan Pechiar
  0 siblings, 1 reply; 4+ messages in thread
From: Ezequiel Birman @ 2010-11-02 19:41 UTC (permalink / raw)
  To: emacs-orgmode

>>>>> "JP" == Juan Pechiar <juan@pechiar.com> writes:

    > On Thu, Oct 07, 2010 at 01:24:28AM -0300, Ezequiel Birman wrote:
    >> Is there something like conditional export? I'd like to use tikz
    >> when exporting to latex but my own hand-made ascii drawing when
    >> exporting to ascii/latin1/utf8.

    > Hi,

    > I've been thinking on your request, and today this appeared on the
    > list which is quite similar:

    > http://lists.gnu.org/archive/html/emacs-orgmode/2010-10/msg01106.html

    > It seems as if block settings can be lisp function calls rather
    > than a fixed string.

    > So, for example:

    > //------------------------------------------------------------ **
    > Test conditional export

    > #+source: test_output #+begin_src octave :results value vector
    > :exports (if (and (boundp 'htmlp) htmlp) "none" "results" )
    > rand(2) #+end_src

    > #+results: test_output | 0.3982018019389448 | 0.3879818701032038 |
    > | 0.8053847746148466 | 0.3333630867175288
    > | ------------------------------------------------------------

    > Will export nothing to HTML, and the resulting output to other
    > formats.

    > Values for 'exports' can be 'both', 'none', 'code' or 'results';
    > and there are export flags latexp, htmlp, asciip, docbookp.

    > I tested the above example, and it "mostly" works. Sometimes not,
    > and I don't yet know why.

Thank you Juan. This seems to work *always*. I had to remove the
'results: ...' portion but I don't understand why...

#+source: tree1_latex
#+BEGIN_SRC latex :exports (if (and (boundp 'latexp) latexp) "results" "none")
  \begin{tikzpicture}
    [every node/.style={draw,fill=white,circle,inner sep=0pt,minimum size=1em},
     level distance=3em,
     level 1/.style={sibling distance=8em},
     level 2/.style={sibling distance=4em},
     level 3/.style={sibling distance=2em}]
    \node [level distance=0pt,style={draw=none,minimum size=0pt}] {}
      child {node {} edge from parent [draw=none]
        child {node {} 
          child {node {} }
          child {node [style={fill=black}] {}}}
        child {node [style={fill=black}] {}
          child {node {} }
          child {node [style={fill=black}] {} }}}
      child {node [style={fill=black}] {} edge from parent [draw=none]
        child {node {}
          child {node {} }
          child {node [style={fill=black}] {} }}
        child {node [style={fill=black}] {}
          child {node {}}
          child {node [draw=none,style={shade}] {} edge from parent [dashed]}}};
    \end{tikzpicture}
#+end_src

#+source: tree1_ascii
#+BEGIN_SRC emacs-lisp :exports (if (and (boundp 'asciip) asciip) "results" "none")
"        B               N\\\\
      /   \\           /   \\\\\\
    B       N       B       N\\\\
   / \\     / \\     / \\     / \\\\\\
  B   N   B   N   B   N   B  (N)"
#+END_SRC

I still don't know how to export the TikZ code to latex but a png or svg
(generated by TikZ) to html.

Also, if anyone can think of a better or different approach I'll be
thankful.

-- 
Ezequiel Birman

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

* Re: Re: conditional export based on target
  2010-11-02 19:41   ` Ezequiel Birman
@ 2010-11-02 23:37     ` Juan Pechiar
  0 siblings, 0 replies; 4+ messages in thread
From: Juan Pechiar @ 2010-11-02 23:37 UTC (permalink / raw)
  To: Ezequiel Birman; +Cc: emacs-orgmode

On Tue, Nov 02, 2010 at 04:41:05PM -0300, Ezequiel Birman wrote:
> #+source: tree1_latex
> #+BEGIN_SRC latex :exports (if (and (boundp 'latexp) latexp) "results" "none")
>   \begin{tikzpicture}
...
>     \end{tikzpicture}
> #+end_src

> I still don't know how to export the TikZ code to latex but a png or svg
> (generated by TikZ) to html.

I don't know if I understand your problem here, but maybe it has
something to do with adding

   :results value latex

to the #+begin_src header

Check http://orgmode.org/manual/results.html#results

BR,
.j.

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

end of thread, other threads:[~2010-11-02 23:37 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-10-07  4:24 conditional export based on target Ezequiel Birman
2010-10-23 23:46 ` Juan Pechiar
2010-11-02 19:41   ` Ezequiel Birman
2010-11-02 23:37     ` Juan Pechiar

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