• Tidak ada hasil yang ditemukan

Creating Frames for Use with the flowfram Pack- age

10 TEX/L A TEX

10.4 Creating Frames for Use with the flowfram Pack- age

Jpgfdrawcan be used to help construct frames for use with theflowframpackage.2 If you are unfamiliar with this package, please ensure you read the user manual (ffuser- guide.pdf).

10.4.1 The

flowfram

Package: A Brief Summary

Theflowframpackage is a LATEX 2ε package that allows the user to construct frames in a document, such that the document text flows from one frame to the next in the order that the frames were defined. The mechanism is much the same as that used to create the columns when using the standard two column mode, but the columns are of arbitrary width, height and position.

There are three types of frame: “flow” frames which are the main type of frame.

These are the frames in which the document text is placed. The other two types of frame are “static” and “dynamic”. The contents of these frames has to be set explicitly using one of the commands or environments provided by theflowfram package. The contents of the static frames are typeset once (when the contents are set) and it remains unchanged until the user explicitly resets the contents. The contents of the dynamic frames are re-typeset on each page for which the frame is defined. So, for example, if on page 1 of your document, you set the contents of a static frame to contain the command\thepage, the contents of that frame will always display a 1 (no matter what page it appears on), since that was the value of\thepagewhen the contents were set. If, on the other hand, you use a dynamic frame, the contents will be re-typeset on every page, so it will display the relevant page number.

Each frame has an associated label which uniquely identifies it for a given frame type, and it can optionally have a border. Frames also have an associated page list indicating on which pages the frame should appear. The page list can be one of the keywordsall,odd,evenornone, or it can be a comma separated list of pages or page ranges (e.g.<4,7,9,10-14,>20).

Theflowframpackage stacks the frames on the page in the following order: static, flow and dynamic, each in the order that they were defined. For example, if you define a flow frame calledleft, then define a static frame calledtitle, then a dynamic frame calledheaderand lastly a flow frame definedright, then theflowframpackage will stack the frames in the following order:title,left,rightandheader.

Note thatJpgfdrawdefines the frames according to its ownstacking order, and will allow you to position, say, a static frame above a flow frame,3but once the information has been exported to a LATEX package, the frames will be displayed according to the flowframpackage’s stacking order.

To clear all data relating to theflowframpackage, select the menu itemTeX/LaTeX

→Flow Frames→Clear All.

2The flowfram package can be downloaded fromCTAN.

3This is because the only way to change the stacking order is to move objects to the front, to the back, or by grouping and ungrouping

10.4.2 DEFINING THE TYPEBLOCK 100

See also:

• §11.6 Step-by-Step Example: A Poster

• §11.8 Step-by-Step Example: A Newspaper

10.4.2 Defining the Typeblock

The typeblock is the main area of the page where the text goes. The dimensions of the typeblock are given by the LATEX lengths \textwidth and \textheight.

In Jpgfdraw, you specify the typeblock using the TeX/LaTeX→Flow Frames→Set Typeblock. . .menu item. This opens up a dialog box in which you should specify the margins between the paper edge and the typeblock. You can specify the lengths as TEX points (pt), PostScript points (bp), inches (in) or centimetres (cm).

Once you have set the typeblock, it will appear on the screen as a light gray rectan- gle, labeled typeblock.

10.4.3 Defining a Frame

Anobjectcan be identified as a flow, static or dynamic frame as follows: select the object(it should be the only object selected) then select theTeX/LaTeX→Flow Frames

→Set Frame. . .menu item. This will open up a dialog box in which you can specify the frame’s attributes.

Once an object has been identified as a frame, a grey rectangle will appear on the screen indicating the area in which the contents of the frame will be typeset, along with the frame’s type, identification label and page list.

Note that if the object is a group, the frame information will be applied to the whole group. This means you can construct a frame border by grouping several objects, however, if you later ungroup this object, you will lose the frame information.

Type

The frame’s type is specified using thedrop-down listlabeledType. There is a choice of: Flow,Static,Dynamicor None. Noneindicates that theobjecthas no associated flowframe data, which means that the object will not be saved if the image is exported to a LATEX style file.

Label

Each frame is assigned a label so that it can be referenced in the document. Each label must be unique for its given frame type. To assign a label to this frame, enter the required label in the box markedLabel. Note that if a dynamic frame is given the label “header” or “footer”4it will be converted into the header or footer frame. This is analogous to theflowframpackage’s\makedfheaderfootercommand combined with the relevant attribute commands.

4Note that these labels are hard coded into theflowframpackage and so should not be translated.

10.4.3 DEFINING A FRAME 101

Border

TheBorderdrop-down list allows you to specify whether the frame has a border. If the optionAs Shownis set, then theobjectwill be drawn as the frame’s border. If the optionNoneis set, then the frame will not be given a border, and the object will be used only as an indication of the frame’s size (or possibly shape) and location.

Note that alltext areasare considered to be a part of the frame’s background, not the frame’s contents, and will only appear if the borderAs Shownsetting is applied.

Likewise forbitmaps.

Pages

You can specify the page list on which the frame is defined, using thePagescombo box. Either select one of:All,None,OddorEven, or you can type in a comma separated list of pages or page ranges (e.g. 1-10,12,14,>20). Note that the page numbers correspond to the LATEX page counter’s Arabic representation, not the way the page number appears on the page (for example, pages i–iv must be indicated as1-4). See theflowframuser guide for further details.

See also:

• §10.4.4 Only Displaying Objects Defined on a Given Page

Margins

The frame may have margins between the border and the area in which the contents are typeset. The margins are usually only relevant if you have specified theAs Shown border option. The margins are not available for non-standardparagraph shapes.

Alignment

You can change the vertical alignment of the contents of a static or dynamic frame using theAlignmentdrop-down list. This can be one of:Top,MiddleorBottom, which corre- spond to the settingsvalign=t,valign=candvalign=b, respectively, provided by\setdynamicframe and\setstaticframe. This facility is not available for flow frames.

Shape

The text in flow frames is typeset using the standard rectangular format, but the contents of static or dynamic frames can be shaped using either\parshapeor\shapepar.

If you have selected apath, you can enable this by selecting eitherParshapeorShapepar from theShapedrop-down list. Note that the shape option is not available for any other type ofobject.

Note that if you use theParshapeorShapeparoptions, it will only check if a set of valid parameters can be extracted from the path when you export the image as a LATEX

10.4.4 ONLY DISPLAYING OBJECTS DEFINED ON A GIVEN PAGE 102

package.5 Note, however, that the paragraph shape in your document may not exactly match the shape you created inJpgfdraw:

\parshape:

• If there are not enough words in the paragraph to fill the shape, the shape will be truncated.

• If there are too many words in the paragraph, the dimensions of the final line of the shape will be repeated for each subsequent line.

\shapepar:

• If there are not enough words in the paragraph to fill the shape, the shape will shrink.

• If there are too many words in the paragraph, the shape will expand.

To illustrate this, consider the layout shown inFigure 10.4. There are six identical circles arranged in two rows. Each circle has been identified as a static frame. Their bounding boxes can be seen as light grey rectangles. The top three circles have all been assigned a shape given by\parshape, while the bottom three circles have been assigned a shape given by\shapepar.

This layout was exported as a LATEX package based on theflowframpackage, and was included into a document. Each of the static frames were filled with a varying amount of text. The leftmost circles do not have enough text to fill the designated area, while the rightmost circles have too much text. (SeeFigure 10.5.)

Note that when you use a non-standard paragraph shape, you can no longer specify the margins. Since the paragraph shape is defined by thepath, the margins don’t have any meaning. If you want a border effect, you can make a slightly larger object be- hind, and set the border of the larger object toAs Shownand the border of the smaller object toNone, but remember that the overall effect will depend on the amount of text contained in the frame.

10.4.4 Only Displaying Objects Defined on a Given Page

It is possible to display only those frames that are defined on a given page using the TeX/LaTeX→Flow Frames→Display Page. . .dialog box. You can select to display those frames that are defined on all pages or just those that are defined on odd or even pages or you can specify a particular page number by selecting thePageradio button and entering the relevant page number in the text field. If you specify “0”, only those frames that have theNonepage setting will be displayed. Note thatobjectsthat have not been assigned flowframe data will always be displayed. The title bar will indicate how many objects have been hidden.

5Otherwise it would have to re-evaluate the parameters every time you edit the path.

10.4.4 ONLY DISPLAYING OBJECTS DEFINED ON A GIVEN PAGE 103

Figure 10.4: Layout containing six circles. All circles have been identified as static frames. The top three circles have been assigned a shape given by\parshape. The bottom three circles have been assigned a shape given by\shapepar.

10.4.4 ONLY DISPLAYING OBJECTS DEFINED ON A GIVEN PAGE 104

Some text. Some more text. Some text.

Some more text. Some text.

Some more text. Some text.

Some more text. Some text. Some more text. Some text. Some more text.

Some text. Some more text. Some text.

Some more text. Some text.

Some more text. Some text.

Some more text. Some text. Some more text. Some text. Some more text. Some text. Some more text.

Some text. Some more text. Some text. Some more text. Some text.

Some more text. Some text.

Some more text. Some text. Some more

text.

Some text. Some more text. Some text.

Some more text. Some text.

Some more text. Some text.

Some more text. Some text. Some more text. Some text. Some more text. Some text. Some more text.

Some text. Some more text. Some text. Some more text. Some text.

Some more text. Some text.

Some more text. Some text. Some more

text.

Some text.

Some more text.

Some text.

Some more text.

Some text. Some more text. Some text. Some more text. Some text.

Some more text. Some text. Some more text.

Some text. Some more text.

Sample text. Some more text.

Some text. Some more text.

Some text. Some more text.

Some text. Some more text. Some text. Some more text. Some text.

Some more text. Some text. Some more text. Some text. Some more text. Some text. Some more text.

Some text. Some more text.

Some text. Some more text.

Some more text. Some more text.

Some text.

Some more text. Some text. Some more text. Some text. Some more text. Some text.

Some more text. Some text. Some more text. Some text. Some more text. Some text. Some more text.

Some text. Some more text. Some text. Some more text. Some text.

Some more text. Some text. Some more text. Some text. Some more

text. Some text. Some more text. Some text. Some

more text.

Figure 10.5: The effects of too much and too little text. The top row uses\parshape:

(top left) too little text truncates the shape; (top right) too much text replicates the dimension of the last line of the shape. The bottom row uses\shapepar: (bottom left) too little text shrinks the shape; (bottom right) too much text expands the shape.

(The contents of the static frames were all set to a central vertical alignment.)

11 Step-by-Step Examples

The examples in this section illustrate various aspects ofJpgfdraw.

Dokumen terkait