emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* no more tikz -> png génération during HTML export
@ 2018-10-12 12:26 Éric Würbel
  2018-10-14 13:37 ` Jeremie Juste
  0 siblings, 1 reply; 9+ messages in thread
From: Éric Würbel @ 2018-10-12 12:26 UTC (permalink / raw)
  To: emacs-orgmode


Hi list

Since my last upgrade of org (9.1.14), during HTML export, the
generation of a png image from a Tikz picture in a LaTeX src block is
not working anymore.

Here is the context :
The org-latex-pdf-process variable is set to

"latexmk -pdflatex='pdflatex -interaction nonstopmode -shell-escape' -pdf -outdir=\"%o\" -bibtex -f \"%f\""

(using customize).

Latexmk executes well, the LaTeX src block is compiled without errors,
except this little bizarre messages which appears after each execution
of LaTeX :

Output written on /tmp/babel-2628p9D//latex-26280Qa.pdf (1 page, 20872 bytes).
Transcript written on /tmp/babel-2628p9D//latex-26280Qa.log.
Latexmk: Log file says output to '/tmp/babel-2628p9D//latex-26280Qa.pdf'
Latexmk: ===For rule 'pdflatex', actual output '/tmp/babel-2628p9D//latex-26280Qa.pdf'
       ======appears not to match expected output '/tmp/babel-2628p9D/latex-26280Qa.pdf'
Latexmk: All targets (/tmp/babel-2628p9D/latex-26280Qa.pdf) are up-to-date

this double '/' is strange...

Then, when the org export process tries to convert the pdf to png with
imagemagick, there's a problem :
Converting pdffile file convert -density 150 /tmp/babel-2628p9D/latex-26280Qa.pdf -geometry 400 arbo.png...
convert-im6.q16: not authorized `/tmp/babel-2628p9D/latex-26280Qa.pdf' @ error/constitute.c/ReadImage/412.
convert-im6.q16: no images defined `arbo.png' @ error/convert.c/ConvertImageCommand/3258.

And effectively, the file /tmp/babel-2628p9D/latex-26280Qa.pdf does not
exist...

Here is the minimal org file I have built to generate this problem :

#+TITLE: Test d'export tikz qui ne marche plus
#+DATE: <2015-11-10 mar.>
#+LANGUAGE: fr
#+OPTIONS: toc:1 num:1
#+LATEX_HEADER: \usepackage[utf8]{inputenc}
#+LATEX_HEADER: \usepackage[T1]{fontenc}
#+LATEX_HEADER: \usepackage{lmodern} 
#+LATEX_HEADER: \usepackage{tikz} 

* Récapitulatif

  #+header: :file arbo.png
  #+header: :imagemagick yes :fit yes
  #+header: :results raw :iminoptions -density 150 :imoutoptions -geometry 400 
  #+header: :headers '("\\renewcommand{\\familydefault}{\\sfdefault}" "\\usepackage{lmodern}" "\\usepackage{tikz}")
  #+BEGIN_SRC latex 
      \usetikzlibrary{trees}

      \begin{tikzpicture}[thick,level 1/.style ={sibling distance=30mm},%
        level 2/.style={sibling distance=25mm},%
        level 3/.style={sibling distance=10mm}]
        \node {racine-par-défaut}
        [edge from parent fork down]
          child { node {hôte-par-défaut}
            child { node {rubrique1}
              child { node {a}}
              child { node {b}}
              child { node {c}}
            }
            child { node {rubrique2}
              child { node {d}}
              child { node {e}}
              child { node {f}}
            }
            child { node {private}}
          }
          child { node {site1}}
          child { node {site2}
            child { node {zone protégée}}
          }
          ;  
      \end{tikzpicture}
  #+END_SRC


Any idea ?

Regards

Éric
-- 
Éric Würbel
http://eric.wurbel.perso.luminy.univ-amu.fr/
Enseignement: IUT R&T, directeur des études 1A
Recherche: LIS CNRS, UMR7020 http://www.lis-lab.fr/

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

* Re: no more tikz -> png génération during HTML export
  2018-10-12 12:26 no more tikz -> png génération during HTML export Éric Würbel
@ 2018-10-14 13:37 ` Jeremie Juste
  2018-10-14 21:01   ` Jeremie Juste
  0 siblings, 1 reply; 9+ messages in thread
From: Jeremie Juste @ 2018-10-14 13:37 UTC (permalink / raw)
  To: Éric Würbel; +Cc: emacs-orgmode

Hello,


I can reproduce your error but a setting without  #+BEGIN_SRC
#+END_SRC seems to work. It not a fix just a way around the problem.


Hope it helps,

Jeremie

#+TITLE: Test d'export tikz qui ne marche plus
#+DATE: <2015-11-10 mar.>

#+LANGUAGE: fr
#+OPTIONS: toc:1 num:1

#+LATEX_HEADER: \usepackage[utf8]{inputenc}
#+LATEX_HEADER: \usepackage[T1]{fontenc}
#+LATEX_HEADER: \usepackage{lmodern} 
#+LATEX_HEADER: \usepackage{tikz} 
#+OPTIONS:   H:3 num:t toc:nil \n:nil @:t ::t |:t ^:t -:t f:t *:t tex:imagemagick title:nil author:nil date:nil

* Récapitulatif


      \usetikzlibrary{trees}
  \begin{tikzpicture}[thick,level 1/.style ={sibling distance=30mm},%
	  level 2/.style={sibling distance=25mm},%
	  level 3/.style={sibling distance=10mm}]
	  \node {racine-par-defaut}
	  [edge from parent fork down]
	    child { node {haute-par-defaut}
	      child { node {rubrique1}
		child { node {a}}
		child { node {b}}
		child { node {c}}
	      }
	      child { node {rubrique2}
		child { node {d}}
		child { node {e}}
		child { node {f}}
	      }
	      child { node {private}}
	    }
	    child { node {site1}}
	    child { node {site2}
	      child { node {zone protegee}}
	    }
	    ;  
	\end{tikzpicture}


\begin{tikzpicture}[ grow=0, nodes={draw}, sibling distance=0.6cm, ->]
\node{n=0}
	child { node {G} 
		child { node {G} }
		child { node {P} }
		child { node {D} }
	child [missing]
	child [missing]
	}
	child [missing]
	child [missing]
	child { node {P} 
		child { node {G} }
		child { node {P} }
		child { node {D} }
	child [missing]
	child [missing]
	}
	child [missing]
	child [missing]
	child {node {D} 
		child { node {G} }
		child { node {P} }
		child { node {D} }
	child [missing]
	child [missing]
	};
\end{tikzpicture}

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

* Re: no more tikz -> png génération during HTML export
  2018-10-14 13:37 ` Jeremie Juste
@ 2018-10-14 21:01   ` Jeremie Juste
  2018-10-15  6:29     ` Éric Würbel
  2018-10-16  8:04     ` Éric Würbel
  0 siblings, 2 replies; 9+ messages in thread
From: Jeremie Juste @ 2018-10-14 21:01 UTC (permalink / raw)
  To: Éric Würbel; +Cc: emacs-orgmode


Hello

With the following in your .emacs file 

#+BEGIN_SRC 
  (setq org-babel-latex-htlatex "htlatex")
  (defmacro by-backend (&rest body)
    `(case org-export-current-backend ,@body))
#+END_SRC

I can put back #+BEGIN_SRC around the tikz and it seems to work.

#+header: :file (by-backend (html "images/graphic2.png") (t 'nil))
#+header: :imagemagick
#+header: :results (by-backend (pdf "latex") (t "raw"))
#+BEGIN_SRC latex
\begin{figure}[ht]
\centering
\begin{tikzpicture}[xscale=0.5]
    % draw the sets
    \filldraw[fill=none, draw] (-1.5,0) circle (1cm);
    \filldraw[fill=none, draw] (1.5,0) circle (1cm);

    % the texts
    \node at (-1.5,1.5) {$E$};
    \node at (1.5,1.5) {$F$};

    % the points in the sets (here I just create nodes to use them later on to position
    % the circles and the arrows
    \node (a) at (-1.5,0.7) {$a$};
    \node (b) at (-1.5,0.1) {$b$};
    \node (c) at (-1.5,-0.4) {$c$};
    \node (1) at (1.5,0.7) {$1$};
    \node (2) at (1.5,0.1) {$2$};
    \node (3) at (1.5,-0.4) {$3$};

    % draw the arrows
    \draw[->] (a) -- (2);
    \draw[->] (c) -- (2);
    \draw[->] (b) -- (1);
\end{tikzpicture}
\end{figure}
#+END_SRC

Best regards,

Jeremie

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

* Re: no more tikz -> png génération during HTML export
  2018-10-14 21:01   ` Jeremie Juste
@ 2018-10-15  6:29     ` Éric Würbel
  2018-10-16  8:04     ` Éric Würbel
  1 sibling, 0 replies; 9+ messages in thread
From: Éric Würbel @ 2018-10-15  6:29 UTC (permalink / raw)
  To: emacs-orgmode; +Cc: Éric Würbel

Hi,

I read your two answer only this morning. Thanks a lot for the provided
tips.
Clearly the first solution doesn't fit, as I face this situation for
dozens of org pages which compose a web site...

I will test your second trick. However I would like to understand how it works.

I wasn't aware of the `org-babel-latex-htlatex', how is it used ?
And why wrapping the call to the export backend into a macro "do the
trick" ?

Thanks again.

E.
Le 14/10/2018 à 21:01 GMT, Jeremie Juste a dit:

> Hello
>
> With the following in your .emacs file 
>
> #+BEGIN_SRC 
>   (setq org-babel-latex-htlatex "htlatex")
>   (defmacro by-backend (&rest body)
>     `(case org-export-current-backend ,@body))
> #+END_SRC
>
> I can put back #+BEGIN_SRC around the tikz and it seems to work.
>
> #+header: :file (by-backend (html "images/graphic2.png") (t 'nil))
> #+header: :imagemagick
> #+header: :results (by-backend (pdf "latex") (t "raw"))
> #+BEGIN_SRC latex
> \begin{figure}[ht]
> \centering
> \begin{tikzpicture}[xscale=0.5]
>     % draw the sets
>     \filldraw[fill=none, draw] (-1.5,0) circle (1cm);
>     \filldraw[fill=none, draw] (1.5,0) circle (1cm);
>
>     % the texts
>     \node at (-1.5,1.5) {$E$};
>     \node at (1.5,1.5) {$F$};
>
>     % the points in the sets (here I just create nodes to use them later on to position
>     % the circles and the arrows
>     \node (a) at (-1.5,0.7) {$a$};
>     \node (b) at (-1.5,0.1) {$b$};
>     \node (c) at (-1.5,-0.4) {$c$};
>     \node (1) at (1.5,0.7) {$1$};
>     \node (2) at (1.5,0.1) {$2$};
>     \node (3) at (1.5,-0.4) {$3$};
>
>     % draw the arrows
>     \draw[->] (a) -- (2);
>     \draw[->] (c) -- (2);
>     \draw[->] (b) -- (1);
> \end{tikzpicture}
> \end{figure}
> #+END_SRC
>
> Best regards,
>
> Jeremie


-- 
Éric Würbel
http://eric.wurbel.perso.luminy.univ-amu.fr/
Enseignement: IUT R&T, directeur des études 1A
Recherche: LIS CNRS, UMR7020 http://www.lis-lab.fr/

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

* Re: no more tikz -> png génération during HTML export
  2018-10-14 21:01   ` Jeremie Juste
  2018-10-15  6:29     ` Éric Würbel
@ 2018-10-16  8:04     ` Éric Würbel
  2018-10-16  9:18       ` Eric S Fraga
  1 sibling, 1 reply; 9+ messages in thread
From: Éric Würbel @ 2018-10-16  8:04 UTC (permalink / raw)
  To: emacs-orgmode; +Cc: Éric Würbel


Hello list,

I finally tracked down the problem. It is not related to my use of
latexmk. It is an Imagemagick problem. The version installed by xubuntu
18.04 has a restrictive policy on pdf files. I tweaked the
'/etc/ImageMagick-6/policy.xml' file which contains the following policy
restriction :

<policy domain="coder" rights="none" pattern="PDF" />

Which I rewrote into :

<policy domain="coder" rights="read|write" pattern="PDF" />

And now everything works fine with my original code.

E.

Le 14/10/2018 à 21:01 GMT, Jeremie Juste a dit:

> Hello
>
> With the following in your .emacs file 
>
> #+BEGIN_SRC 
>   (setq org-babel-latex-htlatex "htlatex")
>   (defmacro by-backend (&rest body)
>     `(case org-export-current-backend ,@body))
> #+END_SRC
>
> I can put back #+BEGIN_SRC around the tikz and it seems to work.
>
> #+header: :file (by-backend (html "images/graphic2.png") (t 'nil))
> #+header: :imagemagick
> #+header: :results (by-backend (pdf "latex") (t "raw"))
> #+BEGIN_SRC latex
> \begin{figure}[ht]
> \centering
> \begin{tikzpicture}[xscale=0.5]
>     % draw the sets
>     \filldraw[fill=none, draw] (-1.5,0) circle (1cm);
>     \filldraw[fill=none, draw] (1.5,0) circle (1cm);
>
>     % the texts
>     \node at (-1.5,1.5) {$E$};
>     \node at (1.5,1.5) {$F$};
>
>     % the points in the sets (here I just create nodes to use them later on to position
>     % the circles and the arrows
>     \node (a) at (-1.5,0.7) {$a$};
>     \node (b) at (-1.5,0.1) {$b$};
>     \node (c) at (-1.5,-0.4) {$c$};
>     \node (1) at (1.5,0.7) {$1$};
>     \node (2) at (1.5,0.1) {$2$};
>     \node (3) at (1.5,-0.4) {$3$};
>
>     % draw the arrows
>     \draw[->] (a) -- (2);
>     \draw[->] (c) -- (2);
>     \draw[->] (b) -- (1);
> \end{tikzpicture}
> \end{figure}
> #+END_SRC
>
> Best regards,
>
> Jeremie


-- 
Éric Würbel
http://eric.wurbel.perso.luminy.univ-amu.fr/
Enseignement: IUT R&T, directeur des études 1A
Recherche: LIS CNRS, UMR7020 http://www.lis-lab.fr/

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

* Re: no more tikz -> png génération during HTML export
  2018-10-16  8:04     ` Éric Würbel
@ 2018-10-16  9:18       ` Eric S Fraga
  2018-10-16  9:46         ` Éric Würbel
  0 siblings, 1 reply; 9+ messages in thread
From: Eric S Fraga @ 2018-10-16  9:18 UTC (permalink / raw)
  To: emacs-orgmode

On Tuesday, 16 Oct 2018 at 10:04, Éric Würbel wrote:
> Hello list,
>
> I finally tracked down the problem. It is not related to my use of
> latexmk. It is an Imagemagick problem. The version installed by xubuntu
> 18.04 has a restrictive policy on pdf files. I tweaked the
> '/etc/ImageMagick-6/policy.xml' file which contains the following policy
> restriction :

Wow!  Well done in tracking this down.  Why would ubuntu do this?  The
Debian release does not have the restriction.  It might be worth adding
a note to the manual, although I am not entirely sure where because this
whole aspect of LaTeX fragments and how they are converted is spread
over several sections and footnotes.

-- 
Eric S Fraga via Emacs 27.0.50, Org release_9.1.11-620-ga548e4

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

* Re: no more tikz -> png génération during HTML export
  2018-10-16  9:18       ` Eric S Fraga
@ 2018-10-16  9:46         ` Éric Würbel
  2018-10-16 11:00           ` Eric S Fraga
  0 siblings, 1 reply; 9+ messages in thread
From: Éric Würbel @ 2018-10-16  9:46 UTC (permalink / raw)
  To: emacs-orgmode

Le 16/10/2018 à 09:18 GMT, Eric S Fraga a dit:

> On Tuesday, 16 Oct 2018 at 10:04, Éric Würbel wrote:
>> Hello list,
>>
>> I finally tracked down the problem. It is not related to my use of
>> latexmk. It is an Imagemagick problem. The version installed by xubuntu
>> 18.04 has a restrictive policy on pdf files. I tweaked the
>> '/etc/ImageMagick-6/policy.xml' file which contains the following policy
>> restriction :
>
> Wow!  Well done in tracking this down.  Why would ubuntu do this?  The
> Debian release does not have the restriction.  It might be worth adding
> a note to the manual, although I am not entirely sure where because this
> whole aspect of LaTeX fragments and how they are converted is spread
> over several sections and footnotes.

You're welcome !

I think that this problem is very specific to the following case :
- LaTeX SRC block
- needed translation of this block into a png (and perhaps svg) image
- preprocessing with pdflatex, so we end up with a pdf->png conversion.

IMO we should perhaps add a warning in this worg page :
https://orgmode.org/worg/org-contrib/babel/languages/ob-doc-LaTeX.html

Except if anyone identify another use case which can lead to the same
problem.

E.
--
Éric Würbel
http://eric.wurbel.perso.luminy.univ-amu.fr/
Enseignement: IUT R&T, directeur des études 1A
Recherche: LIS CNRS, UMR7020 http://www.lis-lab.fr/

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

* Re: no more tikz -> png génération during HTML export
  2018-10-16  9:46         ` Éric Würbel
@ 2018-10-16 11:00           ` Eric S Fraga
  2018-10-17 13:02             ` Nicolas Goaziou
  0 siblings, 1 reply; 9+ messages in thread
From: Eric S Fraga @ 2018-10-16 11:00 UTC (permalink / raw)
  To: emacs-orgmode

On Tuesday, 16 Oct 2018 at 11:46, Éric Würbel wrote:
> I think that this problem is very specific to the following case :
> - LaTeX SRC block
> - needed translation of this block into a png (and perhaps svg) image
> - preprocessing with pdflatex, so we end up with a pdf->png conversion.

It is specific but this is a quite widely used process for many exporting to HTML and ODT.

> IMO we should perhaps add a warning in this worg page :
> https://orgmode.org/worg/org-contrib/babel/languages/ob-doc-LaTeX.html

I think this warning should be in the main manual.
-- 
Eric S Fraga via Emacs 27.0.50, Org release_9.1.11-620-ga548e4

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

* Re: no more tikz -> png génération during HTML export
  2018-10-16 11:00           ` Eric S Fraga
@ 2018-10-17 13:02             ` Nicolas Goaziou
  0 siblings, 0 replies; 9+ messages in thread
From: Nicolas Goaziou @ 2018-10-17 13:02 UTC (permalink / raw)
  To: Eric S Fraga; +Cc: emacs-orgmode

Hello,

Eric S Fraga <e.fraga@ucl.ac.uk> writes:

> On Tuesday, 16 Oct 2018 at 11:46, Éric Würbel wrote:
>> I think that this problem is very specific to the following case :
>> - LaTeX SRC block
>> - needed translation of this block into a png (and perhaps svg) image
>> - preprocessing with pdflatex, so we end up with a pdf->png conversion.
>
> It is specific but this is a quite widely used process for many exporting to HTML and ODT.
>
>> IMO we should perhaps add a warning in this worg page :
>> https://orgmode.org/worg/org-contrib/babel/languages/ob-doc-LaTeX.html
>
> I think this warning should be in the main manual.

I didn't follow closely the issue so... suggestions or patches
welcome. :)

Regards,

-- 
Nicolas Goaziou

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

end of thread, other threads:[~2018-10-17 13:02 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-10-12 12:26 no more tikz -> png génération during HTML export Éric Würbel
2018-10-14 13:37 ` Jeremie Juste
2018-10-14 21:01   ` Jeremie Juste
2018-10-15  6:29     ` Éric Würbel
2018-10-16  8:04     ` Éric Würbel
2018-10-16  9:18       ` Eric S Fraga
2018-10-16  9:46         ` Éric Würbel
2018-10-16 11:00           ` Eric S Fraga
2018-10-17 13:02             ` Nicolas Goaziou

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