From mboxrd@z Thu Jan 1 00:00:00 1970 From: Myles English Subject: Re: Embedded Tikz Picture Date: Sun, 14 Jul 2013 16:35:31 +0100 Message-ID: <87txjxf930.fsf@gmail.com> References: <87txk0wzmv.fsf@free.fr> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:46711) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UyOHr-0007Ns-Us for emacs-orgmode@gnu.org; Sun, 14 Jul 2013 11:32:36 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UyOHq-0001th-Os for emacs-orgmode@gnu.org; Sun, 14 Jul 2013 11:32:35 -0400 Received: from mail-wi0-x22c.google.com ([2a00:1450:400c:c05::22c]:53569) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UyOHq-0001rk-Jb for emacs-orgmode@gnu.org; Sun, 14 Jul 2013 11:32:34 -0400 Received: by mail-wi0-f172.google.com with SMTP id c10so2085746wiw.17 for ; Sun, 14 Jul 2013 08:32:33 -0700 (PDT) In-reply-to: <87txk0wzmv.fsf@free.fr> 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: Julien Cubizolles Cc: emacs-orgmode@gnu.org Hi Julien, Julien Cubizolles writes: > What would be the best way to use some tikz code in an org-file? I don't know what the best way is. > I've succeeded so far by putting it in a > #+BEGIN_LaTeX > #+END_LaTeX > structure but from what I understand, this code will only be evaluated > when I export to LaTeX. That's right, (maybe beamer too?). > I also tried embedding the corresponding LaTeX code, but I only got a > white square for the picture. Could this be a problem with different paper sizes? If so, the use of the standalone class (see below) may fix this. > I guess the relevant packages weren't loaded. Is it possible to make > the embedded LaTeX code use the class defined by #+LATEX_CLASS? That should be happening already. I had been using tikz like this, (note: this may not work and my intention is not to preclude your ECM): #+LATEX_HEADER: \usepackage{standalone} #+LATEX_CLASS: report #+begin_latex \begin{figure}[htb] \centering \includestandalone[mode=tex,width=5cm]{/home/myles/docs/repo/ve/tex/axisymm} \caption[1D and axisymmetric model domains]{\label{figure:axisymm}1D model domain and mesh of line elements (left), and the axisymmetric variant (right) showing the increased element volumes associated with the line elements.} \end{figure} #+end_latex And then in /home/myles/docs/repo/ve/tex/axisymm.tex : ------------------------------------------------------ \documentclass{standalone} \usepackage{subfig} %\usepackage[pdftex,active,tightpage]{preview} %\setlength\PreviewBorder{2mm} % use to add a border around the image \usepackage{../texlib/mystyle} \usepackage{tikz} \usetikzlibrary{shapes,arrows,fit,positioning,backgrounds} \usetikzlibrary{decorations.pathreplacing} % for braces \begin{document} %\begin{preview} \tikzset{Model axes/.style={color=blue!50,->}} \tikzset{Domain boundary/.style={color=black,thick}} %\tikzset{Element boundary/.style={color=black!70}} \begin{tikzpicture}[scale=3, %\basicBAxes; % arcs % dots place/.style={circle,draw=black,fill=black, inner sep=0pt,minimum size=1mm}] \node (dumm) at ( 0,0) [draw=white,minimum size=0.1mm] {}; \node (one) at ( 0.25,0.8) [place] {}; \node (two) at ( 0.35,0.8) [place] {}; \node (three) at ( 0.55,0.8) [place] {}; \node (four) at ( 0.8,0.8) [place] {}; \draw (one)--(four); \end{tikzpicture} \qquad \begin{tikzpicture}[scale=3, %\basicBAxes; % arcs % dots place/.style={circle,draw=black,fill=black, inner sep=0pt,minimum size=1mm}] % front \draw[Domain boundary] (-90:0.25) arc (-90:90:0.25); \draw[Domain boundary] (-90:0.8) arc (-90:90:0.8); % horseshoe ends \draw[Domain boundary] (-90:0.8) -- (-90:0.25); \draw[Domain boundary] (90:0.8) -- (90:0.25); % back \draw[Domain boundary] (-90:0.25) arc (-90:90:0.25); \draw[Domain boundary] (-90:0.8) arc (-90:90:0.8); % horseshoe ends \draw[Domain boundary] (-90:0.8) -- (-90:0.25); \draw[Domain boundary] (90:0.8) -- (90:0.25); \node (one) at ( 0.25,0) [place] {}; \node (two) at ( 0.35,0) [place] {}; \node (three) at ( 0.55,0) [place] {}; \node (four) at ( 0.8,0) [place] {}; \draw (one)--(four); %\draw[Element boundary] (two) arc (0:90:0.35); %\draw[Element boundary] (two) arc (0:-90:0.35); \draw (two) arc (0:90:0.35); \draw (two) arc (0:-90:0.35); \draw (three) arc (0:90:0.55); \draw (three) arc (0:-90:0.55); \end{tikzpicture} %\end{preview} \end{document} ------------------------------------------------------ Myles