Zumbs' Blog

The truth may be out there, but lies are inside your head

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:

OpenOfficeDrawPage

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.

OpenOfficeDrawPageSetup

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.

2 Responses to “Figures for Latex with OpenOffice Draw”

  1. A zumbs goldberg said

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

    • Pravin Mane said

      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.

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

 
%d bloggers like this: