From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andreas Leha Subject: Re: Tangled Latex code gives error Date: Mon, 27 Apr 2015 09:28:07 +0100 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:43436) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YmeP9-0000WM-0y for emacs-orgmode@gnu.org; Mon, 27 Apr 2015 04:28:40 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YmeP3-0005kf-P9 for emacs-orgmode@gnu.org; Mon, 27 Apr 2015 04:28:38 -0400 Received: from plane.gmane.org ([80.91.229.3]:39965) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YmeP3-0005kR-JC for emacs-orgmode@gnu.org; Mon, 27 Apr 2015 04:28:33 -0400 Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1YmeOi-0007IX-RN for emacs-orgmode@gnu.org; Mon, 27 Apr 2015 10:28:13 +0200 Received: from 193.63.221.45 ([193.63.221.45]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 27 Apr 2015 10:28:12 +0200 Received: from andreas.leha by 193.63.221.45 with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 27 Apr 2015 10:28:12 +0200 List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org Hi Lawrence, Lawrence Bottorff writes: > I'm following the Latex howto of org-mode babel. Here's the snippet > from the howto I've got in a separate .org file (see bottom of howto > page): > > #+LATEX_HEADER: \usepackage{tikz} > > First execute the second code block, to define the convenience macro > and to set the required new variables in ob-latex.el. Then export to > HTML and to pdf to see the tree exported as an SVG image and as > embedded tikz respectively. > > * Tikz test > Here's a tree, exported to both html and pdf. > > #+header: :file (by-backend (html "tree.svg") (t 'nil)) > #+header: :imagemagick > #+header: :results (by-backend (pdf "latex") (t "raw")) > #+header: :tangle yes > #+begin_src latex > \usetikzlibrary{trees} > \begin{tikzpicture} > \node [circle, draw, fill=red!20] at (0,0) {1} > child { node [circle, draw, fill=blue!30] {2} > child { node [circle, draw, fill=green!30] {3} } > child { node [circle, draw, fill=yellow!30] {4} }}; > \end{tikzpicture} > #+end_src > > * COMMENT setup > #+header: :tangle yes > #+begin_src emacs-lisp :results silent > (setq org-babel-latex-htlatex "htlatex") > (defmacro by-backend (&rest body) > `(case (if (boundp 'backend) (org-export-backend-name backend) nil) , > @body)) > #+end_src > > This doesn't really produce a .svg of the tree as advertised, but > exporting to Latex does produce it just fine. Works as advertised for me. What version of orgmode are you using? There has been a bug fix in that code recently. Note, that in that example the :imagemagick flag is superfluous. It is necessary, for instance, if you want to be able to get a inline displayable image in png as well. Then, the example should be --8<---------------cut here---------------start------------->8--- #+header: :file (by-backend (html "tree.svg") (t "tree.png")) #+header: :imagemagick #+header: :results (by-backend (pdf "latex") (t "raw")) #+begin_src latex \usetikzlibrary{trees} \begin{tikzpicture} \node [circle, draw, fill=red!20] at (0,0) {1} child { node [circle, draw, fill=blue!30] {2} child { node [circle, draw, fill=green!30] {3} } child { node [circle, draw, fill=yellow!30] {4} }}; \end{tikzpicture} #+end_src --8<---------------cut here---------------end--------------->8--- > > My real confusion starts when I try to tangle the babel code blocks. > The C-c C-v t command produces two separate files just fine, a .tex > and .el, but then if I try to Run Latex on the .tex file just by > itself it gives an error. Here's what the org-mode tangle produces: > [ ... snip ... ] Tangling is not meant to produce full LaTeX files. If you want a full and compilable LaTeX document, use the export functionality and export to tex instead of pdf. Then, you can manually compile the tex file. Hope that helps, Andreas