This example illustrates how to use Jpgfdraw to create a LaTeX2e
package based on the flowfram package, using non-standard
shaped frames. The aim is to produce the document shown in
Figure 11.90.
In this example, my newspaper is going to be on A4 portrait
paper, with a normal font size of 12, so the first
thing to do is to select the paper size and orientation using
Settings->Paper->A4 and
Settings->Paper->Portrait, and set the value of the
LaTeX ||, using
the TeX/LaTeX->Settings->Set Normal Size... dialog box
(see Figure 11.65). Select 12 from the
.
Figure 11.65: Newspaper Example--Setting the LaTeX Normal Font Size
The 12pt font size has a corresponding \baselineskip
of 14.5pt. For this example, it is more practical to have a grid
that has intervals of this size, as it gives a guide as to how many
lines there will be in each frame.11.2 Therefore I set the grid to have 145pt major divisions with
10 subdivisions. This means that each minor tick mark is at a distance
of 14.5pt (one \baselineskip) from its neighbour. To do this
select Settings->Grid->Grid Settings..., and enter the
values as shown in Figure 11.66.
Figure 11.66: Newspaper Example--Setting the Grid
Next set the typeblock. This nominally defines the paper
margins, although it is possible to define frames outside this
area. I used 58pt margins on all sides. To do this, select
TeX/LaTeX->Flow Frames->Set Typeblock... which will display
the dialog box shown in Figure 11.67. Enter the values
shown and click on Okay or press Enter
to continue. You should now see a pale gray rectangle displayed
on the denoting the typeblock.
Figure 11.67: Newspaper Example--Setting the Typeblock
The newspaper is going to have a static frame along the
top of the typeblock that will contain the title of the paper. This
isn't going to have a border, but we will need to draw a rectangle
to define the frame's bounding box. So select the
|| and draw a
rectangle with opposing corners at (58pt,58pt) and
(536.5pt,145pt). You should now see something like
Figure 11.68.
Figure 11.68: Newspaper Example--Title Frame
Switch to the ||, and
select this rectangle. Select
TeX/LaTeX->Flow Frames->Set Frame... and enter the values
shown in Figure 11.69. Note that the
Border field has been set to
None.
Figure 11.69: Newspaper Example--Assigning Flowframe Data to Title
Frame
Below the title, there will be two columns each with its
own heading. I am going to make separate frames for the headings,
and since the headings will be in a larger font, I shall give their
frames a height of twice the \baselineskip. Select the
||, and make two
rectangles with opposing corners at:
Figure 11.70: Newspaper Example--Left and Right Heading Frames Added
Switch to the ||, and
select the left hand frame, and assign the flowframe data shown in
Figure 11.71. Do the same for the right hand rectangle, but
call it rightheading.
Figure 11.71: Newspaper Example--Assigning Flowframe Data to Left
Heading Frame
The left hand column is going to angle around underneath the
right hand column, as it will have more text in it. Select the
|| and make a
polygon with vertices at (58pt, 203pt), (58pt, 507.5pt), (536.5pt,
507.5pt), (536.5pt, 420.5pt), (290pt, 420.5pt) and (290pt, 203pt) as
shown in Figure 11.72.
Figure 11.72: Newspaper Example--Added L Shaped Frame
Switch to the ||, and
select this L shaped polygon, and assigned the flowframe data
shown in Figure 11.73. Note that the
Alignment field has been set to
Top to ensure that if there is
insufficient text to fill the frame, all blank space will go at the
bottom of the frame, and thus help to keep the frame's shape. I
used Parshape rather than
Shapepar to define the frame's shape
as I don't want it to shrink and grow to fit the text.
Figure 11.73: Newspaper Example--Assigning Flowframe Data to L Shaped
Frame
I'm going to illustrate the story in the right hand column.
The image egg.png is supplied with the flowfram
package but is also available in the examples subdirectory of
Jpgfdraw's installation directory. Use Bitmap->Insert Bitmap...
to insert the bitmap on the . This will initially
appear in the top left hand corner of the . Move it
over to the location shown in Figure 11.74, either by
dragging it or by using Edit->Move By... and specifying
a horizontal (x) displacement of 472.8pt
and a vertical (y) displacement of 206pt.
Figure 11.74: Newspaper Example--Added Image
Set the flowframe data shown in Figure 11.75 to
this bitmap. Note that you must set the
Border setting to
As Shown, otherwise the bitmap
will not appear in the document.
Figure 11.75: Newspaper Example--Assigning Flowframe Data to Bitmap
Next comes the right hand frame. This is a polygon with a
stepped area that goes around the bitmap. Select the
||, and construct a
polygon with vertices at:
(304.5pt, 203pt), (304.5pt, 406pt), (536.5pt, 406pt),
(536.5pt, 290pt), (478.5pt, 290pt), (478.5pt, 261pt),
(464pt, 261pt), (464pt, 232pt), (478.5pt, 232pt)
(478.5pt, 217.5pt), (493pt, 217.5pt) and (493pt, 203pt) as shown in
Figure 11.76.
Figure 11.76: Newspaper Example--Added Right Hand Polygon
Switch to the ||, select
this polygon and assign the flowframe data shown in
Figure 11.77. Note that the
Shape field has been set to
Parshape and the
Alignment field has been set to
Top.
Figure 11.77: Newspaper Example--Assigning Flowframe Data to Right
Hand Polygon
I'm going to add an L-shaped segment between the left and right
blocks to clearly delineate them. Switch to the
||, and construct a
with vertices at: (297.25pt, 159.5pt), (297.25pt,
413.25pt) and (536.5pt, 413.25pt) as shown in Figure 11.78.
Figure 11.78: Newspaper Example--Added L Shaped Divider
Switch to the ||, select
this new path and assign the flowframe data shown in
Figure 11.79. Make sure that you have set the
Border field to
As Shown.
Figure 11.79: Newspaper Example--Assigning Flowframe Data to L Shaped
Divider
Next comes a horizontal divider to separate the top two
columns from the bottom columns (which will be created
later). Select the
||, and construct a line
with end points at: (58pt, 514.75pt) and (536.5pt, 514.75pt) as shown
in Figure 11.80.
Switch to the ||, select
this line and assign the flowframe data shown in
Figure 11.81.
Figure 11.81: Newspaper Example--Assigning Flowframe Data to
Horizontal Divider
Next comes another header frame. Select the
||,
and construct a rectangle with opposing corners at:
(58pt, 522pt) and (536.5pt, 551pt) as shown in Figure 11.82.
Switch to the ||, select
this rectangle, and assign the flowframe data as shown in
Figure 11.83.
Figure 11.83: Newspaper Example--Assigning Flowframe Data to Lower
Header
At the bottom of the page, I want to have two columns,
with the text flowing from the left hand column into the right
hand column. This means that these frames need to be flow frames.
Select the ||, and
construct two rectangles with opposing corners at:
Figure 11.84: Newspaper Example--Added Lower Left and Right
Rectangles
Switch to the ||, select
the left lower rectangle and assign the flowframe data shown in
Figure 11.85. Similarly for the right hand lower rectangle.
Figure 11.85: Newspaper Example--Assigning Flowframe Data to Lower
Left Rectangle
I also want to have an image in the lower left hand frame.
This is going to be slightly more complicated as flow frames
can not be assigned a shape like the static and dynamic frames.
The image I'm going to use is called sheep.png and is
provided with the flowfram package, but it is also
available in the examples subdirectory of Jpgfdraw's
installation directory. Use Bitmap->Insert Bitmap...
to insert this image, and then either drag it with the mouse or use
the Edit->Move By... dialog box to move it by (50pt, 556pt)
to the location shown in Figure 11.86.
Assign this bitmap the flowframe data shown in
Figure 11.87.
Figure 11.87: Newspaper Example--Assigning Flowframe Data to Sheep
Bitmap
As it stands, any text in the left flow frame will overlap
the sheep image, so I'm going to construct a new polygon to go
around the sheep image. This polygon will not form a frame, but
will be used to construct the parameters of the \parshape
command, which can then be input at the start of the flow frame.
To do this, select the ||,
and construct a polygon
with vertices at: (116pt, 565.5pt), (116pt, 580pt), (101.5pt, 580pt),
(101.5pt, 609pt), (58pt, 609pt), (58pt, 783pt), (290pt, 783pt)
and (290pt, 565.5pt) as shown in Figure 11.88.
Figure 11.88: Newspaper Example--Added Polygon Defining Text Region
Select this polygon, and select the
TeX/LaTeX->Parshape... menu item. This will open the dialog box
shown in Figure 11.89(a). Select the
Use Path option and click
Okay. Save to a file named
sheepcutout.tex (Figure 11.89(b)).
Save the image as newspaper.jdr and then select the
File->Export... menu item. Select the
flowframe (*.sty) filter, and save as
newspaper.sty.
Use your favourite text editor to create a file called
news.tex that looks like:
\documentclass[12pt]{article}
\usepackage{newspaper}
% suppress section numbering
\setcounter{secnumdepth}{0}
% set the paragraph indentation for static
% and dynamic frames
\setlength{\sdfparindent}{\parindent}
\begin{document}
\begin{staticcontents*}{title}
\begin{center}
\bfseries\Huge
Fairy Tale Times
\end{center}
\hfill Issue 2. 7 December 2005.
\end{staticcontents*}
\begin{staticcontents*}{leftheading}
\section{Killer Wolf on the Loose}
\end{staticcontents*}
\begin{staticcontents*}{lefttext}
The authorites are warning of a killer wolf on the
% lots of text omitted
\end{staticcontents*}
\begin{staticcontents*}{rightheading}
\section{Tragic Wall Accident}
\end{staticcontents*}
\begin{staticcontents*}{righttext}
An egg person tragically fell from a six foot wall
% lots of text omitted
\end{staticcontents*}
\begin{staticcontents*}{bottomheading}
\section{Relief as Missing Sheep Finally Return Home}
\end{staticcontents*}
% set the paragraph shape
\input{sheepcutout}
% suppress paragraph indentation
\noindent
There was much celebration yesterday morning when
% lots of text omitted
\end{document}
This file is also available in the examples subdirectory
of Jpgfdraw's installation directory.
The included images are PNG files, which means that if you
are not using PDFLaTeX you will have to convert them
to Encapsulated Postscript (EPS) to use LaTeX and
dvips. Run news.tex thru LaTeX, e.g.
Jpgfdraw uses units as its internal unit, and rounding
errors may occur when converting from to bp. This may result
in warnings from the flowfram package about moving to
a flow frame of unequal width. For example, the two flow frames
defined in this example may end up being saved in the style file
as:
The difference between the two frames is less than 1bp, but from
the point of view of the flowfram package, the second
frame is wider than the first, and so warrants a warning. You may
therefore want to edit these two lines to ensure that the two
frames have identical widths.
You may have noticed that I had the page list for all my frames
set to All. Naturally if you
want more pages in your document, you will need to change this.
However on your final page you will need to specify an open ended
range. For example, if you have a 4 page document, then at least
one flow frame defined on page 4 should have a page list like
>3. This is because the flowfram package looks ahead
for the next flow frame before it ships out the page. If there are
no more flow frames defined, it will automatically create a new
flow frame, and you will end up with an unwanted page.
If you use Jpgfdraw to create \parshape'd
paragraphs for your document, you must make sure that the
normal font size setting in Jpgfdraw's
TeX/LaTeX Settings dialog box is the same as that
used by your document, otherwise it
will affect the shape of the paragraph (see Figure 11.91).
Likewise, if your paragraph contains larger or smaller than normal
lines this will also adversely affect the paragraph shape, and you
will need to adjust the shape of the accordingly.
(a)
(b)
Figure 11.91: The
normal font size setting affects paragraph shapes: (a) both
the LaTeX document and Jpgfdraw have been set to use a normal
size font of 12pt--the paragraph follows the correct shape;
(b) the LaTeX document used 12pt as the normal font size,
but Jpgfdraw had the normal font size set to 10pt--the
paragraph has too many narrow lines and spills over the bottom of
the frame.
This is of course only
an approximate guide, as larger or smaller font sizes may be
used in a frame, which will affect the total number of lines in the
frame.