Forum How do I...?

How to use named page type without causing page break after?

hsivonen
How can I use a named page type without causing a page break after the element with which the named page type is associated?

Use case:
I start each chapter with an h2 element. I don't have wrapper elements for chapters (that is, there's no div.chapter). On a normal right page, I want the page number at top right and the name of the name of the chapter at top left. On a normal left page, I want the page number a top left and the name of the work at top right. However, on pages that contain a chapter heading, I want to suppress all top text and instead put the page number at bottom center.

My relevant style rules look like this:
h2 {
counter-increment: chapter;
string-set: header "Chapter " counter(chapter) ". " content();
page-break-before: always;
page: chapterstart;
}

@page {
size: A4;
margin: 4.15cm 2.7cm 4.5cm 2.7cm;
counter-increment: page;
font-family: Palatino, serif;
font-size: 12pt;
}
@page:left {
margin-left: 3.9cm;
@top-right {
content: string(title, first);
vertical-align: bottom;
padding-bottom: 18pt;
text-transform: uppercase;
font-style: italic;
text-align: right;
}
@top-left {
content: counter(page);
vertical-align: bottom;
padding-bottom: 18pt;
text-align: left;
}
}
@page:right {
margin-right: 3.9cm;
@top-left {
content: string(header, first);
vertical-align: bottom;
padding-bottom: 18pt;
text-transform: uppercase;
font-style: italic;
text-align: left;
}
@top-right {
content: counter(page);
vertical-align: bottom;
padding-bottom: 18pt;
text-align: right;
}
}
@page chapterstart {
@top-right {
content: none;
vertical-align: bottom;
padding-bottom: 18pt;
text-align: right;
}
@top-left {
content: none;
vertical-align: bottom;
padding-bottom: 18pt;
text-transform: uppercase;
font-style: italic;
text-align: left;
}
@bottom-center {
content: counter(page);
text-align: center;
vertical-align: top;
padding-top: 2em;
}
}


The problem is that there's a page break after h2 leaving the chapter heading alone on the page.

I am using Prince 6.0 (alpha 2006-11-10).
mikeday
Specify "page: chapterstart auto", which will make subsequent pages go back to the regular (auto) page style without inducing a page break.
hsivonen
Thank you. Works as needed.