C.a.R. > Documentation > Graphics export

Graphics Export

For a first impression of the things that can be done with the graphics export from C.a.R, have a look at the C.a.R. Wiki, especially the article about C.a.R. and LaTeX.

Basics

C.a.R. can export constructions to files in either pixel or vector format. Graphics can be scaled to any resolution. C.a.R. can save information into the files about the print size. Thus graphics can be printed with 1 unit in the C.a.R. coordinate system equal to 1 cm.

Graphics can be imported to almost all programs that can handle graphics. The most important case will be a word processor (like Word or LaTeX), of course. Graphics can also be exported over the clipboard.

There are two principle formats for graphics, vector and pixel format. Vector format is good for archiving, since the files are small. Moreover, vector formats can be edited with a vector program, like Corel Draw. Scalability is not an argument for vector formats. The reason is that good layout depends on the size of the output. Font sizes, line widths, point sizes must be chosen with the print size in mind. Simply scaling everything is no solution. That is, why I recommend a pixel format of proper size and resolution for C.a.R.

Let us talk about PNG output first. To understand the preview or scaling dialog for this export, you need to keep in mind that a graphics is determined by two of the following three parameters:

When exporting to the Web, you will think in pixels, of course. But when exporting for print, you make sure the resolution is high enough (usually 300 dpi), and the the size is the print size. The size in pixels will be computed by C.a.R.

When the print size is different from the size on the screen, you want to scale the line widths and the font sizes. Otherwise, texts may be too small to be readable, or may be too large to look good. In the preview dialog, you can choose to scale these items properly. The preview will then show the construction, as it would be printed. You may have to change the layout a bit for a nice display.

PNG Export

PNG is a flexible, open and free pixel format and can be used by word processors, graphics programs and in the Web. PNG uses lossless compression. Like any pixel format, it stores graphics in an array of pixels, each pixel in one of 256^3 colors.

Besides the picture width and height in pixels, C.a.R. stores information about the resolution of the picture in dots per inch (dpi - 1 inch equals 2.54 cm). Thus programs can compute the dimensions of the picture for printing.

In the graphics export dialog, the user can set either the dimensions in pixels, the resolution, or the dimensions in cm. The dialog will adjust the other fields, as soon as the return key is pressed in the input field.

There are presets in the graphics export dialog. One very important preset will fill the sizes in cm from the coordinate system of C.a.R. for an output that is exactly scaled (1 unit equals 1 cm). Take care that the picture must fit on the page, and that e.g. Word scales the graphics to 100%. Other presets choose output in various sizes, or output designed for screens, not for print.

For screen output, it is also possible to cut out a section in the middle of the screen. A red frame will appear in preview mode.

If the output is printed smaller than on the screen (i.e. not to full page width on a normal page), lines, fonts and texts should be scaled. There is a special option to this in the graphics export dialog. To see the effect and make corrections there is a preview. When the preview is switched on, the graphics export dialog will show up too.

Using Word

Word (or Open Office) can import the PNG output of C.a.R. Just make sure, you have set the correct width in cm and 300 dpi resolution. You should scale the texts etc. too. Also, make sure, Word uses 100% scaling for the graphics.

Using LaTeX

For an introduction, look here. You can either use LaTeX or PDF-LaTeX. There is a special way to export graphics, which lets LaTeX draw some or all strings in the construction. Even if you do not want this, you should use the special LaTeX export, since it generates a bounding box file for your construction too, which is needed for latex to determine the size of your picture.

Here is a typical LaTeX file importing a C.a.R. image in a figure environment.

\documentclass...
...
\usepackage{graphicx}
...
\begin{document}
...
\begin{figure}[h]
\centering
\input{test.ztx}
\end{figure}
...
\end{document}

The file test.ztx contains all necessary command to draw the image. This file is generated, when you export the graphics as test.png, along with a file test.bb containing the image sizes. In LaTeX, you should avoid spaces in file names.

All you need to do is to choose the export for LaTeX. In the first dialog you may simply choose the preset "LaTeX at 10pt". If the 12cm is wrong, correct it, and press enter in that field. If the 10pt font size for LaTeX are wrong, you can enter "11pt" etc. in the font size field. This value is important for the preview and for the strings, that LaTeX does not draw.

In the second dialog, you can choose, if you really need that bb-file. You might not need it for PDF-LaTeX. You can skip the generation of the ztx-file. In this case use

\includegraphics[width=12cm]{test.png}

instead of the input command above.

I do not recommend to use EPS, though this may look natural. The EPS export of C.a.R. looses transparency, and all Greek or other symbolic characters from Unicode. Moreover, it is not possible to use LaTeX code. In general, the graphics look inferior to PNG.

Clipboard

It is possible to copy to the clipboard. The same scaling as with PNG takes place, using the same dialog. For a screen dump use "Window Size". The difference to PNG is that no information about the resolution is transmitted. The graphics must be scaled in the receiving program for print.

Vector Export

From the various vector formats supported in C.a.R. only EPS (encapsulated postscript) and PDF (Adobes portable document format) are well known. EPS can be imported into Word and can be used in TeX. PDF is a good format to store small pictures in the Web. However, both formats do not support transparent areas and Greek letters currently, nor anti-aliased lines.

C.a.R. > Documentation > Graphics export