emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* BUG report [Was: computing the size of a tikz to png image during export]
@ 2018-01-28 19:00 Fabrice Popineau
  2018-01-28 23:24 ` Nicolas Goaziou
  0 siblings, 1 reply; 8+ messages in thread
From: Fabrice Popineau @ 2018-01-28 19:00 UTC (permalink / raw)
  To: Alan Schmitt; +Cc: emacs-orgmode

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

Well, I think there is a problem with the current master
since commit 38be85124551083d269.

The problem is that the by-backend trick which were tolerated before
does not work anymore.

Tested between Org 9.1.6 as in current emacs-26.0.91 release versus current
Org master.

More over, ignoring the no-eval parameter
in org-babel-parse-header-arguments
restores the previous behavior.

Regards,

Fabrice





2018-01-28 16:37 GMT+01:00 Fabrice Popineau <fabrice.popineau@supelec.fr>:

>
>
> 2018-01-24 8:54 GMT+01:00 Alan Schmitt <alan.schmitt@polytechnique.org>:
>
>> Hello,
>>
>> I use this great trick to have both a pdf and html export of tikz
>> images:
>>
>> #+header: :file (by-backend (latex "tp6-tree.tikz") (t "tp6-tree.png"))
>> #+header: :imagemagick yes :iminoptions -density 600 :imoutoptions
>> -geometry 800
>> #+header: :results file raw
>> #+header: :fit yes
>> #+header: :headers '("\\usepackage{tikz}")
>> #+begin_src latex
>> \begin{tikzpicture}
>> …
>> \end{tikzpicture}
>> #+end_src
>>
>>
> I jump on this example to ask: does this by-backend trick still work with
> Org 9.1.6?
> Because I used it too and for some reason it fails to evaluate the
> by-backend form now.
> What am I overlooking ?
>
> Thanks,
>
> Fabrice
>
>


-- 
Fabrice Popineau
-----------------------------
SUPELEC
Département Informatique
3, rue Joliot Curie
91192 Gif/Yvette Cedex
Tel direct : +33 (0) 169851950
Standard : +33 (0) 169851212
------------------------------

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

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

* Re: BUG report [Was: computing the size of a tikz to png image during export]
  2018-01-28 19:00 BUG report [Was: computing the size of a tikz to png image during export] Fabrice Popineau
@ 2018-01-28 23:24 ` Nicolas Goaziou
  2018-01-28 23:29   ` Fabrice Popineau
  2018-01-29  1:34   ` Berry, Charles
  0 siblings, 2 replies; 8+ messages in thread
From: Nicolas Goaziou @ 2018-01-28 23:24 UTC (permalink / raw)
  To: Fabrice Popineau; +Cc: Alan Schmitt, fabrice.popineau, emacs-orgmode

Hello,

Fabrice Popineau <fabrice.popineau@supelec.fr> writes:

> Well, I think there is a problem with the current master
> since commit 38be85124551083d269.
>
> The problem is that the by-backend trick which were tolerated before
> does not work anymore.
>
> Tested between Org 9.1.6 as in current emacs-26.0.91 release versus current
> Org master.
>
> More over, ignoring the no-eval parameter
> in org-babel-parse-header-arguments
> restores the previous behavior.

Would you have an ECM? I don't know what is "the by-backend trick".

Regards,

-- 
Nicolas Goaziou

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

* Re: BUG report [Was: computing the size of a tikz to png image during export]
  2018-01-28 23:24 ` Nicolas Goaziou
@ 2018-01-28 23:29   ` Fabrice Popineau
  2018-01-29  1:34   ` Berry, Charles
  1 sibling, 0 replies; 8+ messages in thread
From: Fabrice Popineau @ 2018-01-28 23:29 UTC (permalink / raw)
  To: Nicolas Goaziou; +Cc: Alan Schmitt, emacs-orgmode


[-- Attachment #1.1: Type: text/plain, Size: 824 bytes --]

2018-01-29 0:24 GMT+01:00 Nicolas Goaziou <mail@nicolasgoaziou.fr>:

> Hello,
>
> Fabrice Popineau <fabrice.popineau@supelec.fr> writes:
>
> > Well, I think there is a problem with the current master
> > since commit 38be85124551083d269.
> >
> > The problem is that the by-backend trick which were tolerated before
> > does not work anymore.
> >
> > Tested between Org 9.1.6 as in current emacs-26.0.91 release versus
> current
> > Org master.
> >
> > More over, ignoring the no-eval parameter
> > in org-babel-parse-header-arguments
> > restores the previous behavior.
>
> Would you have an ECM? I don't know what is "the by-backend trick".
>
>
Example attached.
Actually, I wonder if you can avoid to evaluate arguments in
org-babel-parse-header-arguments
and continue to support the use of by-backend.

Regards,

Fabrice

[-- Attachment #1.2: Type: text/html, Size: 1435 bytes --]

[-- Attachment #2: test.org --]
[-- Type: application/octet-stream, Size: 2240 bytes --]

#+TITLE: Test
#+AUTHOR: Blah
#+LATEX_CLASS: article
#+LATEX_CLASS_OPTIONS: [american]
#
# Setup tikz package for both LaTeX and HTML export:
#
#+LATEX_HEADER: \usepackage{tikz}
#+PROPERTY: header-args:latex+ :packages '(("" "tikz"))
#+PROPERTY: header-args:latex+ :imagemagick yes :fit yes

* One Diamond

#+name: diamond
#+header: :iminoptions -density 600 -resample 100x100
#+header: :file (by-backend (latex "diamond.tikz") (t "diamond.png"))
#+begin_src latex :results raw graphics
  \begin{tikzpicture}
    \draw (1,0) -- (0,1) -- (-1,0) -- (0,-1) -- cycle;
  \end{tikzpicture}
#+end_src

#+name: CR2017-2018-fig1
#+header: :file (by-backend (html "CR2017-2018-fig1.svg") (t nil))
#+header: :imagemagick  (by-backend (latex nil) (t "yes")) :fit yes
#+header: :results (by-backend (html "file") (pdf "latex") (t "raw"))
#+header: :headers \usetikzlibrary{arrows,automata,quotes,graphs,shapes,intersections,mindmap,trees,shadows,fit,positioning,calc,matrix,decorations,chains,external}
#+header: :packages '(("" "tkz-graph"))
#+begin_src latex
  \begin{tikzpicture}
    [node distance=1cm,on grid,auto,%scale=0.7,%
    state/.style={draw,thick,circle,inner sep=3pt,minimum size=9mm,%scale=0.8,transform shape
    }]
    \foreach \l/\x/\y in {a/3/6, b/0/4, c/6/4, d/3/3, e/0/2, f/6/2, g/3/0}
    \node[state] (q\l) at(\x , \y) {\l};
    % \node[state,accepting ] (q4)[below=of q3] {4};
    \foreach \u/\v/\w in {a/b/11, a/c/12, a/e/10, b/c/0, b/d/4, b/e/3, c/f/8, d/f/7, d/g/2, d/e/9, e/f/5, e/g/6, f/g/1}
    \path [-, thick] (q\u) edge node {\w} (q\v);
    ;
    % (q4) edge [loop below] node {a} (q4) (q4) edge node[right]
    % {b} (q3);
    %\path[use as bounding box%, draw%
    %] (-3,-1) rectangle (10,14);
  \end{tikzpicture}
#+end_src


#+name: fig:diamond
#+caption: A diamond.
#+attr_latex: :float t :width ""
#+results: diamond

Figure [[fig:diamond]] is a diamond.

* Setup                                                            :noexport:
#+name: setup
#+begin_src emacs-lisp :exports none :results silent
  (defmacro by-backend (&rest body)
    `(cl-case org-export-current-backend ,@body))
#+end_src

# Local variables:
# eval: (org-sbe "setup")
# End:

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

* Re: BUG report [Was: computing the size of a tikz to png image during export]
  2018-01-28 23:24 ` Nicolas Goaziou
  2018-01-28 23:29   ` Fabrice Popineau
@ 2018-01-29  1:34   ` Berry, Charles
  2018-01-29  7:49     ` Fabrice Popineau
  1 sibling, 1 reply; 8+ messages in thread
From: Berry, Charles @ 2018-01-29  1:34 UTC (permalink / raw)
  To: Nicolas Goaziou
  Cc: Alan Schmitt, Fabrice Popineau, emacs-orgmode,
	fabrice.popineau@centralesupelec.fr



> On Jan 28, 2018, at 3:24 PM, Nicolas Goaziou <mail@nicolasgoaziou.fr> wrote:
> 
> Would you have an ECM? I don't know what is "the by-backend trick".

Not a bug AFAICS.

`by-backend' is a macro mentioned here:

https://lists.gnu.org/archive/html/emacs-orgmode/2013-07/msg00500.html

I guess it needs to use `org-export-current-backend' if it is to be handled in recent org versions.

Chuck

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

* Re: BUG report [Was: computing the size of a tikz to png image during export]
  2018-01-29  1:34   ` Berry, Charles
@ 2018-01-29  7:49     ` Fabrice Popineau
  2018-01-30  2:26       ` Berry, Charles
  2018-01-30 20:59       ` Nicolas Goaziou
  0 siblings, 2 replies; 8+ messages in thread
From: Fabrice Popineau @ 2018-01-29  7:49 UTC (permalink / raw)
  To: Berry, Charles; +Cc: Alan Schmitt, emacs-orgmode, Nicolas Goaziou

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

2018-01-29 2:34 GMT+01:00 Berry, Charles <ccberry@ucsd.edu>:

> > On Jan 28, 2018, at 3:24 PM, Nicolas Goaziou <mail@nicolasgoaziou.fr>
> wrote:
> >
> > Would you have an ECM? I don't know what is "the by-backend trick".
>
> Not a bug AFAICS.
>
> `by-backend' is a macro mentioned here:
>
> https://lists.gnu.org/archive/html/emacs-orgmode/2013-07/msg00500.html
>
> I guess it needs to use `org-export-current-backend' if it is to be
> handled in recent org versions.
>

Thanks for the pointer to the variable but that is not the problem.

You should have a look at commit  38be85124551083d269.
It prevents evaluation of the by-backend form in parameters.

-- 
Fabrice

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

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

* Re: BUG report [Was: computing the size of a tikz to png image during export]
  2018-01-29  7:49     ` Fabrice Popineau
@ 2018-01-30  2:26       ` Berry, Charles
  2018-01-30 20:59       ` Nicolas Goaziou
  1 sibling, 0 replies; 8+ messages in thread
From: Berry, Charles @ 2018-01-30  2:26 UTC (permalink / raw)
  To: Fabrice Popineau; +Cc: Alan Schmitt, emacs-orgmode, Nicolas Goaziou



> On Jan 28, 2018, at 11:49 PM, Fabrice Popineau <fabrice.popineau@centralesupelec.fr> wrote:
> 
> You should have a look at commit  38be85124551083d269.
> It prevents evaluation of the by-backend form in parameters.
> 

You are right.

I do not see a clean way to do what `by-backend' would have done prior to that commit.

Maybe :file-ext can help for the tikz case.

Chuck

 

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

* Re: BUG report [Was: computing the size of a tikz to png image during export]
  2018-01-29  7:49     ` Fabrice Popineau
  2018-01-30  2:26       ` Berry, Charles
@ 2018-01-30 20:59       ` Nicolas Goaziou
  2018-01-30 21:31         ` Fabrice Popineau
  1 sibling, 1 reply; 8+ messages in thread
From: Nicolas Goaziou @ 2018-01-30 20:59 UTC (permalink / raw)
  To: Fabrice Popineau; +Cc: Alan Schmitt, emacs-orgmode, Berry, Charles

Hello,

Fabrice Popineau <fabrice.popineau@centralesupelec.fr> writes:

> You should have a look at commit  38be85124551083d269.
> It prevents evaluation of the by-backend form in parameters.

It doesn't.

It prevents evaluation conditionally, i.e., when an optional argument is
non-nil. The same argument prevents expanding Noweb references because
I think both features are tied. If I'm wrong, we will use a special
value to distinguish the cases, or use another argument.

Meanwhile, I think this is fixed.

Regards,

-- 
Nicolas Goaziou                                                0x80A93738

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

* Re: BUG report [Was: computing the size of a tikz to png image during export]
  2018-01-30 20:59       ` Nicolas Goaziou
@ 2018-01-30 21:31         ` Fabrice Popineau
  0 siblings, 0 replies; 8+ messages in thread
From: Fabrice Popineau @ 2018-01-30 21:31 UTC (permalink / raw)
  To: Nicolas Goaziou; +Cc: Alan Schmitt, emacs-orgmode, Berry, Charles

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

2018-01-30 21:59 GMT+01:00 Nicolas Goaziou <mail@nicolasgoaziou.fr>:

> Hello,
>
> Fabrice Popineau <fabrice.popineau@centralesupelec.fr> writes:
>
> > You should have a look at commit  38be85124551083d269.
> > It prevents evaluation of the by-backend form in parameters.
>
> It doesn't.
>
> My mistake: it optionaly prevents :-)


> It prevents evaluation conditionally, i.e., when an optional argument is
> non-nil. The same argument prevents expanding Noweb references because
> I think both features are tied. If I'm wrong, we will use a special
> value to distinguish the cases, or use another argument.
>
> Meanwhile, I think this is fixed.
>

After a quick test, it seems to work ok here.

Thanks a lot because I rely heavily on this feature !

Regards,

Fabrice

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

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

end of thread, other threads:[~2018-01-30 21:33 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-01-28 19:00 BUG report [Was: computing the size of a tikz to png image during export] Fabrice Popineau
2018-01-28 23:24 ` Nicolas Goaziou
2018-01-28 23:29   ` Fabrice Popineau
2018-01-29  1:34   ` Berry, Charles
2018-01-29  7:49     ` Fabrice Popineau
2018-01-30  2:26       ` Berry, Charles
2018-01-30 20:59       ` Nicolas Goaziou
2018-01-30 21:31         ` Fabrice Popineau

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