PPGEN Informal Coding Samples
Here are some informal samples of ways you can code PPGEN to do specific tasks.
You can send me additional files (or let me know if there are any issues with this page) at dp-genmgr @ pgdp dot net. (Source: BarryAbrahamsen)
Another resource you may find useful is PPGEN Source Files for Posted Projects.
- Colouring text - There are multiple ways in PPGEN, and CSS, to color text. It's not usual to find words in color in the books but it is good to know how it might be done. (Source: BarryAbrahamsen)
- Creating Boxes Around Text -
You can control the size and color of each of the attributes of a CSS box (margin, border, and
padding. (Source: BarryAbrahamsen)
- Using Font-Family in CSS - There are a few ways to use CSS to select a typeface: attach CSS to an HTML tag (h1, li, body, etc.), attach CSS to a span, or attach CSS to a .dv. (Source: BarryAbrahamsen)
- Image Align - Using the "align" option of the .il command, you can have PPGEN
format a less-than-page-width image to the left or right of the page, instead of the default centering. Text will flow around the images. (Source: BarryAbrahamsen)
- Inline Macros
Using the .if command in a macro could
be useful. (Source: BarryAbrahamsen)
- Using "span" for highlighting -
This is useful for highlighting foreign phrases in a long text.
- Tables -
These are some sample table layouts with examples of specifying table headings,
alignment for individual cells, types of borders, using <span> and text wrapping
within a cell. (Source: BarryAbrahamsen)
- Floating Text -
This demonstrates text boxes and modification of standard
HTML tags. (Source: BarryAbrahamsen)
- Gesperrt - Doing gesperrt from ppgen is not exactly straightforward, but once a few things are defined, it's no more difficult than any other in-line macro. The mark-up looks like this. The city of <pm gs 6 Chicago> is known as the "Windy City". Where there's a macro named "gs" that takes two parameters, $1, the spacing in pixels between letters, and $2, the word or string (in quotes) that will be spaced. The only complication is that PPGEN will pass through any HTML tags it doesn't recognize to the UTF-8 file as well as the HTML. The macro has .if statements to deal with that. PPGEN does use the tag <g> and for character spacing. When I tried using <g> on a title page with a lot of mark-up there were phrases that had character spacing that were italicized as well. That produced an unattractive mass of underscores in the UTF-8 version. I like my, more-complicated, solution because it gives more control over the actual spacing and doesn't pass the <g> markup as underlines for the text version