1

This should be easy an easy task, but somehow I am confused, therefore I would like to state an example

\documentclass[11pt]{report}
\usepackage{tikz}
\usetikzlibrary{positioning}
\usetikzlibrary{bayesnet}
\begin{document}

\begin{figure}
    \centering
    \tikz{ %
        \node[latent] (phi) {$\phi$};
        \node[latent, right=of phi] (f) {$f$};
        \node[obs, right=of f] (y) {$\bf{y}$};
        \node[latent, above =of f] (sigma) {$\sigma_y$};
        \edge {phi} {f};
        \edge {f, sigma} {y};
    }
\end{figure}
\end{document}

I am using TeXstudio on windows and I would like to produce an image file (say .eps) rather than a pdf.

pkj
  • 511

1 Answers1

1

In my experience with eps exports from tikz, I haven't exactly been pleased with the results. Mostly if I need vector graphics from tikz, I compile to pdf and use that (or convert to svg, e.g. with Inkscape). If you simply need an image, you can convert to png with ImageMagick.

For my own purposes I have created an ImageExport.tex file:

%% Usage for eps-pictures
% Warning: Quality of text seems to be awful with eps...
% Use this documentclass instead of the one below
% \documentclass{standalone}

% Step 1: Include the tikzpicture below, adjust the used packages if needed
% Step 2: Compile to standard pdf, you should receive the image as pdf cropped to the drawing
% Step 3: Run `pdftops -eps ImageExport.pdf`
% Step 4: Rename the resulting eps file accordingly, use it!

% If some app doesn't want to include the graphic correctly, try running `pdftops -level1 -eps ImageExport.pdf` or `pdftops -level2 -eps ImageExport.pdf`

%% Usage for png-pictures
% Needs ImageMagick (http://www.imagemagick.org/script/index.php) and for Windows also Ghostscript (http://ghostscript.com/download/gsdnld.html, 32bit)

% Step 1: Include the tikzpicture below, adjust the used packages if needed
% Step 2: Compile like always but be sure to use the `--shell-escape` option. Ignore errors like "Undefined control sequence \HyperFirstAtBeginDocument"
% Step 3: Rename the resulting png file accordingly, use it!

\documentclass[convert={convertexe={magick}}]{standalone}

\usepackage[utf8]{inputenc}
\usepackage{tikz}
\usetikzlibrary{positioning,fit,calc,...}

\begin{document}
\input{my/tikz/graphic.tex}
\end{document}