emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Andreas Leha <andreas.leha@med.uni-goettingen.de>
To: emacs-orgmode@gnu.org
Subject: Re: Tangled Latex code gives error
Date: Mon, 27 Apr 2015 09:28:07 +0100	[thread overview]
Message-ID: <olur3r6j7qg.fsf@med.uni-goettingen.de> (raw)
In-Reply-To: CAFAhFSWgsG+MVX4KQrC7k1-TOJMre2SaZJDhHTmMxy-OpD9NtA@mail.gmail.com

Hi Lawrence,

Lawrence Bottorff <borgauf@gmail.com> 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

  parent reply	other threads:[~2015-04-27  8:28 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-26 23:20 Tangled Latex code gives error Lawrence Bottorff
2015-04-27  1:45 ` Lawrence Bottorff
2015-04-27  8:28 ` Andreas Leha [this message]
2015-04-27  9:33 ` Eric S Fraga
2015-04-27 11:58   ` Lawrence Bottorff
2015-04-28  7:33     ` e.fraga

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=olur3r6j7qg.fsf@med.uni-goettingen.de \
    --to=andreas.leha@med.uni-goettingen.de \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).