Home ยป Forum ยป Author Hangout

Forum: Author Hangout

html question

Crumbly Writer ๐Ÿšซ

My story index page (built from my table of contents) shows page numbers (why, I don't know, since the page sizes are relative anyway), but ignoring the TOC it was derived from, the list the front matter (copyright, acknowledgments and "Other Books by the Author" numerically, and continue with the contents of the book, listing chapter 1 as "15" (on the righthand side of the index).

How do I either turn off the page numbering entirely, or if I can't, how can I reset it to show the proper lowercase Roman Numerals for the front matter, while starting the numeric page count at the start of the book? Since I start the reader at the beginning of the story (the first section, rather than the first text page), I'd prefer it show that first page as "1".

Lazeez Jiddan (Webmaster)

@Crumbly Writer

That's not an html question.

Is this for an EPUB? It all depends on how the EPUB is generated.

Replies:   Crumbly Writer
Crumbly Writer ๐Ÿšซ

@Lazeez Jiddan (Webmaster)

Yes, I'm building a ePub (which is generating the errors when I look up the TOC index). Aside from setting up various paragraph and "span" types in styles, I'm not setting up anything in particular. In fact, I reset most things to 'override' the individual settings the reader might have set by default with the following STYLE command:

/* Clear all default settings */
html, body, div, h1, h2, h3, h4, h5, h6, ul, ol, dl, li, dt, dd, p, pre, table, th, td, tr { margin: 0; padding: 0; }

(I set my own margins and paddings for each paragraph type, rather than relying on book or system defaults.)

But my chapter headings look like the following:

< h2>< span align="center">< a name="Ch101">1: A Shocking Surprise< /a>< /span>< /h2>

Lazeez Jiddan (Webmaster)

@Crumbly Writer

But my chapter headings look like the following:

< h2>< span align="center">< a name="Ch101">1: A Shocking Surprise< /a>< /span>< /h2>

Did you write that html code?

1 - Your < span> tag is invalid for xhtml (for EPUBs). Span is an inline tag, can't have alignment, it will be ignored. The alignment style is used for block tags like < div> and < h1>

2 - 'align' property is not allowed in xhtml. You must use something like '< div style="text-align:enter"> < /div>'

3 - 'name' is not allowed for the < a> tag. You use 'id'

so, your line would have to be:

< h2 style="text-align:center">< a id="Ch101">1: A Shocking Surprise< /a>< /h2>

Or you could do like I do and define a class 'c' in your stylesheet

.c{text-align:center}

and your line becomes:

< h2 class="c">< a id="Ch101">1: A Shocking Surprise< /a>< /h2>

Replies:   Crumbly Writer
Crumbly Writer ๐Ÿšซ

@Lazeez Jiddan (Webmaster)

1 - Your < span> tag is invalid for xhtml (for EPUBs). Span is an inline tag, can't have alignment, it will be ignored.

Alas, the "span align='center'" command is an Apple requirement. If it's NOT included, NO line will be centered (text lines follow the paragraph style definitions, but anything with a graphic in it won't). Apparently, Apple devices look for the command before they'll center anything.

It took quite a while before I finally learned that, and I've confirmed it through repeated testing. I can use your < div style>, but I don't know whether Apple will respect that format or not.

Lazeez Jiddan (Webmaster)

@Crumbly Writer

Alas, the "span align='center'" command is an Apple requirement. If it's NOT included, NO line will be centered (text lines follow the paragraph style definitions, but anything with a graphic in it won't). Apparently, Apple devices look for the command before they'll center anything.

I've heard you say that before and I always found it strange. Books (formerly iBooks) uses Webkit as its rendering engine and webkit is very strict with xhtml files.

I created a test EPUB with a centered image at the beginning and tested it in Books, it worked fine and the image was centred properly without the code you're using. It was a < p> with a css class with 'text-align:center'. It's valid xhtml and it worked as expected.

If you wish, I can send you the EPUB and you try it on any Apple device and examine the code.

Switch Blayde ๐Ÿšซ
Updated:

@Crumbly Writer

Alas, the "span align='center'" command is an Apple requirement.

When I created my first ebook, I manually converted my Word doc to XHTML/CSS using a guide I found on the internet for doing that. The guide is many years old and things change, but this is what he said about centering on different devices at the time:

To create foolproof centering we have to double-stitch our approach, to make sure every device understands exactly what it is we're trying to do.

First we will include the following two styles in our file.

p.centered
{
text-indent: 0em;
text-align: center;
}
span.centered
{
text-indent: 0em;
text-align: center;
}

Since both declarations look identical, this might seem redundant, but sadly, some devices, like the iPad, require the < span > tag for centered elements, while others require the more commonly used < p > tag.

To center our text line, we will now wrap it with the proper HTML tags and make it look like this.

< p class="centered" >< span class="centered" >***< /span >< /p >

Lazeez Jiddan (Webmaster)

@Switch Blayde

The guide is many years old and things change, but this is what he said about centering on different devices at the time:

It's possible that the first version of the iPad and its webkit implementation had a bug that caused this, but it's not true anymore. It's been over ten years since that time.

bk69 ๐Ÿšซ
Updated:

@Crumbly Writer

CSS has it's own built-in page counter variable. I'm looking into it in more detail atm...

Apparently, @page{counter-reset:page;} would clear the counter...

Interesting problem. (would be much easier to solve the issue in LaTeX, btw)

Replies:   Crumbly Writer
Crumbly Writer ๐Ÿšซ

@bk69

Apparently, @page{counter-reset:page;} would clear the counter...

That's a start, but I'd like to separate the front matter from the actual story text, which would require a different numbering system. Any clues on how to reset that, in ePub 2 or 3 (I normally default to type 2).?

Replies:   Keet
Keet ๐Ÿšซ

@Crumbly Writer

That's a start, but I'd like to separate the front matter from the actual story text, which would require a different numbering system. Any clues on how to reset that, in ePub 2 or 3 (I normally default to type 2).?

You can use multiple counters in CSS. And each counter can be displayed with it's own style of course.
One thing you can break your head on for a long time: counter-reset for multiple counters MUST be in a single statement. If you use multiple lines ALL counters will remain 0. So:
counter-reset: mycounter1 0;
counter-reset: mycounter2 0;
counter-reset: mycounter3 0;
is wrong. It should be:
counter-reset: mycounter1 0 mycounter2 0 mycounter3 0;

Notice 1: only spaces in between, no other punctuation.
Notice 2: see the '0'? You can initially set a different number which might be useful in your case. (Use a single counter but reset it with a different number and style where you want it.)

Keet ๐Ÿšซ

@Crumbly Writer

You're a little short on important information. Html itself doesn't have page numbers so I assume you are talking about the xhtml in an epub, mainly because you also mention a 'reader'. As far as I know 'page numbers' are 'counted' from the page brakes in your original document. Of course these aren't really pages but skip-points like page jumps in html.
Page numbers depends heavily on the software used to create the epub and the software used to read it might overrule it.
To give an example how random it can be: Adobe Digital Editions creates a fake page number every 1000 characters.
Remember: there are no pages in an epub, only skip points (jumps). Fake page numbers might even shift to a different position if, for example, the font size is changed.

If you are using Calibre for conversions here's a Reddit link where the second post explains a little about the internals of page numbering. It might help you to find the source of the problem and where to make adjustments to fix your numbering.

In Word/Libre Office you can add an extra TOC below the first one. Right click it to edit the properties. Maybe that is enough to get better html after export.

bk69 ๐Ÿšซ

@Keet

Page numbers depends heavily on the software used to create the epub and the software used to read it might overrule it.
To give an example how random it can be: Adobe Digital Editions creates a fake page number every 1000 characters.

I get the impression Crumbly uses CSS directly for a bunch of things. (Or maybe that was Ernest). CSS does support page numbering, and if a page size is defined the text body will be spread over multiple pages based on font face/type/size, and there's a built-in counter. Other divisions than pages can also get counters, such as chapters or sections.
Unfortunately, I found no details on using alternate numbering (the small roman numerals are a problem). Like I said, trivial problem using LaTeX, much more challenging using CSS.

Replies:   Keet  Crumbly Writer
Keet ๐Ÿšซ

@bk69

CSS does support page numbering

No, CSS doesn't support page numbering, it supports counters which you can try to abuse for page numbering.

You can display counters with roman numbers:

content: counter(my-counter, upper-roman);

In fact, you can use any of the list-style-type property values.

Crumbly Writer ๐Ÿšซ

@Keet

You can display counters with roman numbers:

content: counter(my-counter, upper-roman);
In fact, you can use any of the list-style-type property values.

Thanks Keet, I'll try numbering the front matter differently, to set it off, but if I get into trouble, I'll simply reset the counter once the story starts (the end-number is fine if it just continues once the story is complete, it's only the front-matter which confuses things, since the reader has to back up to see any of it).

Replies:   bk69
bk69 ๐Ÿšซ

@Crumbly Writer

You probably want to define a structure for front matter, and have a specific counter there, using lower-roman, then still reset the page counter for the main body of text. (I saw indications CSS2 was supposed to have native support for page numbering - although pages were defined oddly. CSS3 is a little better, but not much for it.)

Crumbly Writer ๐Ÿšซ

@Keet

Keet, I understand how to keep counters in html/ePub, but to make this work, I need to know the specific counter that browsers use to track page numbers based on the number of page breaks.

I don't want to duplicate the page tracking, just reset the existing counter(s).

As far as the @page reset-counter command, where is that established (so it's not interpreted as text)?

Replies:   bk69
bk69 ๐Ÿšซ

@Crumbly Writer

Insert the @page{reset-counter:page;} right before the < h2> bit for your first chapter. Should work. If it doesn't, what does happen? It's a matter of diagnosing what's happening... you change something, and based on what happens, you can have a better idea what's going on.

Crumbly Writer ๐Ÿšซ

@bk69

I get the impression Crumbly uses CSS directly for a bunch of things. (Or maybe that was Ernest).

Aside from his use of colors for a variety of things, Ernest and I tend to code html header/Style definitions similarly.

So, given no specific way to format the front-matter from the rest of the story, I guess it's easy enough to simply restart the page numbering when the story actually starts, so there reader will know where in the story itself they are at, which again, is where the book will open up based on my instructions when generating the Calibre generation.

Crumbly Writer ๐Ÿšซ

@Keet

As far as I know 'page numbers' are 'counted' from the page brakes in your original document.

Nope. Relying on Apple Books for testing purposes, the TOC index lists each page, based on the current size of the Books window (which applies to any book currently open or loaded for my 'library'). If I reset the window for one, it resets the pagination for ALL. So, think of it as a iCloud (user) setting, rather than a device or document setting. Though I do define my H1 and H2 settings to start with a page break to separate one from the next.

I reset and redefine ALL of my paragraph types (after stripping out ALL of the Word generated crapola), and then generate it using whatever the latest version of Calibre is. So, while I define where each page number starts, it would be Calibre which is defining the actual page numbering (though again, I have no idea why, given that it varies on each user's device, so if I could turn it off entirely, that would be fine).

Crumbly Writer ๐Ÿšซ

@Keet

Although I've tested on a variety of different devices, I usually test on Apple Books (since they seem to be the most stringent (aside from Lulu, which every other source sets em utterly impossible standards they don't implement themselves, so the restrictions are essentially meaningless).

Your Reddit link was interesting, but the follow-up was exclusively Kindle-based, whereas I'm going for general usage (I've never noticed Kindle's keeping track of specific page numbers, and only recently noticed Apple Books doing it), but again, the page numbers are for the current window (adjusting for each window, where the 'default' window size is determined by the last-opened Apple Books window (i.e. user settings, not device or author defined).

REP ๐Ÿšซ

I'm not familiar with Calibre

Does it allow you to insert some form of break and insert a new page number definition.

Replies:   Crumbly Writer
Crumbly Writer ๐Ÿšซ
Updated:

@REP

Yeah, here's my default H1 definition, which sets each page break in the document (I code my H2 and H3 similarly):

h1
{
font-size: 3.5em;
page-break-before:always;
text-align:center;
font-weight: bold;
margin-top:2em;
margin-bottom:0em;
}

The "margin-bottom" is because I insert a graphic chapter header on each new page, which is defined separately (with a small padding on the top and bottom).

Switch Blayde ๐Ÿšซ

@Crumbly Writer

You're not going to get worthwhile advice from me on HTML, but I'm confused.

1. What is an index page in an epub?

2. You have 14 pages of front matter? ("listing chapter 1 as 15" means there are 14 pages preceding it).

3. Where do you see page numbers in an ebook?

Replies:   madnige  Crumbly Writer
madnige ๐Ÿšซ

@Switch Blayde

3. Where do you see page numbers in an ebook?

The e-book viewer I use (calibre's own dedicated reader) has the page numbering at top-left; at present mine says 88.3 / 699, and you can overtype or use the spin buttons to change page; doing a page-down takes me to 90.5 / 699. It's useful to have as the location is not preserved over reboots, so I need to remember my page number (and the book too, as I'm in book 15 of a 20+ book series)

Replies:   Switch Blayde
Switch Blayde ๐Ÿšซ

@madnige

(calibre's own dedicated reader) has the page numbering at top-left

Not on my Calibre reader. I have the percent read on the bottom right corner.

I have the ToC on the left side. I didn't want to close it (afraid I would forget how to get it back) but maybe the page number is hidden behind it.

Replies:   Crumbly Writer
Crumbly Writer ๐Ÿšซ

@Switch Blayde

Not on my Calibre reader. I have the percent read on the bottom right corner.

I have the ToC on the left side. I didn't want to close it (afraid I would forget how to get it back) but maybe the page number is hidden behind it.

Nope, I was using Apple's Books app (i.e. not Calibre, since Apple is generally the most stringent of the various device ePubs (if you set it for Apple, it'll generally work for anything else), as Apple has multiple 'Apple' specific formatting standards like centering.

Crumbly Writer ๐Ÿšซ

@Switch Blayde

You're not going to get worthwhile advice from me on HTML, but I'm confused.

1. The 'index' page is the little TOC icon in the upper left corner of the ePub display, which when you click it, displays the Table of Contents, so you can jump to any chapter in the document of your choice.
2. The number of pages dynamically changes based upon fonts and the size of the window at the time, since I have a LOT of acknowledgments and several pages of "Other Books", they need a couple full pages to display.
3. The page numbers are listed in the TOC index (discussed above). I'd never noticed them, so maybe it's a new feature for Apple devices, which is why I was asking how to reset it.

If you email me, I'll send you screen shots so you can see how it looks in RL.

Replies:   Switch Blayde
Switch Blayde ๐Ÿšซ

@Crumbly Writer

I have a LOT of acknowledgments and several pages of "Other Books", they need a couple full pages to display.

Keep in mind KDP's Look Inside and Bookapy's sample displays a percentage of the beginning of your novel. If you fill it up with all that stuff, the potential buyer won't get to sample as much of your novel. They might not even bother scrolling to Chapter 1.

Ernest Bywater ๐Ÿšซ

Just got back on the forum and spotted this. I've not got much to add about what's being discussed except to say:

I remove all page numbers and page counting fields from the word processing file before I convert it to html to clean up and make the e-pub from. The reason I do this is each e-pub viewing program decides on a page size of its own and thus nothing you set will be the same as what they display. And that's before you get into personalized settings for people who want a special font or font size changing how much text is on a page.

The e-pub contents list is created by the software base on the headings and the heading code you've incorporated into the html, so if you use H1, H2, and H3 headings and have the system set to use them, the software will create the contents list and set it up as hotlinks to the headings. That makes the use of page numbers within the e-pub totally irrelevant.

Replies:   Crumbly Writer
Crumbly Writer ๐Ÿšซ

@Ernest Bywater

Ernest, like you, I reset ALL counter and defaults in my ePubs, but apparently the display device keeps track of the current page numbers and adjusts the dynamic TOC. I don't mind the page numbers, which are irrelevant to me, but I want to separate the front-matter from the actual story, especially since th story start on the first page of the story.

Replies:   Ernest Bywater
Ernest Bywater ๐Ÿšซ
Updated:

@Crumbly Writer

Ernest, like you, I reset ALL counter and defaults in my ePubs, but apparently the display device keeps track of the current page numbers and adjusts the dynamic TOC. I don't mind the page numbers, which are irrelevant to me, but I want to separate the front-matter from the actual story, especially since th story start on the first page of the story.

CW, two issues here:

Issue 1:

I'm aware the e-book readers track pages as you read it, but those are the number of pages as assigned by that specific reader with it's current settings. I recently checked thus with 2 e-book readers on my Tablet. Both have a little bar at the bottom that shows how much of the story I've read, and on the end is a number which shows pages read and total of pages in the story. When I adjusted the font from 10 point to 18 point the page numbers jumped up a lot as the system re calculated the number of pages to be displayed using the different font. That's why I totally ignore the page information within the e-book when I create the e-pub.

Issue 2:

Separating the front matter from the story can be done a couple of ways, depending on the results you want. The first question is: Do you want the front matter to be at the front of the book? If no, then move it to the back, all fixed. If yes, then the you need to answer the question: Do you want the reader to see the front matter listed on the contents page? Remember, most e-book contents pages act as hot links and you can skip it by clicking on the relevant contents table entry.

The following is based on my knowledge of how Calibre works with the way I've got it set up for headings.

On the assumption you want the front matter listed in the contents list you should have the first item of the front matter with a H1 heading and the rest of the front matter with H2 heading then the first story chapter is the next H1 heading. This way they will show in the contents listing as nested under the first heading.

On the assumption you do not want the front matter listed in the contents list you give them H2 or H3 headings and the first story chapter is the first H1 headings. That way the contents list will start with the first story chapter.

............

The above works because Calibre does the contents list as a hierachial list starting with H1, thus any H2 or lower headings before the first H1 are ignored.

Also, the format of the Contents list can be reinforced with the Calibre setting of: Preferences - Common Options - Table of Contents - -

That subwindow has a section where you can set the TOC levels and you set Level 1 as / / h : h 1 (spaces to ensure it's not seen as code) and level 2 as / / h : h 2 - - you can set up to 3 levels this way.

edit to add: I believe the contents list creation is the same in most of the e-book creating software and most of the e-book readers handles the contents list in the same way.

Back to Top

 

WARNING! ADULT CONTENT...

Storiesonline is for adult entertainment only. By accessing this site you declare that you are of legal age and that you agree with our Terms of Service and Privacy Policy.


Log In