Register Guidelines E-Books Today's Posts Search

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

Notices

Reply
 
Thread Tools Search this Thread
Old 05-08-2015, 09:11 AM   #1
Phssthpok
Age improves with wine.
Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.
 
Posts: 558
Karma: 95229
Join Date: Nov 2014
Device: Kindle Oasis, Kobo Libra II
EPUB to AZW3 problem

When converting EPUBs that have <h1> and <h2> on the same page, the AZW3 output moves the <h2> to a separate page (the <h1> and <h2> are in the same HTML file before conversion, but in two separate files after).

I have set the "Insert page break before" option (Preferences > Conversion > Common Options > Structure Detection) to "/" but it makes no difference.

The EPUB has the following style settings:
Code:
h1 {
  font-size: 1.5em;
  text-align: center;
  page-break-before: always;
  margin: 5em 2em 1em 2em;
}
h2 {
  font-size: 1.2em;
  text-align: center;
  margin: 2em;
}
Can anyone suggest a solution to this please?
Phssthpok is offline   Reply With Quote
Old 05-08-2015, 11:51 AM   #2
eschwartz
Ex-Helpdesk Junkie
eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.
 
eschwartz's Avatar
 
Posts: 19,421
Karma: 85397180
Join Date: Nov 2012
Location: The Beaten Path, USA, Roundworld, This Side of Infinity
Device: Kindle Touch fw5.3.7 (Wifi only)
Why are you using multiple headers on a single page? I mean, I get that you can use all kinds of weird settings to force through nonstandard results, but why not just build the book properly to begin with?

Whyever you are doing it, I am sure there must be a better way.
eschwartz is offline   Reply With Quote
Advert
Old 05-08-2015, 12:05 PM   #3
odamizu
just an egg
odamizu ought to be getting tired of karma fortunes by now.odamizu ought to be getting tired of karma fortunes by now.odamizu ought to be getting tired of karma fortunes by now.odamizu ought to be getting tired of karma fortunes by now.odamizu ought to be getting tired of karma fortunes by now.odamizu ought to be getting tired of karma fortunes by now.odamizu ought to be getting tired of karma fortunes by now.odamizu ought to be getting tired of karma fortunes by now.odamizu ought to be getting tired of karma fortunes by now.odamizu ought to be getting tired of karma fortunes by now.odamizu ought to be getting tired of karma fortunes by now.
 
odamizu's Avatar
 
Posts: 1,588
Karma: 4300000
Join Date: Mar 2015
Device: Kindle, iOS
Quote:
Originally Posted by Phssthpok View Post
When converting EPUBs that have <h1> and <h2> on the same page, the AZW3 output moves the <h2> to a separate page ... I have set the "Insert page break before" option (Preferences > Conversion > Common Options > Structure Detection) to "/" but it makes no difference.
For "Insert page break before" option, try: //*[name()='h1']

That works for me to limit page breaks to only <h1> and keeps any <h2> subheads on the same page.

@eschwartz: I have a few books that use <h1> for chapter heads and <h2> for subheads. With the above "insert page break before" option it works fine. Why is this improper?

Last edited by odamizu; 05-08-2015 at 12:11 PM.
odamizu is offline   Reply With Quote
Old 05-08-2015, 12:19 PM   #4
theducks
Well trained by Cats
theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.
 
theducks's Avatar
 
Posts: 29,872
Karma: 55267620
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
Quote:
Originally Posted by odamizu View Post
For "Insert page break before" option, try: //*[name()='h1']

That works for me to limit page breaks to only <h1> and keeps any <h2> subheads on the same page.

@eschwartz: I have a few books that use <h1> for chapter heads and <h2> for subheads. With the above "insert page break before" option it works fine. Why is this improper?
Unnecessary
You are using HTML2 methods to style

Style a 'p.subhead' style if you want that appearance

font-size: 1.5em;
font-weight: bold;
text-align: center;
theducks is offline   Reply With Quote
Old 05-08-2015, 12:42 PM   #5
odamizu
just an egg
odamizu ought to be getting tired of karma fortunes by now.odamizu ought to be getting tired of karma fortunes by now.odamizu ought to be getting tired of karma fortunes by now.odamizu ought to be getting tired of karma fortunes by now.odamizu ought to be getting tired of karma fortunes by now.odamizu ought to be getting tired of karma fortunes by now.odamizu ought to be getting tired of karma fortunes by now.odamizu ought to be getting tired of karma fortunes by now.odamizu ought to be getting tired of karma fortunes by now.odamizu ought to be getting tired of karma fortunes by now.odamizu ought to be getting tired of karma fortunes by now.
 
odamizu's Avatar
 
Posts: 1,588
Karma: 4300000
Join Date: Mar 2015
Device: Kindle, iOS
Quote:
Originally Posted by theducks View Post
Unnecessary
You are using HTML2 methods to style

Style a 'p.subhead' style if you want that appearance
LOL! But, I am oldschool, baby!

Seriously, I only have a couple books that use <h1> <h2> for chapter and subhead, so I was looking for a quick fix to block pagebreaks and still have the subheads included in the TOC.

But in the interest of bringing me into the current century, if I changed <h2> to <p class="subhead"> would the appropriate TOC expressions be: Level 1 //h:h1 and Level 2 //h: p[@subhead] ? (with no space between h: and p, but I had to do that otherwise it gave me this emoticon: )
odamizu is offline   Reply With Quote
Advert
Old 05-08-2015, 01:57 PM   #6
Phssthpok
Age improves with wine.
Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.Phssthpok knows how to set a laser printer to stun.
 
Posts: 558
Karma: 95229
Join Date: Nov 2014
Device: Kindle Oasis, Kobo Libra II
Quote:
Originally Posted by odamizu View Post
For "Insert page break before" option, try: //*[name()='h1']

That works for me to limit page breaks to only <h1> and keeps any <h2> subheads on the same page.

@eschwartz: I have a few books that use <h1> for chapter heads and <h2> for subheads. With the above "insert page break before" option it works fine. Why is this improper?
Thanks, I'll give it a try. Meanwhile some other books (with different CSS) don't exhibit this problem, so I'm confused.

I agree with you about heads & subheads. Structurally, the H2s are headings, not just paras with a special appearance. They should be denoted as such in the HTML. However, I then want to use CSS to control the appearance of that structure, and not have the appearance undermined by the conversion tool. Eschwartz's position seems to be that I should destroy the structure to give the correct appearance... in which case I could use nothing but <div> or <span> with CSS to give the appearance of headings, quotations and other structural elements.
Phssthpok is offline   Reply With Quote
Old 05-08-2015, 02:08 PM   #7
eschwartz
Ex-Helpdesk Junkie
eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.
 
eschwartz's Avatar
 
Posts: 19,421
Karma: 85397180
Join Date: Nov 2012
Location: The Beaten Path, USA, Roundworld, This Side of Infinity
Device: Kindle Touch fw5.3.7 (Wifi only)
The appropriate way is I believe to use a
Code:
<h1>Header<br/><span class="subhead">Subhead</span></h1>
This has the effect of semantically keeping a subhead part of the structural header, as well as avoiding all those inappropriate breaks, and, @theducks, with an added benefit of not confusing paragraph-specific formatting to be overridden!
The CSS for .subhead can be used to modify the subhead relative to the original header class.

@odamizu -- use the [NOPARSE][/NOPARSE] tags. Cleverly, I have used them recursively, in order to stop the [NOPARSE][/NOPARSE] tags from being parsed and disappearing (like this: ).

Last edited by eschwartz; 05-08-2015 at 04:31 PM. Reason: typo
eschwartz is offline   Reply With Quote
Old 05-08-2015, 04:25 PM   #8
theducks
Well trained by Cats
theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.
 
theducks's Avatar
 
Posts: 29,872
Karma: 55267620
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
use the eschwartz method.
I play also with Lineheight for the Span
theducks is offline   Reply With Quote
Old 05-08-2015, 07:48 PM   #9
odamizu
just an egg
odamizu ought to be getting tired of karma fortunes by now.odamizu ought to be getting tired of karma fortunes by now.odamizu ought to be getting tired of karma fortunes by now.odamizu ought to be getting tired of karma fortunes by now.odamizu ought to be getting tired of karma fortunes by now.odamizu ought to be getting tired of karma fortunes by now.odamizu ought to be getting tired of karma fortunes by now.odamizu ought to be getting tired of karma fortunes by now.odamizu ought to be getting tired of karma fortunes by now.odamizu ought to be getting tired of karma fortunes by now.odamizu ought to be getting tired of karma fortunes by now.
 
odamizu's Avatar
 
Posts: 1,588
Karma: 4300000
Join Date: Mar 2015
Device: Kindle, iOS
Ummm ... okay ... aside from the fact that the <br/> and <span> within an <h1> makes for some pretty ugly code I think we're talking about different kinds of subheads.

This is my HTML/CSS:

Spoiler:

Code:
<h1>Chapter 1</h1>

<h2 class="subch">Subhead AAA</h2>
<p>text text text</p>
<p>text text text</p>

<h2 class="subch1">Subhead BBB</h2>
<p>text text text</p>
<p>text text text</p>

<h2 class="subch1">Subhead CCC</h2>
<p>text text text</p>
<p>text text text</p>

<h1>Chapter 2</h1>

<h2 class="subch">Subhead DDD</h2>
<p>text text text</p>
<p>text text text</p>

<h2 class="subch1">Subhead EEE</h2>
<p>text text text</p>
<p>text text text</p>

<h2 class="subch1">Subhead FFF</h2>
<p>text text text</p>
<p>text text text</p>
Code:
h1 { font-size: 150%; margin-top: 20%; margin-bottom: 1em; text-align: center; }
h2.subch { font-size: 120%; margin-top: 0; margin-bottom: 1em; text-align: center; }
h2.subch1 { font-size: 120%; margin-top: 2em; margin-bottom: 1em; text-align: center; }


Then I run it through Calibre with the following settings:
  • Structure Detection > Insert page breaks before: //*[name()='h1']
  • Table of Contents > Level 1 TOC //h:h1 Level 2 TOC //h:h2

With the above, Calibre inserts a pagebreak before each chapter but not before subheads and it creates a TOC structured like so:

Chapter 1
  • Subhead AAA
  • Subhead BBB
  • Subhead CCC

Chapter 2
  • Subhead DDD
  • Subhead EEE
  • Subhead FFF

I think it will take a lot more (ugly ) code to make the eschwartz method accomplish the same
odamizu is offline   Reply With Quote
Old 05-08-2015, 07:58 PM   #10
odamizu
just an egg
odamizu ought to be getting tired of karma fortunes by now.odamizu ought to be getting tired of karma fortunes by now.odamizu ought to be getting tired of karma fortunes by now.odamizu ought to be getting tired of karma fortunes by now.odamizu ought to be getting tired of karma fortunes by now.odamizu ought to be getting tired of karma fortunes by now.odamizu ought to be getting tired of karma fortunes by now.odamizu ought to be getting tired of karma fortunes by now.odamizu ought to be getting tired of karma fortunes by now.odamizu ought to be getting tired of karma fortunes by now.odamizu ought to be getting tired of karma fortunes by now.
 
odamizu's Avatar
 
Posts: 1,588
Karma: 4300000
Join Date: Mar 2015
Device: Kindle, iOS
Quote:
Originally Posted by eschwartz View Post
@odamizu -- use the [NOPARSE][/NOPARSE] tags. Cleverly, I have used them recursively, in order to stop the [NOPARSE][/NOPARSE] tags from being parsed and disappearing (like this: ).
Yeah, okay, you totally lost me here Where do I use NOPARSE and what will it do for me?
odamizu is offline   Reply With Quote
Old 05-08-2015, 08:05 PM   #11
PeterT
Grand Sorcerer
PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.
 
PeterT's Avatar
 
Posts: 12,216
Karma: 73758904
Join Date: Nov 2007
Location: Toronto
Device: Nexus 7, Clara, Touch, Tolino EPOS
The NOPARSE tags are used HERE in the forums. By wrapping stuff in [NOPARSE]stuff goes here[/NOPARSE] tags you prevent the forum from interpreting stuff goes here as valid BBCode tags.

See https://www.mobileread.com/forums/misc.php?do=bbcode for all valid BBCode tags.
PeterT is offline   Reply With Quote
Old 05-08-2015, 09:03 PM   #12
eschwartz
Ex-Helpdesk Junkie
eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.
 
eschwartz's Avatar
 
Posts: 19,421
Karma: 85397180
Join Date: Nov 2012
Location: The Beaten Path, USA, Roundworld, This Side of Infinity
Device: Kindle Touch fw5.3.7 (Wifi only)
Quote:
Originally Posted by odamizu View Post
Ummm ... okay ... aside from the fact that the <br/> and <span> within an <h1> makes for some pretty ugly code I think we're talking about different kinds of subheads.

This is my HTML/CSS:

Spoiler:

Code:
<h1>Chapter 1</h1>

<h2 class="subch">Subhead AAA</h2>
<p>text text text</p>
<p>text text text</p>

<h2 class="subch1">Subhead BBB</h2>
<p>text text text</p>
<p>text text text</p>

<h2 class="subch1">Subhead CCC</h2>
<p>text text text</p>
<p>text text text</p>

<h1>Chapter 2</h1>

<h2 class="subch">Subhead DDD</h2>
<p>text text text</p>
<p>text text text</p>

<h2 class="subch1">Subhead EEE</h2>
<p>text text text</p>
<p>text text text</p>

<h2 class="subch1">Subhead FFF</h2>
<p>text text text</p>
<p>text text text</p>
Code:
h1 { font-size: 150%; margin-top: 20%; margin-bottom: 1em; text-align: center; }
h2.subch { font-size: 120%; margin-top: 0; margin-bottom: 1em; text-align: center; }
h2.subch1 { font-size: 120%; margin-top: 2em; margin-bottom: 1em; text-align: center; }


Then I run it through Calibre with the following settings:
  • Structure Detection > Insert page breaks before: //*[name()='h1']
  • Table of Contents > Level 1 TOC //h:h1 Level 2 TOC //h:h2

With the above, Calibre inserts a pagebreak before each chapter but not before subheads and it creates a TOC structured like so:

Chapter 1
  • Subhead AAA
  • Subhead BBB
  • Subhead CCC

Chapter 2
  • Subhead DDD
  • Subhead EEE
  • Subhead FFF

I think it will take a lot more (ugly ) code to make the eschwartz method accomplish the same
You're right, that is totally different. For that, yours is the correct way.
eschwartz is offline   Reply With Quote
Old 05-08-2015, 10:43 PM   #13
odamizu
just an egg
odamizu ought to be getting tired of karma fortunes by now.odamizu ought to be getting tired of karma fortunes by now.odamizu ought to be getting tired of karma fortunes by now.odamizu ought to be getting tired of karma fortunes by now.odamizu ought to be getting tired of karma fortunes by now.odamizu ought to be getting tired of karma fortunes by now.odamizu ought to be getting tired of karma fortunes by now.odamizu ought to be getting tired of karma fortunes by now.odamizu ought to be getting tired of karma fortunes by now.odamizu ought to be getting tired of karma fortunes by now.odamizu ought to be getting tired of karma fortunes by now.
 
odamizu's Avatar
 
Posts: 1,588
Karma: 4300000
Join Date: Mar 2015
Device: Kindle, iOS
@PeterT: Ohhhhhhhh. COOL! Thanks!

@eschwartz:

But the real question is, did we help the OP?
odamizu is offline   Reply With Quote
Old 05-08-2015, 11:25 PM   #14
theducks
Well trained by Cats
theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.
 
theducks's Avatar
 
Posts: 29,872
Karma: 55267620
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
Preferences :common options: delete the H2 reference
(or the similar section in the individual Book conversion form)

OR

Use H2 and H3 as h3 does not get a forced pagebreak
theducks is offline   Reply With Quote
Old 05-09-2015, 08:03 AM   #15
rashkae
Wizard
rashkae ought to be getting tired of karma fortunes by now.rashkae ought to be getting tired of karma fortunes by now.rashkae ought to be getting tired of karma fortunes by now.rashkae ought to be getting tired of karma fortunes by now.rashkae ought to be getting tired of karma fortunes by now.rashkae ought to be getting tired of karma fortunes by now.rashkae ought to be getting tired of karma fortunes by now.rashkae ought to be getting tired of karma fortunes by now.rashkae ought to be getting tired of karma fortunes by now.rashkae ought to be getting tired of karma fortunes by now.rashkae ought to be getting tired of karma fortunes by now.
 
rashkae's Avatar
 
Posts: 1,176
Karma: 5061953
Join Date: Jun 2011
Location: Ontario, Canada
Device: Kobo Aura HD
Since most of my e-book conversions are e-book to e-book format, I disable the "insert page break" entirely by default. Since most properly formatted books will already have the page breaks, (or file splits) at the right places, automatically adding more can only be bad.

In your conversion options, under "Structure Detection". Change "Chapter Mark" to None, and change "Insert Page Breaks Before" to '/' (No quotes, just the slash.)

Edit: Since you've already changed the "inert Page Breaks', the only option that would be adding unwanted page breaks is the Chapter mark at automatic Chapter detection. Changing that to none should correct the problem.

Last edited by rashkae; 05-09-2015 at 08:08 AM.
rashkae is offline   Reply With Quote
Reply

Tags
page breaks


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Image Conversion problem from Epub to AZW3 rosshalde Conversion 0 12-01-2014 10:48 AM
table of contents problem in epub to azw3 quizzz Conversion 0 02-22-2014 02:10 AM
EPUB to AZW3 Duplicate first image problem loopshot Conversion 1 10-30-2013 10:46 PM
Problem with conversion from AZW3 to ePub Kaetrin Conversion 3 05-30-2013 04:57 AM
azw3 problem theluckyfox Conversion 3 10-20-2012 03:38 PM


All times are GMT -4. The time now is 08:20 PM.


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