The Prague Bulletin of Mathematical Linguistics
Preparing Images of Trees for Publishing
- This document is an html version of this original contribution.
This short guide describes the process of preparing vector images of trees in the tree editor TrEd. Vector image formats (such as PDF or EPS), unlike bitmap formats (JPG, PNG, BMP etc.), are suitable for publishing in printed journals or bulletins; in fact, PDF is a strongly recommended format for all graphics published in PBML. The greatest benefit of using a vector format over a bitmap format is that a vector image looks the same at arbitrary scale; it looks ok on the computer screen and even better when printed on paper by a high resolution printer. On the other hand, bitmap images that look ok on the screen often look ugly and rasterized when printed on paper (this applies especially to schemas with geometrical shapes, lines, and text, not that much to photographs). The purpose of this guide is therefore also to encourage you to use vector formats wherever possible.
Here we assume the document containing the images is prepared using XeLaTeX, PDFLaTeX, or LaTeX. Some popular office suites, such as OpenOffice.org 2.0, can handle images in PDF and EPS formats as well, so the images prepared according to these guidelines can be included in office documents as well.
The process requires the following steps:
- Start TrEd. Use File→Open and select the file containing the desired tree, for example a file from the Prague Dependency Treebank 2.0. Find the desired tree in the file, e.g. using arrow buttons on the toolbar or by choosing the tree form the list displayed using View→List of sentences.
- Customize the way the tree is displayed. Note that the tree on the resulting image will look just as it is displayed by TrEd on screen. The way TrEd displays the tree can be adjusted in many ways using so called stylesheets, which can be customized using View→Edit stylesheet. The syntax of stylesheets in TrEd is beyond the scope of this document; you can find the necessary information under the Help button in the left corner of the stylesheet editor or in the TrEd User's Manual.
- If everything looks as it should in the resulting image, open the Print dialog using File→Print.
- From the list Media, select the topmost item, BBox. Fill 0 as X margin and Y margin.
- Select Print to file. If using XeLaTeX or PDFLaTeX, which is recommended for PBML, select Create PDF. TrEd will generate a list of TrueType fonts (TTF) available on your system; from this list, choose a font you would like to be used for node labels in the generated PDF. A good choice is a sans serif font, e.g. a PBML recommended and compatible font DejaVu Sans Book. (If you use LaTeX with DVI output, you may rather select Create EPS.)
- To prepare a gray-scaled image (recommended for PBML), leave the option Use colors unchecked. If you check this option, the resulting image will have the same colors as displayed on the screen.
- If you check Print filename and tree number, then the file name and the tree number will appear in a text line below the tree in the resulting image. Similarly, checking Print sentence causes the sentence of the tree (e.g. the text normally displayed above the tree in TrEd's main window) to appear below the tree in the resulting image. In most cases, you will want to leave both these options unchecked and provide a proper caption for the image using the \caption{...} command in the corresponding figure in your LaTeX document, where you can for example copy the sentence from TrEd's main window.
- Adjust the resulting image file name in the field File name.
- If you wish to create images of several trees from the current file, check one tree per file and use the formating pattern \%n somewhere in the file name. this pattern will be replaced by the number of each tree. you may use \%03n instead to force zero-padded 3-digit numbers.
- Now, list the tree numbers of the trees in the Page range field; for example, enter 3-11,30,42- in order to create image files for the trees three to eleven, thirty and for all trees starting from 42 to the end of the file. The button with an icon of a paper clip can be used to select the trees from the list of sentences.
- Finally, press OK. This will generate the image file(s). You can now open the generated PDF images with Adobe Reader (or GhostView in case of EPS output) to see that the result looks as expected. Copy the resulting images to the folder containing your LaTeX document.
Make sure to include the following line in the preamble of your LaTeX document:
\usepackage{graphicx}
In your document, use for example the following lines to include the image file sample0\_a.pdf as a figure:
\begin{figure}[h]
\begin{center}
\includegraphics[scale=0.7]{sample0_a.pdf}
\end{center}
\caption{Sample image of an analytical tree of the Czech sentence
\emph{Mlad� lid� nechod� do divadel �asto} from PDT 2.0.}
\label{fig:sample0-a}
\end{figure}
The parameter scale=0.7 in the square brackets following \includegraphics scales the inserted PDF image by factor 0.7. You can use any other parameters accepted by the LaTeX \includegraphics command, e.g. \includegraphics[width=12.5cm]{sample0_a.pdf}, or you can omit the sqaure brackets entirely, inserting the image as it is. The choice of parameters for \includegraphics and their values is a matter of your choice.

