Latest news 2022-03-24: new blog post "Book Shop Closed Indefinitely Due to PayPal Removing Support for Encrypted Website Payments".
Previous: Export to PGF  Up: Export  Next: Print

## Export to Single-Paged Document

The export to PGF function is used when the file filter is set to LaTeX document (*.tex, *.ltx), Encapsulated LaTeX document (*.tex, *.ltx), Portable Document Format (*.pdf), PostScript (*.eps, *.ps) or Scalable Vector Graphics (*.svg) in the export dialog box.

In the case of the LaTeX document (*.tex, *.ltx) filter, a .tex file is created with the code for a single-paged LaTeX document containing the image, where the page size is set to the canvas page size.

In the other cases, a .tex file is created with the code for a single-paged LaTeX document containing the image, where the page size is set to the image's bounding box. (If the bounding box is smaller than the baselineskip, the page height is set to the baselineskip, according to the given normal size for the image.)

The export to PostScript, PDF or SVG options all then run either just pdflatex or latex followed by dvips or dvisvgm to create the required format. The .tex file (and its associated temporary files) are then deleted. In the case of PostScript or SVG, if the image contains any bitmaps, FlowframTk will attempt to convert them to EPS, where necessary. If the exported file has unexpected results or fails to be created, try exporting to an encapsulated LaTeX document and then manually running pdflatex or latex, as the issue may be due to the conversion process or it may be due to an unrecognised command or syntax error in a text area or text-path. Note that PostScript does not support transparency.

If a default preamble has been set (see Default Preamble) the code will be included in the .tex file's preamble. This is in addition to the contents of the image's early-, mid- and late-preamble. For example, I have set the default preamble to:

\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lmodern}

I recommend that at the very least you have the inputenc and fontenc packages in your default preamble (or fontspec if you use XeLaTeX).

If your image includes LaTeX commands that require a particular package, you will need to add these packages to the image preamble. This is done automatically by the mapping function, if it has been enabled. See Adding Commands to the Preamble for further details.

FlowframTk will automatically add \usepackage{pgf} to the preamble and other packages such as geometry and ifpdf. It will also add

\usepgflibrary{decorations.text}

in case the image contains any text-paths.

Changes caused by differences in the way that FlowframTk renders text areas with the way that LaTeX typesets them can cause the image to be clipped if the bounding box has been underestimated. If this is a problem, you can switch on the Use typeblock as bounding box for pgfpicture option and use the typeblock function to mark your preferred bounding box.

For example, in Figure 5.3 I have a text area with the alternative LaTeX text set to:

$\displaystyle f(\boldsymbol{\Upupsilon}; \eta ) = \frac{1}{2}\eta \sum_k\boldsymbol{\upupsilon}_k\cdot \boldsymbol{\upupsilon}_k$

Below this is a path for illustrative purposes. When viewed in FlowframTk, as shown in Figure 5.3(a), the text area and path are the same widths, but when the image is exported to PDF, shown in Figure 5.3(b), the equation generated by the alternative text is wider that its representation on the canvas and has consequently been clipped (both the top of the fraction and the right end of the equation) because it exceeds the image bounding box that was computed by FlowframTk. In Figure 5.3(c), a rectangle has been added to the image. This now extends the image bounding box, so when the image is now exported to PDF, as shown in Figure 5.3(d), the equation is no longer clipped, but the new rectangle is now visible, which may not be desirable. There are two ways to deal with this. The first is to give the rectangle a transparent line colour (in addition to the transparent fill colour) but now it can only been detected on the canvas when it's selected. The second method is to set the typeblock to the area of that rectangle (see Defining the Typeblock). The easiest way to do this is to select the rectangle, use the TeX/LaTeX->Flow Frames->Set Typeblock menu item to open the Typeblock dialog box, and click on the Compute Margins From Selected Path button. Then delete the rectangle. The typeblock is now shown as a grey rectangle in Figure 5.3(e). Now make sure that the Use typeblock as bounding box for pgfpicture setting is on. Redoing the export to PDF now produces the image shown in Figure 5.3(f).

 (a) (b) (c) (d) (e) (f)
Figure 5.3: Exported Text Areas Can Overflow Bounding Box: (a) image as shown on canvas; (b) image exported to PDF (equation has been clipped); (c) rectangle added to image; (d) image from (c) exported to PDF; (e) typeblock added and rectangle removed; (f) image from (e) exported to PDF.