emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Embedded Tikz Picture
@ 2013-07-11 21:33 Julien Cubizolles
  2013-07-11 22:16 ` Eric Schulte
  2013-07-14 15:35 ` Myles English
  0 siblings, 2 replies; 5+ messages in thread
From: Julien Cubizolles @ 2013-07-11 21:33 UTC (permalink / raw)
  To: emacs-orgmode

What would be the best way to use some tikz code in an org-file ?

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.

I also tried embedding the corresponding LaTeX code, but I only got a
white square for the picture. I guess the relevant packages weren't
loaded. Is it possible to make the embedded LaTeX code use the class
defined by #+LATEX_CLASS ?

Finally it seems Babel could be the way to go but I'm not sure what it
offers for LaTeX source with respect to Embedded LaTeX in this case.

Thanks for your help. I'm trying to make the switch to Orgmode for all
my LaTeX needs and it's quite a steep learning curve.

Julien.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Embedded Tikz Picture
  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
  1 sibling, 1 reply; 5+ messages in thread
From: Eric Schulte @ 2013-07-11 22:16 UTC (permalink / raw)
  To: Julien Cubizolles; +Cc: emacs-orgmode

Julien Cubizolles <j.cubizolles@free.fr> writes:

> What would be the best way to use some tikz code in an org-file ?
>
> 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.
>
> I also tried embedding the corresponding LaTeX code, but I only got a
> white square for the picture. I guess the relevant packages weren't
> loaded. Is it possible to make the embedded LaTeX code use the class
> defined by #+LATEX_CLASS ?
>
> Finally it seems Babel could be the way to go but I'm not sure what it
> offers for LaTeX source with respect to Embedded LaTeX in this case.
>

I actually just added this example to worg today, it should answer your
question.

Cheers,

http://orgmode.org/worg/org-contrib/babel/languages/ob-doc-LaTeX.html#sec-4-3

>
> Thanks for your help. I'm trying to make the switch to Orgmode for all
> my LaTeX needs and it's quite a steep learning curve.
>
> Julien.
>
>
>

-- 
Eric Schulte
http://cs.unm.edu/~eschulte

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Embedded Tikz Picture
  2013-07-11 22:16 ` Eric Schulte
@ 2013-07-12  5:21   ` Julien Cubizolles
  0 siblings, 0 replies; 5+ messages in thread
From: Julien Cubizolles @ 2013-07-12  5:21 UTC (permalink / raw)
  To: emacs-orgmode

Eric Schulte <schulte.eric@gmail.com> writes:

> Julien Cubizolles <j.cubizolles@free.fr> writes:

>> Finally it seems Babel could be the way to go but I'm not sure what it
>> offers for LaTeX source with respect to Embedded LaTeX in this case.
>>
>
> I actually just added this example to worg today, it should answer your
> question.
>
> Cheers,
>
> http://orgmode.org/worg/org-contrib/babel/languages/ob-doc-LaTeX.html#sec-4-3

Thanks, I don't need the html export for now (although your example
makes me want to try it) but I guess one could adapt it to display the
corresponding png or pdf image in the org file.

Julien.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Embedded Tikz Picture
  2013-07-11 21:33 Embedded Tikz Picture Julien Cubizolles
  2013-07-11 22:16 ` Eric Schulte
@ 2013-07-14 15:35 ` Myles English
  2013-07-15  8:14   ` Julien Cubizolles
  1 sibling, 1 reply; 5+ messages in thread
From: Myles English @ 2013-07-14 15:35 UTC (permalink / raw)
  To: Julien Cubizolles; +Cc: emacs-orgmode


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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Embedded Tikz Picture
  2013-07-14 15:35 ` Myles English
@ 2013-07-15  8:14   ` Julien Cubizolles
  0 siblings, 0 replies; 5+ messages in thread
From: Julien Cubizolles @ 2013-07-15  8:14 UTC (permalink / raw)
  To: emacs-orgmode

Hi Myles, and thanks for your input. I've also been playing with
standalone, and successfully got the pictures when exporting to latex
and beamer.

Myles English <mylesenglish@gmail.com> writes:


> 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 :


Does this allow you to get the picture displayed in the org-mode ?

Julien.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2013-07-15  8:15 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
2013-07-15  8:14   ` Julien Cubizolles

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).