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