Forum How do I...?

Using @page :first, :left, and :right (conflict?)

jbzech
I'm still new to some of this, so it's possible I'm making a bone-headed mistake here, but how does CSS resolve the conflict when you use all three?

@page :first
@page :right
@page :left

I'm formatting a section of a book in which I want it to open recto, and I want the first page to have no headers footers but the rest of the pages should have headers/footers. But the first page always picks up the header/footer instructions for a right page. Is this a conflict the CSS doesn't handle well or am I doing something wrong?

div.preface {
    page-break-before: right;
    page: preface;
}

@page preface :first {
    margin-left:1in;
    @top-right {content: normal;}
    @bottom-center { content: normal; }
}

@page preface :left {
    margin-right:1in;
    @top-left {content: string(preface-header, first);}
    @bottom-center { 
        content: counter(page, lower-roman);
        margin-right:1in;}
}

@page preface :right {
    margin-left:1in;
    @top-right {content: string(preface-header, first);}
    @bottom-center { 
        content: counter(page, lower-roman);
        margin-left:1in;}
}


Any help is appreciated!
dauwhe
Without trying it, I see two things:

[1] after page: preface; you should add prince-page-group: start;

this tells Prince to use the :first selector on the first page.

[2] Not sure if the extra spaces before :first etc. are causing a problem--I always do

preface:first

Dave
jim_albright
Don't loose hope. It does work. I used a named book_start page in this situation.

@page {
marks: crop cross ;
size: 5.25in 8.25in portrait;
font: 9pt Gentium, Georgia, serif;
line-height: 11pt;
margin: 36pt 36pt 35pt 36pt;


}/* end page */

@page book_start:first {
/* override default page setting so there is no content */
@top-left {
content: normal;
}
@top-right {
content: normal;
}
@bottom-center {
content: counter(page);
}
@right {
content: normal;
}
}/* end book_start:first */
@page:left {
@top-left {
/* make sure you change punctuation mark for chapter-verse separator

: for English/Indonesian and some Spanish
. for French/Portuguese and some Spanish
, for German/Dutch

*/
content: string(stringBookName, start) " " string(stringStartChapterNumber, start) ":" string(stringStartVerseNumber, start) ;
}
@top-right { content: counter(page);
}
}/* end page left*/

@page:right {

@top-right {
/* make sure you change punctuation mark for chapter-verse separator

: for English/Indonesian and some Spanish
. for French/Portuguese and some Spanish
, for German/Dutch

*/
content: string(stringBookName, last) " " string(stringChapterNumber, last) ":" string(stringVerseNumber, last) ;
}
@top-left {
content: counter(page);
}

}/* end page right */


div.Scripture_Book {
page: book_start;
columns:1;
}

Jim Albright
Wycliffe Bible Translators

jbzech
Thank you, Dave. Your suggestion worked. I simply needed the prince-page-group: start; property, which I didn't know about.

For anyone else looking: this code did it.

div.preface {
    page-break-before: right;
    page: preface;
    prince-page-group: start;
}

@page preface :first {
    margin-left:1in;
    @top-right {content: normal;}
    @bottom-center { content: normal; }
}

@page preface :left {
    margin-right:1in;
    @top-left {content: string(preface-header, first);}
    @bottom-center { 
        content: counter(page, lower-roman);
        margin-right:1in;}
}

@page preface :right {
    margin-left:1in;
    @top-right {content: string(preface-header, first);}
    @bottom-center { 
        content: counter(page, lower-roman);
        margin-left:1in;}
}
jbzech
Thank you for the sample, Jim. Being completely new to Prince, I'm finding that lacking any real thorough documentation, trial-and-error is my friend. I'll definitely look at your sample code and see how it works for me.

I'm really impressed with Prince so far, and I'm just trying to figure out how to do the fine-tuning work.

Jason
jim_albright
Glad to send you more samples by email if you want. I have worked on dictionaries and Scripture. Right now I am formatting the NIV 2011 from an XHTML file. Making good progress. The one big thing lacking is inline footnotes but they are on the todo list. I have some requests (also in the todo list) for right-to-left scripts but that is pretty far out for most people.

The real thing to learn is CSS. There are web site to help with that. Make sure you understand the box model. That will help with margins and padding.

Jim Albright
Wycliffe Bible Translators