previous   A House With NoA Lute Rose   next


A Newspaper

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.

  1. 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 .

    news1
    Figure 11.65: Newspaper Example--Setting the LaTeX Normal Font Size

  2. 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.

    news2
    Figure 11.66: Newspaper Example--Setting the Grid

  3. 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.

    news3
    Figure 11.67: Newspaper Example--Setting the Typeblock

  4. 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.

    news4
    Figure 11.68: Newspaper Example--Title Frame

  5. 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.

    news5
    Figure 11.69: Newspaper Example--Assigning Flowframe Data to Title Frame

  6. 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: You should now see something like Figure 11.70.

    news6
    Figure 11.70: Newspaper Example--Left and Right Heading Frames Added

  7. 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.

    news7
    Figure 11.71: Newspaper Example--Assigning Flowframe Data to Left Heading Frame

  8. 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.

    news8
    Figure 11.72: Newspaper Example--Added L Shaped Frame

  9. 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.

    news9
    Figure 11.73: Newspaper Example--Assigning Flowframe Data to L Shaped Frame

  10. 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.

    news10
    Figure 11.74: Newspaper Example--Added Image

  11. 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.

    news11
    Figure 11.75: Newspaper Example--Assigning Flowframe Data to Bitmap

  12. 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.

    news12
    Figure 11.76: Newspaper Example--Added Right Hand Polygon

  13. 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.

    news13
    Figure 11.77: Newspaper Example--Assigning Flowframe Data to Right Hand Polygon

  14. 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.

    news14
    Figure 11.78: Newspaper Example--Added L Shaped Divider

  15. 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.

    news15
    Figure 11.79: Newspaper Example--Assigning Flowframe Data to L Shaped Divider

  16. 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.

    news16
    Figure 11.80: Newspaper Example--Added Horizontal Divider

  17. Switch to the ||, select this line and assign the flowframe data shown in Figure 11.81.

    news17
    Figure 11.81: Newspaper Example--Assigning Flowframe Data to Horizontal Divider

  18. 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.

    news18
    Figure 11.82: Newspaper Example--Added Lower Header

  19. Switch to the ||, select this rectangle, and assign the flowframe data as shown in Figure 11.83.

    news19
    Figure 11.83: Newspaper Example--Assigning Flowframe Data to Lower Header

  20. 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: as shown in Figure 11.84.

    news20
    Figure 11.84: Newspaper Example--Added Lower Left and Right Rectangles

  21. 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.

    news21
    Figure 11.85: Newspaper Example--Assigning Flowframe Data to Lower Left Rectangle

  22. 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.

    news22
    Figure 11.86: Newspaper Example--Added Sheep Bitmap

  23. Assign this bitmap the flowframe data shown in Figure 11.87.

    news23
    Figure 11.87: Newspaper Example--Assigning Flowframe Data to Sheep Bitmap

  24. 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.

    news24
    Figure 11.88: Newspaper Example--Added Polygon Defining Text Region

  25. 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)).

       
     newsparshapea newsparshapeb  
     (a) (b)  
    Figure 11.89: Newspaper Example--computing \parshape parameters: (a) select "Use Path" option; (b) export dialog.

  26. Save the image as newspaper.jdr and then select the File->Export... menu item. Select the flowframe (*.sty) filter, and save as newspaper.sty.

  27. 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.

  28. 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.
    pdflatex news
    
    The resulting document is shown in Figure 11.90.

    news25
    Figure 11.90: Newspaper Example--Final Document

Things to note:



Footnotes

... frame.11.2
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.

previous   A House With NoA Lute Rose   next