Forum How do I...?

chapter headings (again)

oliof
Hi,
after reading the appropriate threads in the forum, I thought I had figured out how to avoid putting content into the header on chapter start pages.

I generate my pdf file from an html file (generated with docutils). A reduced test case of my css file looks like this:

  @page {
    size: a5 ;
    margin: 2cm 1.5cm 2.5cm ;

    @top-center {
      content: string(heading, first); 
      font-style: italic ;
    }  
  }

  @page chapter{
    @top-center {
     content: none ; 
    }
  }


  h1 { 
    text-align: center ; 
    string-set: heading content() ; 
    page-break-before: right ;
    page: chapter auto ;
}


I still get page headings on the first page of a chapter/h1. What am I doing wrong?

Test files available at http://www.mausdompteur.de/prince-sandbox ; aptly named test.html, test.css and test.pdf. Output generated with 'prince -s test.css -o test.pdf test.html' with prince 6.0rev6 on either Mac OS X Leopard or Ubuntu Hardy/amd64.[/code]
mikeday
From Prince 6.0 rev 6 we have removed the feature whereby two page names could be supplied for the page property and reverted to the behaviour described in the CSS3 Paged Media specification where only one page is specified. We have also added a new property, prince-page-group, for indicating elements whose first page should match the :first page class.

Basically if you change your h1 rule to have "page: chapter" and "prince-page-group: start" then it should work. Sorry for the inconvenience! :)
oliof
Thanks for the very quick answer! Now, the div following an h1 gets pushed to the next page. How do I avoid that?
mikeday
Oops, my mistake, if the h1 and following div are on different named pages then there will be a page break between them. Do you have an element that encloses the entire chapter, such as <div class="chapter">? If so, move the declarations from h1 to this element, and use :first to switch off the header on the first page of the chapter.
oliof
Thanks, that does it for my small test case. Small caveat, because everything down to an h5 is wrapped in a div.section by rst2latex. Doing something like this:

  

@page section:first {
  @top-center { content: none }
}

.section { page: section }

h1,h2 { prince-page-group: start}


will take care that the chapter headings don't randomly vanish on pages with h3,h4,h5 on them.