Our Halloween Writing Contest is coming up soon. Start Writing! [ Dismiss ]
Home ยป Forum ยป Author Hangout

Forum: Author Hangout

Centering an e-book page

Switch Blayde ๐Ÿšซ
Updated:

I've noticed at the end of paperbacks I've been reading they have a few chapters of the next book in the series (or maybe an earlier one). In the book I just finished (Kill Shot), it has a page before the preview chapters which has CENTERED ON THE PAGE (centered top and bottom and right and left):

Emily Bestler Books
proudly presents

AMERICAN

ASSASSIN

VINCE FLYNN

Turn the page for a preview of American Assassin,
now a major motion picture

So in my Word document, if I use the paragraph center for what's on that page, it will be centered right and left. But how do I center it on the page (top to bottom)?

I can put in blank lines and hope they won't be thrown out by HTML (like they were here โ€” I had blank lines before "Turn the pageโ€ฆ"), but how do I know how many? Each e-reader device is different, especially since the reader chooses the font size.

Ernest Bywater ๐Ÿšซ
Updated:

Now I prepare my e-books by hand finishing the HTML code used to make the e-pub from. The only way to center a section of text in page both horizontally and vertically would be to have a page break before and after the section of text involved and to create a special blockquote type paragraph style with the relevant V & H commands than place the wanted text within the special paragraph style opening and closing commands while using the BR command for line spacing. I'd have to do some research and testing to see if it actually works.

However, I've found out, the hard way, the only way to get something to be very similar on multiple e-book devices is to set all of the format code in the style sheet and call the style in the html paragraph commands. Even then it doesn't always come out right because not all devices recognise color.

Edit to add: I can't find any code CSS to vertically align on the page that will display right on every device. I can find code to set top and bottom margins which will vary with devices and font sizes, and I can find code to vertically align on the line for superscript and subscript, but that's all.

You also need to keep in mind if what you saw was in a print book then the printer can set that because they know what size page they're using. If it was an e-book you may be better off importing it into Calibre and seeing if it will let you look at the code used.

Vincent Berg ๐Ÿšซ

@Switch Blayde

It largely depends on who's viewing the book. The main issue is with Apple products, as they require a '< span class="center">' command. However, that should only relate to horizontally centering images.

To center it vertically, you'd need to define a style with LOT of space in the "margin-top" and "margin-bottom" fields. But there is no center vertically html command (other than within specific fields (like table definition commands)).

I've also noticed that certain outlets (Smashwords) will NOT center images, no matter how you code them, so the only way I can center images (chapter titles, illustrations or book covers) is to remove ALL size restrictions and then most ebook readers will scale it to fit the particular device.

Switch Blayde ๐Ÿšซ

Thanks, guys.

I guess it doesn't work with e-books (because you don't know the dimensions of a page).

Keet ๐Ÿšซ

You can set a top and/or bottom margin using a css class that you assign to that text part. For ebooks always set the flowable content in %. Using % will make sure it's relative to the page size for the reader but some readers might not accept margin settings. (From what I read ibooks and kindle disregard the @page css margin settings)

css example:
.myvclass { margin-top: 30%; }

html example:
p class="myvclass"
/p
(add the smaller-than and greater-than brackets)

Replies:   Switch Blayde
Switch Blayde ๐Ÿšซ

@Keet

From what I read ibooks and kindle disregard the @page css margin settings)

Since I'm exclusive to Amazon KDP, anything Kindle doesn't like is a no-no.

Thanks.

Vincent Berg ๐Ÿšซ

@Switch Blayde

Since I'm exclusive to Amazon KDP, anything Kindle doesn't like is a no-no.

Kindle does NOT do epubs. I'm guessing you're going to convert it first using Calibre?

Replies:   Switch Blayde
Switch Blayde ๐Ÿšซ

@Vincent Berg

Kindle does NOT do epubs.

KDP accepts epub when I upload to them. It converts it to mobi.

Replies:   Vincent Berg
Vincent Berg ๐Ÿšซ
Updated:

@Switch Blayde

KDP accepts epub when I upload to them. It converts it to mobi.

I've never tried submitting an epub, since standard Style definitions work well (better than any other ebook outlet), but what's killing you in the Calibre interference, not the original epub.

Still, I haven't had any troubles with my Calibre conversions of a epubs (I code them as a continuous document, rather than in distinct chapters, so maybe that makes a difference somehow).

P.S. If you're only publishing to Amazon, then it's probably a waste coding in epub at all, since anything we're suggesting will likely be stripped, but I typically download my epubs in Amazon readers on other devices, and use my prefer non-Amazon epubs on those other devices.

John Demille ๐Ÿšซ

@Switch Blayde

Since I'm exclusive to Amazon KDP, anything Kindle doesn't like is a no-no.

In that case, none of our suggestions matter. In Word, enter a page break, a few blank lines, your text then a page break.

Logically, that should work. But again, if it usually did we wouldn't be having this thread.

Replies:   Switch Blayde
Switch Blayde ๐Ÿšซ

@John Demille

In Word, enter a page break

I don't use page breaks. Anything that I would want a page break for, that is to show in the table of contents with a direct link to it, I define the heading of that "page" as "Heading 1" in Word. Most times it's the name of the chapter, but I also have a title page with copyright info, etc.

So for this preview at the end of the novel (if I choose to do it), I'll have something like "PREVIEW" at the top defined at "Heading 1" and with a before-margin as Ernest suggested.

Speaking of ToC, it will look weird. There will be two Chapter 1's. The real one and the one after the PREVIEW.

Maybe it's not worth it. I can list the novel titles in the title page and the reader could then use Amazon's Look Inside to preview it. But how many people will even read the title page? And when they're done with the novel, if they like it they won't go back to the title page. They'll do an Amazon search on my name.

I just thought if they really like the novel and they come upon the preview section, they might keep reading. And if they get hooked, then they'll go look for the novel.

John Demille ๐Ÿšซ

@Switch Blayde

I don't use page breaks.

You won't use one for the file in question even temporarily and even if it works for your purpose?

Before you open the file in Calibre, duplicate it, open the duplicate in Word, add the page break, then you won't have a page break in your original file.

Replies:   Switch Blayde
Switch Blayde ๐Ÿšซ

@John Demille

even if it works for your purpose?

I don't think the page break will do anything. It may even add a blank page.

Using "Heading 1" for the chapter names causes the ebook to start the chapter on a new page (and appear in the ToC). So why do I need a page break? I'm getting a new page by using "Heading 1."

Replies:   helmut_meukel
helmut_meukel ๐Ÿšซ

@Switch Blayde

Using "Heading 1" for the chapter names causes the ebook to start the chapter on a new page (and appear in the ToC). So why do I need a page break? I'm getting a new page by using "Heading 1."

John Demille showed you the HTML code to get your text centered on a page (and only this text!). To ensure there comes nothing else on this page which would ruin the vertical centering, you need page breaks above and below. (Using "Heading 1" for any part of the text you want centered will not work as expexted)

John's HTML code creates a table with only one cell and your text goes into this cell. Tables can be centered both vertically and horicontally.

Now you say you don't code in HTML so try the same solution in word: create a table with only one cell, put your text into this cell and format the text. Then add page breaks before and after the table and format it โ€“ no lines around the cell โ€“ and center the table on the page.
I don't know if Word will allow a vertical centering of the table. If not you could always tweak the HTML code created by Calibre by adding a
vertical-align:middle;

Just try it.

HM.

Replies:   Vincent Berg
Vincent Berg ๐Ÿšซ

@helmut_meukel

Now you say you don't code in HTML so try the same solution in word: create a table with only one cell, put your text into this cell and format the text. Then add page breaks before and after the table and format it โ€“ no lines around the cell โ€“ and center the table on the page.

I was trying to help someone who'd custom built their document, doing as you're suggesting, using tables to space their title page and TOC. Their 'invisible' table had over 4,000 empty entries, so yeah, it takes time to process each empty cell, and for what? You could do the entire thing with a single < p class=""> command!

Replies:   helmut_meukel
helmut_meukel ๐Ÿšซ

@Vincent Berg

I was trying to help someone who'd custom built their document, doing as you're suggesting, using tables to space their title page and TOC. Their 'invisible' table had over 4,000 empty entries, so yeah, it takes time to process each empty cell, and for what? You could do the entire thing with a single < p class=""> command!

There is a difference, I suggested using a table with only one cell not with hundreds of most empty cells, therefore no overhead in processing time. All the text you want displayed goes into this single cell and is formated there as usual.
The table is used to vertically align (center) your text on one page.

HM.

Replies:   Vincent Berg
Vincent Berg ๐Ÿšซ

@helmut_meukel

The table is used to vertically align (center) your text on one page.

Now that sounds useful, and as I said, while you can't vertically align text, you can vertically align cells (I do it all the time on my page headers where I include the cover of my books and links to each of my different stories).

But since I don't often code cells, I 'lifted' and modified most of the code from other sites that were already doing most of what I wanted.

Vincent Berg ๐Ÿšซ

@Switch Blayde

Maybe it's not worth it. I can list the novel titles in the title page and the reader could then use Amazon's Look Inside to preview it. But how many people will even read the title page? And when they're done with the novel, if they like it they won't go back to the title page. They'll do an Amazon search on my name.

I've been doing what you suggest for years, but rather than trying to force it onto a separate page, I simply center an image (usually of the cover with a link, with an active text link with the name of the story. It's hard to miss, and it really doesn't matter where on the page it is.

It looks great, it showcases your cover art, and clicking the image works, though most people/readers are simply more comfortable clicking the name of the book (or they'll simply search for the name on Amazon, since they don't TRUST html links in this age of spam).

The last thing you want is something that looks great on YOUR device, but looks like crap on any OTHER device! :(

Replies:   Switch Blayde
Switch Blayde ๐Ÿšซ

@Vincent Berg

but rather than trying to force it onto a separate page, I simply center an image

That's because you code the HTML. I need to do that in Word and don't know how to include an image.

Switch Blayde ๐Ÿšซ
Updated:

@Switch Blayde

I need to do that in Word and don't know how to include an image.

Ok, I googled it and now know how to insert a picture in Word.

But will Calibre handle it?

ETA: Just read some articles on images and Calibre. One had the image in a table. The other was from Calibre.

Both had techniques for using the Calibre editor to make it work. If I do that, that means every time I change the novel and upload it I'd have to remember to tweak the HTML using the Calibre editor.

Too much work. Too risky.

I don't need it centered vertically. If I do it, I'll play with line spacing. I like the suggestion of "space before." My current chapter headings (Heading 1) have "24 pt spacing before" and works fine. Although I like the idea of the cover image, it's not worth it.

Ernest Bywater ๐Ÿšซ

@Switch Blayde

But will Calibre handle it?

Switch,

When I first started using Calibre I was creating epubs from the ODT file, and sometimes a MOBI file for someone. How I handled the images within the story of the file was to use the Libre Office Insert Image process and center the image horizontally, then drag the image size out or in to fit the page. In general Calibre handled the image without any problems.

However, I did find in the early versions of Calibre if I had multiple images the first one got eaten unless I inserted the cover image in front of the title page. I don't know if that is still a problem because I now make the epubs from HTML code using the standard html img src code instructions. I've found switching from creating epubs from word processor files to creating from html files with a comprehensive css has reduced the final epub file to about 25% to 30% of what it used to be.

In general I add the cover image to the epub and mobi files in the convert page of calibre and not the document. It has a process where you can select and image to add as the cover.

Switch Blayde ๐Ÿšซ

@Ernest Bywater

use the Libre Office Insert Image process

Yeah, Word has an "insert picture." One article I read said everything looked good, but with one format or device (I forget which) the image came out as a black box.

I'm not going to use the cover image. In the two novels I recently read, one had the image and the other only had words (the one I referenced when I started this thread).

Replies:   Vincent Berg
Vincent Berg ๐Ÿšซ

@Switch Blayde

I'm not going to use the cover image. In the two novels I recently read, one had the image and the other only had words (the one I referenced when I started this thread).

Your biggest issue with listing you next book isn't the image, it's simply that most users will NOT click an active link, because they're too paranoid about bogus sites taking control of their browsers. Thus, when I do include a cover iamge (within the book) with an active linke (which rarely gets used), I'll also include a text based link which isn't as scary, for some reason).

By using both, you get the polished look the actual cover provides (in reduced resolution and size) while also having the text link and the name of the book for those who prefer typing it themselves in an Amazon search box.

Vincent Berg ๐Ÿšซ

@Ernest Bywater

However, I did find in the early versions of Calibre if I had multiple images the first one got eaten unless I inserted the cover image in front of the title page.

To get around that limitation, simply include the cover in the "Edit metadata" tab. Since that's separate from the rest of the book, it won't interfere with the other images.

Vincent Berg ๐Ÿšซ

@Switch Blayde

But will Calibre handle it?

Yeah, they do, but as usual, as a prior system developer, I've especially persnickety about how I do it. You don't need to go to that much work. My normal Word documents display on Apple devices without any manipulation, so the default commands will even work with Apple products (the most persnickety, since they require the < span class="Center"> command).

That's only one way to do it, and it assumes that you're a gear head (since they generally prefer coding tables rather than dealing with text and/or images). I use Word to create books all the time, and they've always worked (although, again, some self-publishing sites have trouble left formatting images, which is why I code my own epubs, which do). But if you don't use SW's, it's really not an issue.

Vincent Berg ๐Ÿšซ

@Switch Blayde

That's because you code the HTML. I need to do that in Word and don't know how to include an image.

I do that all the time. It's simple.

Simply select the "Insert" tab and click on "Picture". It'll open a file viewer where you select the file. I use a "Centered" style (so all my images are handled the same way) so the centering is automatic, and then I add links (to access the book's sales page and click the image and right click "Format Picture" and then choose the "Alt Text" tab to add descriptions of the image for the visually handicapped. (The last isn't necessary, but it's a nice touch and doesn't take very long as long as you remember to do it.)

Since the Style Definitions are used by Word to create the book, they'll also transferred, whether you submit the Word file to Amazon or when you use Calibre (they'll center horizontally, but not vertically).

If you want to include page breaks, once you've done that, I'll help you set up the necessary Style definitions to get it to work.

Replies:   Switch Blayde
Switch Blayde ๐Ÿšซ

@Vincent Berg

If you want to include page breaks

Thanks. Good info.

I use Header 1 which forces a page break.

Replies:   Vincent Berg
Vincent Berg ๐Ÿšซ

@Switch Blayde

Thanks. Good info.

I use Header 1 which forces a page break.

And that's fine. As I mentioned, Word automatically includes the page breaks for you. Though I also use Header 2 and sometimes Header 3s (since I use Sections (of multiple chapters) in my books, so I often have to specify where the breaks go, since Ernest, who uses a different kind of section, doesn't want page breaks there).

Keet ๐Ÿšซ

@Switch Blayde

Since I'm exclusive to Amazon KDP, anything Kindle doesn't like is a no-no.

Thanks.

The @page is a general page class for every page. That doesn't mean that the example I gave doesn't work, my example uses a user defined class, not the page. The page remark was just a warning for those who do use @page for setting margins.
You have to try my example, it should work.

John Demille ๐Ÿšซ
Updated:

@Switch Blayde

Try this:

< div style="display:table;

page-break-before:always;

page-break-after:always;

height:500px;

margin:auto;

width:100%">

< div style="display:table-cell;

vertical-align:middle;

text-align:center;">

Text

< /div>

< /div>

The trick is to figure out how high a page on a reader is in pixels. Of course remove the spaces after the opening < .

Ernest Bywater ๐Ÿšซ

@John Demille

John, when I've stopped using div commands (and a lot of other general html commands) for e-pubs because they don't translate across well. Are you sure this will convert from html to the xhtml used by the e-books?

Replies:   John Demille
John Demille ๐Ÿšซ

@Ernest Bywater

John, when I've stopped using div commands (and a lot of other general html commands) for e-pubs because they don't translate across well. Are you sure this will convert from html to the xhtml used by the e-books?

< div> is a valid xhtml element. The styling is valid for xhtml as well. In theory, it should work. To be clear, I have never tried them in an EPUB as I've never really created my own.

The 'page-break-before' and 'page-break-after' are specifically used by devices that paginate, like printers and e-readers. On a normal web page they have no effect as there are no 'pages' in a web page.

Div is a blank text element with no styling of its own. It inherits all the enclosing element's properties. So in a body, it would take on the style of the body. So if you want it to do something, you'll have to style it exactly as you want it to look, every little detail.

Replies:   Vincent Berg
Vincent Berg ๐Ÿšซ

@John Demille

The 'page-break-before' and 'page-break-after' are specifically used by devices that paginate, like printers and e-readers. On a normal web page they have no effect as there are no 'pages' in a web page.

They most definitely have an effect in an epub. With webpages, though frequently you just scroll down and pagination really doesn't make any difference. With epubs, you either click the right or left hand margin to advance or back up a page, or 'flip' it with a thumb or forefinger (for smartphones or tablets).

As far as blank lines, you need to be careful. Sometimes they work, but sometimes they don't. Plus, epubs use a variant which webpage html doesn't (< br /> instead of < br>), but you're better off using < &nbsp;> between open and closing paragraph tags. But again, if you use styles, you simply define a style which factors in those various sizes.

And rather than using cm or points, I now use relative font spacings. So .5em; is half a font character, 2em; is two lines, and 5em; is five lines, at whatever size font the user selects.

When you're dealing with such widely different devices, worrying about a couple points is essentially meaningless, while referring to font spaces is meaningful, regardless of which font a particular device or user selects.

Switch Blayde ๐Ÿšซ

@John Demille

I guess I wasn't clear. I'm not coding the XHTML/CSS. I feed a Word docx file into Calibre. It outputs an epub. I upload that to Amazon KDP. I was talking about what to do in my Word doc for Calibre to do it's thing.

I realized there really isn't a page in HTML. Right? On a webpage, there's the scroll bar. It just goes on and on. The e-reader creates a virtual page from, I guess, knowing the dimensions of the device.

I'm thinking I could use the left/right centering in Word and then add a few blank lines where I want them. I won't be centered top to bottom, but it'll probably be okay. It all depends on Calibre. It needs to maintain the integrity of the blank lines.

Replies:   Vincent Berg
Vincent Berg ๐Ÿšซ

@Switch Blayde

I'm thinking I could use the left/right centering in Word and then add a few blank lines where I want them. I won't be centered top to bottom, but it'll probably be okay. It all depends on Calibre. It needs to maintain the integrity of the blank lines.

Text is more clear cut. But you should assign a paragraph class, rather than using < align=center> because Amazon doesn't always do what you think it will (it trims margins and indents).

You define a class as follows:

p.Center
{
text-indent: 0em;
text-align:center;
margin-top:0.5em;
margin-bottom: 0em;
}

and the use < p class=Center>whatever you want the line to say. Though again, if you're including a cover image, you'll have to include the < span class=center> command within the p command.

Instead of blank lines, just add a couple em's (font character space) to the margin-top and margin-bottom statements in your Style Defs.

Ernest Bywater ๐Ÿšซ

For setting it in Word the best I can think of is to use the paragraph format commands to set the space above and below the paragraph along with a page break before and after the relevant text and then see how that comes out. Depending on how many lines of text you can use 3 paragraph styles, one for the top line, another for the middle lines, and a third for the bottom line with the first having a large space before the paragraph and the third having a large space after the paragraph. I've no idea how it'll convert.

Replies:   Ernest Bywater
Ernest Bywater ๐Ÿšซ

@Ernest Bywater

Word the best I can think of is to use the paragraph format commands to set the space above and below the paragraph

I just created a page in Libre Office with the top line having a 5 cm space Above the paragraph, then the middle lines with normal paragraph settings and the bottom line had a paragraph setting of 5cm below the paragraph. Saved it then converted to a MOBI in Calibre and the MOBI file had the text in the center of the page, however the e-pub file did not. So I'm not sure how successful this would be, but it seems to work for the MOBI conversion.

Vincent Berg ๐Ÿšซ
Updated:

@Ernest Bywater

So I'm not sure how successful this would be, but it seems to work for the MOBI conversion.

That's why I questions using Calibre, as they default to Amazon's 'standards' (i.e. their one character indents and trashing normal indents). Every time I use Calibre now, I go through and manually reset ALL the margins. Amazon will still force the margins on their devices, but I REFUSE to allow Amazon to fuck up the formatting on every other device!

But I've been using those commands for a LONG time, and they work perfectly in ebooks and normally work as Style Defs even when submitting to Kindle KDP (sans Calibre pre-conversions).

Replies:   Switch Blayde
Switch Blayde ๐Ÿšซ

@Vincent Berg

(i.e. their one character indents and trashing normal indents).

You keep saying that, but it's not true. I feed a docx file into Calibre with all but the first paragraph indented. Then I upload the epub output from Calibre to Amazon KDP. It converts it to mobi with the proper indenting.

Look at the "Look Inside" for my novel Steele Justice.
https://www.amazon.com/dp/B078VQXHNJ

Switch Blayde ๐Ÿšซ

@Ernest Bywater

I just created a page in Libre Office with the top line having a 5 cm space Above the paragraph

Yeah, that might work. I do that for the spacing around the chapter titles.

Thanks.

Ernest Bywater ๐Ÿšซ

OK People, calm down. A few things to keep in mind about this thread are:

1. Switch does not write in html code so any html code answer is a non-starter for him. Thus there's no point in giving him help in the coding.

2. While preparing a proper document the use of page breaks is good. However, Switch has said he writes his stories in a single over long page, thus introducing page breaks will be of no benefit to him.

3. Switch converts from the text document to his e-book using Calibre. Most e-book formats ignore the word processing page break commands and insert their own where the software tells them to for the designated Headings are as chapter titles. While Switch states he uses Heading 1 and only Heading 1 the Calibre software will automatically insert an appropriate page break code into the e-book prior to the paragraphs designated as Heading 1.

4. Switch has already said he has his answer, so there's no point in offering more suggestions.

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

FYI Switch,
Having made point 4 above I will violate that and say: If you want to know how to have Calibre treat later Heading levels like Heading 2 etc the same as Heading 1 let me know in a Direct Mail and I'll tell you. That way you can use different paragraph setting for different Headings.

Replies:   Switch Blayde
Switch Blayde ๐Ÿšซ

@Ernest Bywater

Calibre software will automatically insert an appropriate page break code into the e-book prior to the paragraphs designated as Heading 1.

That's what I thought and why I thought I didn't need a page break, and if I had a page break I might end up with a blank page.

Back to Top

Close
 

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.