# Zumbs' Blog

## Figures for Latex with OpenOffice Draw

Posted by Zumbs on October 4, 2009

There are numerous options for making figures to use with Latex. I usually use pdflatex, and, thus, prefer using figures in pdf format. This gives a few problems. Many programs either do not come with the ability to export to pdf, and even if they do, they export the entire page, and not a cropped figure. Another option is to take a screenshot of your figure, but that often looks ugly and does not scale very well.

OpenOffice comes with a pdf exporter, but it does not automatically crop the page to only contain the figure. It is, however, easy to rectify, as it is easy to change the size of the paper to whatever dimensions you want.

This is handled through the Page Setup dialog, which can be opened by Format->Page, as shown below:

This brings up the Page Setup dialog, where you can edit the width and height of the drawing. When you are done, press ok and investigate if the figure is cropped to your liking.

After having cropped the drawing to your liking, it can be exported to pdf by using File->Export as PDF… and clicking Export in the dialogue. Your new pdf figure can be imported into your Latex document using this small bit of code:

\begin{figure}
\centering
\includegraphics[width=0.9\textwidth]{pdffigure.pdf}
\caption{This is my new pdf figure.} \label{fig:pdffigure}
\end{figure}

Usage of \includegraphics requires that you add \usepackage{graphicx} to the header of your latex document. The described procedure works with LibreOffice as well.

1. ### A zumbs goldbergsaid

Very nice! But is there an easier way in 2015?

• ### Pravin Manesaid

The best way to prepare latex ready figure is
1. Draw figure with openoffice draw. and export it with select all as .svg with selection option ticked.
2. Open it with inkscape and use save as pdf option with pdf+latex option checked. It creates two files .pdf and .pdf_tex
3. Copy these to latex folder and use following code in latex to add your figure
\begin{figure}[!h]
\centering
\def\svgwidth{200\unitlength}
\resizebox{0.98\textwidth}{!}{\input{abc.pdf_tex}}
\caption{asdf}
\label{fig1}
\end{figure}

where abc is name of file. The advantage is the text in figure takes native font of document.