‘Funny Drawings’ with pst-fun

I learned of the pst-fun package today from an answer at TeX.SX, which provides convenience commands for some ‘fun’ drawings in PStricks. Time for some quick fun then!

\documentclass{minimal}
\usepackage{pst-fun}

\begin{document}
\begin{pspicture}(-1, -2)(13,10)
\psParrot{.8}
\rput (2.5,7) {\psBird[Branch]}
\rput (10,-1.5) {\psscalebox{-1 1}{\psKangaroo[fillcolor=red!30!yellow]{5.75}}}
\rput {-50} (6,0) {\psBird}
\end{pspicture}
\end{document}

Compile with latex, or xelatex if you want a PDF output. And the output looks like this:

…and I really should get back to work now!

Diagramming Applications

This post answers the question

So how do I create high-resolution line drawings for use in LaTeX? Journal publishers request PDF or EPS with at least 800dpi.

Najmi’s post on Drawing diagram; the cryptic way covered tikz, ditaa and graphviz. (I myself swear by tikz.) However these may be too geeky for most people’s tastes. So here’s a list of free, open source, GUI-based diagramming applications that can produce PDF or EPS files.

  • OpenOffice Draw is a diagramming/drawing program that can save to PDF format. It’ a part of the OpenOffice suite. Personally I find it a bit clunky, but if you already have OpenOffice and don’t want to install new programs, it’ a good choice. Available on Linux and Windows. Mac users should look for NeoOffice instead.
  • Dia is an old favorite among Linux users, but some people might think it looks a bit rough. It does a very good job, though, with lots of elements and icons for UML diagrams, networking diagrams, ciruits, etc, etc etc. Dia supports saving to EPS files, and is available for Linux, Windows and Mac.
  • yEd. You know, I actually like yEd. A lot. The interface is easy to use, and there are also elements for UML, “people”, machines and more — in colour. (There’s even an iPod icon!) The output it produces does look more modern and polished then Dia. yEd supports saving to SVG, EPS and PDF, and is available on Linux, Windows and Mac.

Migrating to LaTeX: Producing High-resolution Line Drawings

Recently I was asked this question by not 1, but 3 people, so I guess that makes for a valid blog post!

I’m now migrating my paper/presentation to LaTeX from Microsoft Word/Powerpoint. It feels great! But is there any way I can transfer my existing line drawings over as high-resolution PDF or EPS? The publisher is asking for 800-1200 dpi.

Of course you can. I’ll outline what has worked for me below.

As for the question

So how do I create high-resolution line drawings for use in LaTeX if not the drawing tools in Word?

See the posts on Diagramming Applications and Drawing diagram; the cryptic way instead.

Mac OS X 10.5 Preview

If you’re on a Mac, first print your drawing diagram as a PDF. Open the PDF in Preview. Click the Select button on the Toolbar, and draw a rectangle around your drawing diagram. Then go to Tools menu and select Crop, or just hit Command-K. Save your cropped drawing back as a PDF.

OpenOffice Draw

If you have OpenOffice, you can try copying-and-pasting your drawing objects over to OpenOffice Draw, change the page size (Format > Page…) to fit the drawing just right, then export the drawing to PDF. However, elements and formattings often get distorted when copied over to OODraw, so personally I’d go for the procedures described next.

PDF Freeware Tools

Disclaimer: The tools described in this section are mainly for use in Windows, and are free-of-charge, but not all are open source.
Big thanks to Kevin Klement for pointing me toward PDFCreator and BRISS, true FOSS solutions!

Convert Your Drawing to PDF
First get PDFCreator. Once installed, you will be able to produce PDF out of any documents that is printable.

In your Word or Powerpoint document, select/highlight your line drawing, and go to File > Print. Choose “PDFCreator” as your printer, and select “Selection” or (“Current Page”) as the page range. You should also open the Print Properties, click on the Advanced button, and make sure that Print Quality is set to a sufficiently high dpi (e.g. 1200).

Click OK to print, and you will be prompted to enter any metadata (author, title, etc) you would like about the PDF. Save the PDF. You now have a high-resolution line drawing PDF, but it needs to be cropped to remove the surrounding white space.

First, install PDF995. You’ll need the 2 files from Pdf995 2-Step Download, i.e. the “Printer Driver” and the “Free Converter”. (A warning though: PDF995 is adware.)

In your Word or Powerpoint document, select/highlight your line drawing, and go to File > Print. Choose “PDF995” as your printer, and select “Selection” as the page range.

When you click OK you will be asked to enter a file name to save your PDF to. Bear with the annoying advertisement that pops up for 10 seconds.

Cropping Your PDF
You have a few choices.

  • Photoshop. If you’re one of the lucky souls to have a copy of Photoshop, you can use it to do the job. Just remember to set the Resolution to 800 or 1200 when you open the PDF in Photoshop. Crop, and then save the file back as PDF.
  • GIMP. But chances are that you don’t have Photoshop. GIMP can also open PDF files, and you’ll also be able to specify a sufficiently high resolution when you open it and then crop it. However, while GIMP can save it as an EPS (fine if that’s what you need), it cannot save/export to PDF format. And GIMP rasterises the file before saving (as Kevin pointed out), which defeats the purpose, really. So the winner really goes to…
  • BRISS, which needs a JRE to run. Unzip the BRISS zip file, and double-click on briss-.jar to launch. Load your diagram drawing PDF file, and draw a rectangle around the drawing objects. Click Crop PDF, and you’re done after saving the file.
  • PDF-cropper. You will need .NET 3.5 and GhostScript, so download and install those first before installing PDF-cropper.

    (Theoretically, you can use the GhostScript on command line to crop your PDF, but that involves figuring out the crop box and margins yourself, which I suspect not many people enjoy. Hence PDF-copper.)

    In PDF-cropper, go to the Configure menu and set the path to GhostScript binaries (usually C:\Program Files\GS\GS8.6x\bin), as well as your fixed output folder. Now load all your PDF files containing your drawings (PDF-cropper processes them by batch.) You can choose to crop off all surrounding white space around your drawings, or leave 5mm or 10mm space around them. Click the Action button, and the automatically cropped PDFs will be saved in the fixed output folder you specified.

Congratulations, you should now have high-resolution line drawings in PDF (or EPS) format, that are suitable for journal publication. Now just to include them in your LaTeX file with \includegraphics[width=...]{filename}.