Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Calibre > Editor

Notices

Reply
 
Thread Tools Search this Thread
Old 09-12-2014, 04:06 PM   #16
Arkadian
Connoisseur
Arkadian began at the beginning.
 
Posts: 96
Karma: 10
Join Date: Mar 2014
Device: none
Quote:
Originally Posted by BetterRed View Post
Do the CSS styles used for the header have something like

Code:
.block_ {
    display: block;
    page-break-inside: avoid;  /* IS THIS PRESENT IN THE STYLE USED FOR HEADER */
    text-align: justify;
    text-indent: 14.2pt;
    padding: 0;
    margin: 0 0 6pt
    }
BR
Hi there,

have just tried, but alas id didn't work. What it did do, was to stop the headlines to be split between two pages, so, that's something, but I still have "textless" headings.
Arkadian is offline   Reply With Quote
Old 09-12-2014, 05:01 PM   #17
Arkadian
Connoisseur
Arkadian began at the beginning.
 
Posts: 96
Karma: 10
Join Date: Mar 2014
Device: none
I have added also

page-break-after: avoid;

but no joy

If that wasn't enough, I have created a new style attached to the first paragraph after a heading with
page-break-before: avoid;
but that didn't work either.

I wonder if something like widow/orphan would work, but couldn't find an example of how they work in this context. any ideas/advice/suggestions?

TIA
Arkadian is offline   Reply With Quote
Old 09-12-2014, 05:09 PM   #18
arspr
Dead account. Bye
arspr ought to be getting tired of karma fortunes by now.arspr ought to be getting tired of karma fortunes by now.arspr ought to be getting tired of karma fortunes by now.arspr ought to be getting tired of karma fortunes by now.arspr ought to be getting tired of karma fortunes by now.arspr ought to be getting tired of karma fortunes by now.arspr ought to be getting tired of karma fortunes by now.arspr ought to be getting tired of karma fortunes by now.arspr ought to be getting tired of karma fortunes by now.arspr ought to be getting tired of karma fortunes by now.arspr ought to be getting tired of karma fortunes by now.
 
Posts: 587
Karma: 668244
Join Date: Mar 2011
Device: none
I'm no expert but I think the correct CSS is page-break-after: avoid over the heading title.

I mean if you have:

Code:
<h2 class="title">My heading</h2>
<p>The paragraph I want to keep in the same page than "My title".</p>
You have to put something like:

Code:
.title {
  ... ;
  ... whatever other settings it already has... ;
  ... ;
  page-break-after: avoid;
}
(Although take in mind that this setting does not always work. As a really frustrating evidence, Kobo ACCESS renderer completely ignores it, so there's no way to keep the titles and their following paragraph in Kobo kepubs).

And take in mind that .block_ doesn't match ANYTHING. You must type it complete (.block_17 or whatever)
arspr is offline   Reply With Quote
Old 09-12-2014, 05:15 PM   #19
Arkadian
Connoisseur
Arkadian began at the beginning.
 
Posts: 96
Karma: 10
Join Date: Mar 2014
Device: none
Hi arspr,

"block_" is just a short hand version of "block_some-number", so no problem there.

At the moment this is the style for h2:

Code:
.block_17 {
    display: block;
    font-family: "Liberation Sans", sans-serif;
    font-size: 1.66667em;
    font-weight: bold;
    line-height: 1.2;
    text-align: left;
    text-indent: 0;
    padding: 0;
    page-break-inside: avoid;
    page-break-after: avoid;
    margin: 68.6pt 0 34.3pt
    }
so I think I am doing what you are suggesting, am I?

This is what comes AFTER the heading:

Code:
...
</ol>
	<h2 id="id_RefHeading__5349_1529499100" class="block_17">Heading with no text</h2>
	<ol class="list_1">
	<li class="block_100" value="338">yadda yadda yadda</li>
...
But if what you are saying is true for ibooks as well, I might just give up, then

Last edited by Arkadian; 09-12-2014 at 05:19 PM.
Arkadian is offline   Reply With Quote
Old 09-12-2014, 06:51 PM   #20
Arkadian
Connoisseur
Arkadian began at the beginning.
 
Posts: 96
Karma: 10
Join Date: Mar 2014
Device: none
Right... I have tried to convert a small text sample.
If in the docx I select "keep with paragraph" in the "text flow" pane, when I change the file into an epub I see nothing... there is no trace of it.
If instead I click on orphan and widow as well I get this:

Code:
<?xml version='1.0' encoding='utf-8'?>
<html xmlns="http://www.w3.org/1999/xhtml" lang="it" xml:lang="it">
  <head>
    <title>Sconosciuto</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
  <link href="stylesheet.css" rel="stylesheet" type="text/css"/>
<link href="page_styles.css" rel="stylesheet" type="text/css"/>
</head>
  <body class="calibre">
	<h2 class="block_" id="toc_id_1">Headline goes here</h2>
	<ol class="list_">
	<li class="block_1">yadda yadda yadda</li>
</ol>

</body></html>
The only thing different is "id="toc_id_1". Could it be useful? Apart from that... there is nothing notewirthy in the rest of the files.

________________

Oh... toc = Table of contents, so nothing there either.
So, to sum up, from LO docx files to epub there is no control over the way text is split between pages, therefore I have to live with headings with no text

Last edited by Arkadian; 09-12-2014 at 06:55 PM.
Arkadian is offline   Reply With Quote
Old 09-12-2014, 10:39 PM   #21
BetterRed
null operator (he/him)
BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.
 
Posts: 21,741
Karma: 30237526
Join Date: Mar 2012
Location: Sydney Australia
Device: none
@Arkadian Hmmm, is there anything in Conversion->Look and Feel->Extra CSS or Filter Style Information - if there is, take a note of what's there and rip it out

If you want to zip up your test DOCX, and the template (DOTX) it uses... ¿does Writer have DOTX's... and the resultant EPUB, and post it here then I'll have a look at it.

I find it hard to believe that LO is not writing a valid DOCX, mainly because I think Kovid did his DOCX_Input PI testing on LO Writer created DOCX's. And I can say with near absolute certainty that my Keep with Next ticks in Word always translate into CSS styles that include the 'page-break-inside: avoid;' artefact

BR
BetterRed is offline   Reply With Quote
Old 09-13-2014, 01:51 AM   #22
arspr
Dead account. Bye
arspr ought to be getting tired of karma fortunes by now.arspr ought to be getting tired of karma fortunes by now.arspr ought to be getting tired of karma fortunes by now.arspr ought to be getting tired of karma fortunes by now.arspr ought to be getting tired of karma fortunes by now.arspr ought to be getting tired of karma fortunes by now.arspr ought to be getting tired of karma fortunes by now.arspr ought to be getting tired of karma fortunes by now.arspr ought to be getting tired of karma fortunes by now.arspr ought to be getting tired of karma fortunes by now.arspr ought to be getting tired of karma fortunes by now.
 
Posts: 587
Karma: 668244
Join Date: Mar 2011
Device: none
Quote:
Originally Posted by Arkadian View Post
Code:
<?xml version='1.0' encoding='utf-8'?>
<html xmlns="http://www.w3.org/1999/xhtml" lang="it" xml:lang="it">
  <head>
    <title>Sconosciuto</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
  <link href="stylesheet.css" rel="stylesheet" type="text/css"/>
<link href="page_styles.css" rel="stylesheet" type="text/css"/>
</head>
  <body class="calibre">
	<h2 class="block_" id="toc_id_1">Headline goes here</h2>
	<ol class="list_">
	<li class="block_1">yadda yadda yadda</li>
</ol>

</body></html>
Just speculating but I think your problem arises because of the <ol>.

Possibly your renderer is trying to put <h2> and THE WHOLE <ol> in the same page. It is maybe impossible and then it just splits after <h2>...

If the start numbering of the <ol> lists can be altered (I've never used this tag) you could try something like that:

Code:
<h2 class="do_not_break_after_me">Your Title</h2>
<ol class="just_the_first_item">
  <li>First item</li>
</ol>
<ol class="continue_numbering_with_whichever_trick">
  <li>Whatever goes after it.</li>
  ...
</ol>
arspr is offline   Reply With Quote
Old 09-13-2014, 04:16 AM   #23
BobC
Guru
BobC ought to be getting tired of karma fortunes by now.BobC ought to be getting tired of karma fortunes by now.BobC ought to be getting tired of karma fortunes by now.BobC ought to be getting tired of karma fortunes by now.BobC ought to be getting tired of karma fortunes by now.BobC ought to be getting tired of karma fortunes by now.BobC ought to be getting tired of karma fortunes by now.BobC ought to be getting tired of karma fortunes by now.BobC ought to be getting tired of karma fortunes by now.BobC ought to be getting tired of karma fortunes by now.BobC ought to be getting tired of karma fortunes by now.
 
Posts: 691
Karma: 3026110
Join Date: Dec 2008
Location: Lancashire, U.K.
Device: BeBook 1, BeBook Pure, Kobo Glo, (and HD),Energy Sistem EReader Pro +
At the risk of not answering the original question, have you considered using one of the LO extensions to simply export your original document as an EPUB rather than convert with Calibre ?

I have found these can create css styling that is closer to the original source document and easier to understand.

There are two main contenders :

Luke's Writer2Epub add-on
and
Export to EPUB, part of the Writer2xhtml export filter extension from http://writer2latex.sourceforge.net/ (though this needs a tweaked version to run with the current LO). This creates css styles with the same name as the styles used in the original LO document.

BobC
BobC is offline   Reply With Quote
Old 09-13-2014, 05:28 AM   #24
Arkadian
Connoisseur
Arkadian began at the beginning.
 
Posts: 96
Karma: 10
Join Date: Mar 2014
Device: none
Quote:
Originally Posted by BetterRed View Post
Do the CSS styles used for the header have something like

Code:
.block_ {
    display: block;
    page-break-inside: avoid;  /* IS THIS PRESENT IN THE STYLE USED FOR HEADER */
    text-align: justify;
    text-indent: 14.2pt;
    padding: 0;
    margin: 0 0 6pt
    }
BR
Quote:
Originally Posted by BetterRed View Post
@Arkadian Hmmm, is there anything in Conversion->Look and Feel->Extra CSS or Filter Style Information - if there is, take a note of what's there and rip it out

If you want to zip up your test DOCX, and the template (DOTX) it uses... ¿does Writer have DOTX's... and the resultant EPUB, and post it here then I'll have a look at it.

I find it hard to believe that LO is not writing a valid DOCX, mainly because I think Kovid did his DOCX_Input PI testing on LO Writer created DOCX's. And I can say with near absolute certainty that my Keep with Next ticks in Word always translate into CSS styles that include the 'page-break-inside: avoid;' artefact

BR
Hi BR, here is your files.

HOWEVER... the point of the matter is that my h2 style does comprise
page-break-after: avoid;
but it is not doing anything. The fact that LO does not produce it is neither here nor there at this moment in time.

@arspr,
why the <ol> tag is being used throughout I cannot say... There are lists in my doc, but even normal text is wrapped in these tags.
So, if I get your suggestion right, you are saying I can try to separate the first sentence or whatever right after the h2 to see whether that helps...
Although, now that I think about it, elsewhere I don't seem to have any problem splitting longer chunks of text between pages; even lists are being split halfway through (and of that I am not too fond of...)
Attached Files
File Type: zip LO test files.zip (145.8 KB, 251 views)
Arkadian is offline   Reply With Quote
Old 09-13-2014, 07:08 AM   #25
BetterRed
null operator (he/him)
BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.
 
Posts: 21,741
Karma: 30237526
Join Date: Mar 2012
Location: Sydney Australia
Device: none
@Arkadian - well, well, well

When I open your DOCX in Word I see the Keep with Next checked. I dumped your test DOCX into calibre and converted using my 'everyday DOCX->EPUB' settings - guess what no - page-break-after: avoid;

Zo, I attached my 'everyday Word Template' to your document, and converted it - guess what - the page-break-after: avoid; is there.

As recently wrote elsewhere

Quote:
.... I've used it [calibre DOCX->EPUB] to convert ~50,000 'books', all of which use a common template, which I've probably unwittingly fashioned around the capabilities of the DOCXInput PI.
Its getting late in the day here, well for me it is, I'll have a closer look in the morning. Maybe I can find a way to convert your OTT to a DOTX. I've got LO in my torrent folder, so I can install it if needs be. But I suspect the key to the missing page-break-after: avoid; entry is in the OTT file.

We'll get there - even if it too late to catch the bus :lol:

BR
BetterRed is offline   Reply With Quote
Old 09-13-2014, 07:32 AM   #26
Arkadian
Connoisseur
Arkadian began at the beginning.
 
Posts: 96
Karma: 10
Join Date: Mar 2014
Device: none
Thanks BR, and good night (it is lunch time here...)

What I forgot to say is that I am on a Mac, in case it does make a difference.
I am running Mavericks and the latest versions of LO and Calibre.

However, I stress again that IN MY CASE it is not so important to understand why I don't get that string in, because even when the string is indeed in... it doesn't work.
Obviously these are two separate issues.
Arkadian is offline   Reply With Quote
Old 09-13-2014, 07:50 AM   #27
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 45,376
Karma: 27230406
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
The DOCX plugin only supports keeping the contents of a single paragrpah on the same page, not multiple paragraphs. If you want to keep a set of paragrpahs together in EPUB you need to wrap them in div tags like this

<div style="page-break-inside:avoid">
<p>
<p>
...
</div>
kovidgoyal is offline   Reply With Quote
Old 09-13-2014, 07:58 AM   #28
BetterRed
null operator (he/him)
BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.
 
Posts: 21,741
Karma: 30237526
Join Date: Mar 2012
Location: Sydney Australia
Device: none
Quote:
Originally Posted by Arkadian View Post
Thanks BR, and good night (it is lunch time here...)

What I forgot to say is that I am on a Mac, in case it does make a difference.
I am running Mavericks and the latest versions of LO and Calibre.

However, I stress again that IN MY CASE it is not so important to understand why I don't get that string in, because even when the string is indeed in... it doesn't work.
Obviously these are two separate issues.
Indeed there are - from your other threat:

Quote:
Originally Posted by Toxaris View Post
You could add 'page-break-inside: avoid' to the div class. No guarantee though, it is not supported on all devices. It probably is in iBooks.
So, where it doesn't work

On your MAC? If so in what viewer?
On a device? If so what device and in what viewer (if is phone, or tablet)?

Here's the style sheet I got from calibre when I applied my 'everyday' Word Template to your LO test document.

Spoiler:
Code:
.block_ {
    display: block;
    font-size: 1.41667em;
    font-style: italic;
    font-weight: bold;
    line-height: 1.2;
    page-break-inside: avoid;
    text-align: left;
    text-indent: 0;
    padding: 0;
    margin: 0 0 12pt
    }
.block_1 {
    display: list-item;
    line-height: 1.2;
    margin-bottom: 7pt;
    margin-left: 36pt;
    page-break-inside: avoid;
    text-align: justify
    }
.calibre {
    color: black;
    display: block;
    font-size: 1em;
    padding-left: 0;
    padding-right: 0;
    margin: 0 5pt
    }
.list_ {
    display: block;
    list-style-type: none;
    margin-bottom: 0;
    margin-right: 0;
    margin-top: 0;
    padding-bottom: 0;
    padding-right: 0;
    padding-top: 0
    }


As we say down here, have a nice Satdee arvo

BR
BetterRed is offline   Reply With Quote
Old 09-13-2014, 08:43 AM   #29
Arkadian
Connoisseur
Arkadian began at the beginning.
 
Posts: 96
Karma: 10
Join Date: Mar 2014
Device: none
Quote:
Originally Posted by kovidgoyal View Post
The DOCX plugin only supports keeping the contents of a single paragrpah on the same page, not multiple paragraphs. If you want to keep a set of paragrpahs together in EPUB you need to wrap them in div tags like this

<div style="page-break-inside:avoid">
<p>
<p>
...
</div>
Hi Kovid,

thanks for that.

What I would like to accomplish, rather than keeping a whole paragraph together with the headline, is to keep at least a portion of it, as a whole paragraph may be too long.

Anyway, must I do it what you suggest on every headline throughout the book or is there a shorter way?
Arkadian is offline   Reply With Quote
Old 09-13-2014, 10:07 AM   #30
Arkadian
Connoisseur
Arkadian began at the beginning.
 
Posts: 96
Karma: 10
Join Date: Mar 2014
Device: none
Quote:
Originally Posted by BetterRed View Post
Indeed there are - from your other threat:



So, where it doesn't work

On your MAC? If so in what viewer?
On a device? If so what device and in what viewer (if is phone, or tablet)?

...
BR
I am currently testing on my iPad using ibooks (I can't use the one on my iMac because iBooks doesn't seem to work properly (not just on my ebook, but on some test ones I was trying out as well)
Arkadian is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Left border for text within paragraph democrite ePub 7 09-19-2013 03:26 AM
Preventing Page Title from Being Inserted into Article Text buffaloseven Recipes 0 07-25-2013 11:39 PM
Paragraph text alignment in Fixed-Layout EPUB Raja1205 ePub 0 05-11-2013 02:55 AM
Continuous text with no paragraph breaks midlifec Calibre 1 12-26-2010 04:09 PM
Text Analysis & Paragraph Detection ahi Workshop 15 09-14-2009 11:28 PM


All times are GMT -4. The time now is 06:56 AM.


MobileRead.com is a privately owned, operated and funded community.