From: Alan Schmitt <alan.schmitt@polytechnique.org>
To: emacs-orgmode <emacs-orgmode@gnu.org>
Subject: shorter syntax for both latex and html export of a figure
Date: Mon, 07 Mar 2016 11:35:48 +0100 [thread overview]
Message-ID: <m2egbmy3qz.fsf@charm-ecran.irisa.fr> (raw)
[-- Attachment #1.1: Type: text/plain, Size: 177 bytes --]
Hello,
I'm trying to adapt the example that allows to export a figure both to
tikz and to png so that I don't have to manually add all the header
lines.
Here is what I tried:
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.2: orgtikz.org --]
[-- Type: text/x-org, Size: 1632 bytes --]
#+LATEX_HEADER: \usepackage{tikz}
* Tikz test
Here's a tree, exported to both html and pdf.
#+header: :file (by-backend (latex "tree.tikz") (t "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
\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
The same, with shorter syntax
#+header: :file (by-backend (latex "tree2.tikz") (t "tree2.png"))
#+begin_src tikz
\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 evaluate this first
#+begin_src emacs-lisp :results silent
(defmacro by-backend (&rest body)
`(case org-export-current-backend ,@body))
(org-babel-do-load-languages
'org-babel-load-languages
'((latex . t)))
(defalias 'org-babel-execute:tikz 'org-babel-execute:latex)
(add-to-list 'org-src-lang-modes '("tikz" . latex))
(defvar org-babel-default-header-args:tikz
'((:imagemagick . "yes")
(:iminoptions . "-density 600")
(:imoutoptions . "-geometry 300")
(:results . "file raw")
(:fit . "yes")
(:headers . "'(\"\\\\usepackage{tikz}\")")))
#+end_src
[-- Attachment #1.3: Type: text/plain, Size: 547 bytes --]
The first part, where all the headers line are there, works great, but
the second source block for a newly defined language tikz (an alias to
latex with some default headers) does not work unfortunately. In the
exported version, I get a minted source block and not a link.
Am I doing something wrong? Is it possible to have a shorter syntax for
these blocks, or do I have to put all the header lines all the time?
Thanks,
Alan
--
OpenPGP Key ID : 040D0A3B4ED2E5C7
Monthly Athmospheric CO₂ (2016-01, Mauna Loa Obs.): 402.52
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 472 bytes --]
next reply other threads:[~2016-03-07 10:35 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-03-07 10:35 Alan Schmitt [this message]
2016-03-07 16:34 ` shorter syntax for both latex and html export of a figure Charles C. Berry
2016-03-08 10:33 ` Alan Schmitt
2016-03-08 13:46 ` Alan Schmitt
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=m2egbmy3qz.fsf@charm-ecran.irisa.fr \
--to=alan.schmitt@polytechnique.org \
--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 external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.