76 Running Heads & Running Feet (PDF only)

NOTE: We have recently introduced a new method for setting headers and footers in select themes. For more, see our guide chapter on the changes.

Running heads in the PDF are set using the content: string(); function in CSS. The available content strings are:

  • book-title
  • book-subtitle
  • book-author
  • book-publisher
  • book-publisher-city
  • part-number
  • part-title
  • chapter-number
  • section-title (note this is: frontmatter/chapter/backmatter title OR short-chapter-title if such a thing exists)
  • chapter-author
  • chapter-subtitle

You can add arbitrary strings using the string-set CSS function. But, if you use the above strings with Pressbooks, everything should be OK.

You might want to edit how numbers appear as well. To do this you should use:
counter(page)

The CSS where they define running heads & feet should look something like this:

@page chapter:left {
  @top {
    content: string(book-title);
    counter-increment: part;
    text-align: center;
    font-weight:normal;
    font-style: normal;
    font-size: 0.8em;
  }
  @bottom {
    content: counter(page);
    text-align: center;
    font-weight:normal;
    font-style: normal;
  }
}

@page chapter:right {
  @top {
    content: string(section-title);
    text-align: center;
    font-weight:normal;
    font-style: normal;
    font-size: 0.8em;
  }
  @bottom {
    content: counter(page);
    text-align: center;
    font-weight:normal;
    font-style: normal;
  }
}

Note that different kinds of pages can be styled differently, so you might have:

@page frontmatter:right {
  @top {
    content: "";
  }
  @bottom {
    content: counter(page, lower-roman);
    text-align: center;
    font-weight: normal;
    font-style: italic;
    font-size: 0.7em;
  }
}

… which will style front-matter differently than chapters.

The areas on a page that can be styled in this way are:

Headers

@top-left-corner
@top-left
@top or @top-center
@top-right
@top-right-corner

Footers

@bottom-left-corner
@bottom-left
@bottom or @bottom-center
@bottom-right
@bottom-right-corner

For more info, visit the PrinceXML User Guide: Page Headers and Footers.

License

Icon for the Creative Commons Attribution 4.0 International License

Montgomery College Pressbooks Guide Copyright © 2012 by Book Oven Inc. (Pressbooks.com) is licensed under a Creative Commons Attribution 4.0 International License, except where otherwise noted.

Share This Book