Chapter title page

Text styles and formatting for chapter title pages

Display graphics for chapter title page

The stylesheet p7-chaptertitlepage.xsl has all features and instructions to set up text styles for all chapter title pages—that is, the first page of each chapter, which contains the chapter title, table of contents and chapter summary. The chapter title page details that can be set in the stylesheet are:

XML markup to edit

Chapter title pages are marked up using the <chapter> element, which is nested immediately inside the <book> element. Inside the <chapter> element you can optionally add an <info> element—this can contain chapter author names, and an <abstract> element for a chapter summary box.

Change section levels in chapter TOC. You can change the number of section levels displayed in the table of contents for a chapter page at stylesheet feature p7-370. You must use <sect1>, <sect2> etc. tags for all section headings in XML files (not <section> tags).

Positioning background image in an abstract. Cop-e-boox lets you add a background image to the chapter summary box. A chapter summary box is marked up using the <abstract> element:
<chapter> <info> <abstract>Text in chapter summary... </abstract>
Immediately inside an <abstract> element, you can add a processing instruction that specifies an image that will appear in the background of the chapter summary. This works for PDF books only. The processing instruction specifies:
  • name of the image (directory and file name)
  • width
  • vertical and horizontal position.
An example processing instruction is:
<?dbfo bgimage="images/background1.gif" bgwidth="170mm" bgposition="left 10px top 20px"?>

At the beginning of the processing instruction, the letters dbfo mean that the background image will appear only in a PDF (not in an EPUB or web ebook). The attribute bgimage contains the directory name (images) and the name of the image (background1.gif). The attribute bgwidth specifies the width of the image in the PDF in any units of measurement. You can increase the bgwidth if you want to scale the image proportionately larger than its original size, or decrease bgwidth to scale it smaller.

The attribute bgposition specifies the horizontal and vertical position of the image. This attribute is based on the CSS3 (cascading stylesheets) property background-position. For general reference, the values you can use in this attribute are outlined with examples at http://www.w3.org/TR/css3-background/#the-background-position.

For the following example of how to specify the background positioning of an image in a chapter summary box, pixel values are used. There are two values in the bgposition attribute—the first value with a measurement is the horizontal (x-axis) position and the second value is the vertical (y-axis) position. In the above example, the first value is left 10px, which will position the image 10 pixels from the left margin of the summary box—that is, shift the image to the right by 10 pixels. The second value is top 20px, which will position the image 20 pixels from the top margin—that is, shift the image down by 20 pixels. Negative values are also allowed. The following diagram shows how a background image is shifted relative to the margins of the chapter summary box.

How a background image is positioned in a chapter summary box by specifying the left and top margins in a processing instruction for the abstract element

Stylesheet settings to edit

The relevant Stylesheet Guide page to set up chapter title pages is PDF-chaptitlepage.svg.