previous   A House With NoJDR Binary Format   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 normal size font , 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
    Image news1.png

  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.

    Figure 11.66: Newspaper Example--Setting the Grid
    Image news2.png

  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 grey rectangle displayed on the denoting the typeblock.

    Figure 11.67: Newspaper Example--Setting the Typeblock
    Image news3.png

  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 rectangle tool 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
    Image news4.png

  5. Switch to the select tool , 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
    Image news5.png

  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 rectangle tool , and make two rectangles with opposing corners at: You should now see something like Figure 11.70.

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

  7. Switch to the select tool , 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
    Image news7.png

  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 closed line tool 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
    Image news8.png

  9. Switch to the select tool , 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
    Image news9.png

  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.

    Figure 11.74: Newspaper Example--Added Image
    Image news10.png

  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.

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

  12. Next comes the right hand frame. This is a polygon with a stepped area that goes around the bitmap. Select the closed line tool , 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
    Image news12.png

  13. Switch to the select tool , 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
    Image news13.png

  14. I'm going to add an L-shaped segment between the left and right blocks to clearly delineate them. Switch to the open line tool , 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
    Image news14.png

  15. Switch to the select tool , 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
    Image news15.png

  16. Next comes a horizontal divider to separate the top two columns from the bottom columns (which will be created later). Select the open line tool , and construct a line with end points at: (58pt, 514.75pt) and (536.5pt, 514.75pt) as shown in Figure 11.80.

    Figure 11.80: Newspaper Example--Added Horizontal Divider
    Image news16.png

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

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

  18. Next comes another header frame. Select the rectangle tool , and construct a rectangle with opposing corners at: (58pt, 522pt) and (536.5pt, 551pt) as shown in Figure 11.82.

    Figure 11.82: Newspaper Example--Added Lower Header
    Image news18.png

  19. Switch to the select tool , 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
    Image news19.png

  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 rectangle tool , and construct two rectangles with opposing corners at: as shown in Figure 11.84.

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

  21. Switch to the select tool , 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
    Image news21.png

  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.

    Figure 11.86: Newspaper Example--Added Sheep Bitmap
    Image news22.png

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

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

  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 closed line tool , 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
    Image news24.png

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

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

  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 through LaTeX, e.g.
    pdflatex news
    
    The resulting document is shown in Figure 11.90.

    Figure 11.90: Newspaper Example--Final Document
    Image news25.png

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 NoJDR Binary Format   next