# How can I import a picture of the format graphml into LaTeX?

I have to import a picture into LaTeX which is in the format graphml created using yEd. I would like to avoid converting it in a .pdf since then LaTeX would import the whole A4 page. Could you help me?

• Welcome to TeX.SX. Please provide some more information about your efforts for so far. And give us a small example of your code. Why does LaTeX import a DIN A4 page? You can scale the image if you want. PDF should be no problem. – LaRiFaRi Mar 26 '14 at 13:24
• You can include graphics in pdf format using \includegraphics from package graphicx (if running in non-DVI-mode) – Johannes_B Mar 26 '14 at 13:27
• Don't know the tool, but maybe you would like to translate your graphml into TikZ with findbestopensource.com/product/yworks2pgf – LaRiFaRi Mar 26 '14 at 13:33

As you can see here LaTeX only supports a limited set of graphics.

If you can easily convert your graphml file to PDF or EPS, then convert it. Then you can use the trim option to \includegraphics{} to trim all the extra space around it:

%trim option's parameter order: left bottom right top
\includegraphics[trim = 10mm 80mm 20mm 5mm, clip, width=3cm]{yourpdffile.pdf}

You can try various trimming sizes until the included image has no extra white space.

But in general, I would suggest you to take a look at the pgfplots package in LaTeX if you want to put plots in a LaTeX document. It will make the plots in LaTeX and has an excellent and easy to learn manual. So all the fonts, line widths, colors and all the settings in your graph will be identical to your document.

You open the graphml with yEd and export it as example.eps. In LaTeX you can then do

\usepackage{graphicx}
\usepackage{epstopdf}
...
\includegraphics{example}

EPS is Encapsulated PostScript and this works with different ways creating the pdf including running pdflatex and latex. When using pdflatex epstopdf will create a pdf from the eps on the fly with the name example-eps-converted-to.pdf.

Note that you can't export from command line with yEd. That feature is explicitely not available due to licensing reasons [1].