emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Myles English <mylesenglish@gmail.com>
To: Julien Cubizolles <j.cubizolles@free.fr>
Cc: emacs-orgmode@gnu.org
Subject: Re: Embedded Tikz Picture
Date: Sun, 14 Jul 2013 16:35:31 +0100	[thread overview]
Message-ID: <87txjxf930.fsf@gmail.com> (raw)
In-Reply-To: <87txk0wzmv.fsf@free.fr>


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

  parent reply	other threads:[~2013-07-14 15:32 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-11 21:33 Embedded Tikz Picture Julien Cubizolles
2013-07-11 22:16 ` Eric Schulte
2013-07-12  5:21   ` Julien Cubizolles
2013-07-14 15:35 ` Myles English [this message]
2013-07-15  8:14   ` Julien Cubizolles

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=87txjxf930.fsf@gmail.com \
    --to=mylesenglish@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=j.cubizolles@free.fr \
    /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).