From mboxrd@z Thu Jan 1 00:00:00 1970 From: Myles English Subject: Re: [PATCH] ob-R.el, ox-latex.el: support for tikz graphics Date: Tue, 26 Feb 2013 12:25:07 +0000 Message-ID: <87bob7clek.fsf@gmail.com> References: <1361731894-2738-1-git-send-email-aaronecay@gmail.com> <87621gfmkb.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([208.118.235.92]:47378) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UAJZm-0002c8-Ln for emacs-orgmode@gnu.org; Tue, 26 Feb 2013 07:24:11 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UAJZk-0002aG-0W for emacs-orgmode@gnu.org; Tue, 26 Feb 2013 07:24:06 -0500 Received: from mail-wi0-f179.google.com ([209.85.212.179]:53870) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UAJZj-0002Zz-Qt for emacs-orgmode@gnu.org; Tue, 26 Feb 2013 07:24:03 -0500 Received: by mail-wi0-f179.google.com with SMTP id ez12so4551308wid.0 for ; Tue, 26 Feb 2013 04:24:03 -0800 (PST) In-reply-to: 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: Achim Gratz Cc: emacs-orgmode@gnu.org Hello, 'Scuse me for butting in but I would just like to share how I use tikz graphics using the 'standalone' class, maybe its useful (and maybe not). The advantage is that you can compile the tikz file by itself to see how it looks and then \include it in the main document without having to change it or compile it separately. Achim Gratz writes: > I don't understand. What I currently need to do for TikZ is this: > > #+LaTeX: \begin{figure}[t]\centering > #+LaTeX: \input{oldModel.tikz} > #+LaTeX: \caption{Relative modelling error} > #+LaTeX: \label{fig:oldModel} > #+LaTeX: \end{figure} > > With the patch that becomes much easier (especially if you want to bounce it to > HTML eventually, even though the HTML exporter would need to grok that the tikz > picture should first be converted to SVG or PNG or some other image format): > > #+CAPTION: Relative modelling error > #+LABEL: fig:oldModel > #+ATTR_LaTeX: :placement [t] > [[file:oldModel.tikz]] > > Now, what I'd really like to do is to combine this with the production of the > tikz file by Gnuplot like so: > > #+HEADERS: :term "tikz size 15cm,5cm" :exports none :results yes > #+BEGIN_SRC gnuplot :file oldModel.tikz :cache yes... > > #+RESULTS[4d90e02adddfd56f8fbf6bc99963b9bffe1f201e]: > #+CAPTION: Relative modelling error for DP0.7 model > #+LABEL: fig:oldModel > #+ATTR_LaTeX: :placement [t] > [[file:oldModel.tikz]] (This is not a MWE) ---------------------------------- tikz file ---------------------------------- \documentclass{standalone} \usepackage{tikz} \usetikzlibrary{calc,trees,positioning,arrows,chains,shapes.geometric,% decorations.pathreplacing,decorations.pathmorphing,shapes,% matrix,shapes.symbols,shadows} \begin{document} \input{/home/myles/docs/repo/graphics/tikz/tikz_style.tex} \begin{tikzpicture}[rotate=-40] \cylAxes; %\draw[help grid] (0,0) grid (5,5); \node[draw=none,inner sep=0] at (2,4) (yy) {}; \draw[inner sep=0] (0,0) -- +(90:4cm) arc (180:0:1cm and .5cm) node[name=nn] {}; \node[ellipse, rotate=-40, draw,anchor=west, minimum height=1cm, minimum width=2cm, inner sep=0] (0,0) (bb) {}; \draw (bb.east) -- (yy); % domain \draw[Domain boundary, color=red, inner sep=0] (bb.50) -- ++(40:8) -- ++(90:4) -- (bb.50|-+90:4.5) -- (bb.50); \end{tikzpicture} \end{document} # ----------------------------- org doc ------------------------------------- #+LATEX_HEADER: \usepackage{standalone} #+LATEX_CLASS: report #+LATEX_CLASS_OPTIONS: [10pt,a4paper] #+LATEX_HEADER: \DeclareGraphicsExtensions{.pdf,.png,.jpg,.mps} #+LATEX_HEADER: \usepackage{subfig} #+LATEX_HEADER: \usepackage{tikz} #+LATEX_HEADER: \usetikzlibrary{shapes,arrows,fit,positioning,backgrounds} #+LATEX_HEADER: \usetikzlibrary{decorations.pathreplacing} % for braces #+begin_latex \begin{figure}[htb] \centering \includestandalone[mode=tex,width=5cm]{/home/myles/docs/repo/graphics/tikz/2daxial} \caption[2D linked domain]{\label{figure:2D_linked_domain}Tunnel domains.} \end{figure} #+end_latex #------------------------------------------------------------------- Myles