TikZ figures in org mode files

TikZ images deserve a footnote in the Org-manual. For future reference, I include an example that seems to work.

Say we have a tikz diagram, in a file diagram.tex such as:

\begin{tikzpicture}
  \draw (0,0) grid (7,5);
  \draw (0,0) node[below left] {$A$};
  \draw (7,5) node[above right] {$B$};
  \fill (0,0) circle (2pt);
  \fill (7,5) circle (2pt);
\end{tikzpicture}

Then we can include it in an org file:

#+title: A test

* A TikZ figure

#+name: diag
[[./diagram.tex]]

It helps to set org-latex-image-default-width to the empty string, to avoid resizing the image when exporting to LaTeX. See the discusion here.

Advertisements
This entry was posted in LaTeX and tagged . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s