Register Guidelines E-Books Search Today's Posts Mark Forums Read

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

Notices

Reply
 
Thread Tools Search this Thread
Old 05-12-2018, 02:58 PM   #1
alegriadelarte
Junior Member
alegriadelarte began at the beginning.
 
Posts: 9
Karma: 10
Join Date: May 2018
Device: epub
How to generate a TOC as a page in the eBook?

Hello,

I wish to create a table of content from headers h1 to h4 so that the headers cascade in an automatically generated html page.

I know that there is the "Modify TOC" button, but I haven't found a way to actually generate a page and further more I wish to put this page in my ebook between two chapters.


The resulting page might look as such

Title1
___Title11
___Title12
Title2
___Title21
______Title 212

Thanks
alegriadelarte is offline   Reply With Quote
Advert
Old 05-12-2018, 03:40 PM   #2
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: 21,665
Karma: 20975546
Join Date: Aug 2009
Location: (The original) Silicon Valley, USA
Device: K4NT, Galaxy Tab 2(RIP)
Once you have a NCX TOC (that is what you create with the TOC tool),

Select Tools:Table of contents: Insert Inline TOC

That inserts the file TOC.xhtml near the front. Move it to where you want it
theducks is online now   Reply With Quote
Old 05-13-2018, 10:42 AM   #3
alegriadelarte
Junior Member
alegriadelarte began at the beginning.
 
Posts: 9
Karma: 10
Join Date: May 2018
Device: epub
Generates exactly what I was looking for.

But the issue is that toc.xhtml appears of the screen on a smartphone, with a padding-left about 1/3 of the screen.

I tried
.level1 { font-size: 170%; padding-left: -1em; padding-top: 3em; }
.level2 { font-size: 60%; padding-left: 0em;}
.level3 { font-size: 80%; }

To no avail

Last edited by alegriadelarte; 05-13-2018 at 05:10 PM.
alegriadelarte is offline   Reply With Quote
Old 05-14-2018, 03:52 AM   #4
alegriadelarte
Junior Member
alegriadelarte began at the beginning.
 
Posts: 9
Karma: 10
Join Date: May 2018
Device: epub
the TOC has its own css on which the stylesheet.css does not apply (for example if one sets body{ background-color: red;} one sees that it does not apply on the TOC)


Where is the css of the TOC??
alegriadelarte is offline   Reply With Quote
Old 05-14-2018, 05:54 AM   #5
Nicolas F
Zealot
Nicolas F doesn't litterNicolas F doesn't litter
 
Posts: 138
Karma: 108
Join Date: Jan 2016
Device: Kobo Glo HD
Quote:
Originally Posted by alegriadelarte View Post
the TOC has its own css on which the stylesheet.css does not apply (for example if one sets body{ background-color: red;} one sees that it does not apply on the TOC)


Where is the css of the TOC??
It's at the top of the TOC file itself in the <head> element.
just change or add your css code inside the <style type="text/css"> element
Nicolas F is offline   Reply With Quote
Old 05-14-2018, 09:42 AM   #6
alegriadelarte
Junior Member
alegriadelarte began at the beginning.
 
Posts: 9
Karma: 10
Join Date: May 2018
Device: epub
>It's at the top of the TOC file itself in the <head> element.
I tried, but fails to work.

The TOC file is really treated independly from the others
alegriadelarte is offline   Reply With Quote
Old 05-14-2018, 03:04 PM   #7
Nicolas F
Zealot
Nicolas F doesn't litterNicolas F doesn't litter
 
Posts: 138
Karma: 108
Join Date: Jan 2016
Device: Kobo Glo HD
It works for me. Did you also change the style for the li element?

Your problem might also be that the <li> and <ul> element are rendered by default with a text indent. So if you don't want the text to be indented add:
Code:
text-indent:0
Nicolas F is offline   Reply With Quote
Old 05-22-2018, 10:40 AM   #8
alegriadelarte
Junior Member
alegriadelarte began at the beginning.
 
Posts: 9
Karma: 10
Join Date: May 2018
Device: epub
Not satisfied, behaviour is inconsistent according to reader.

Quote:
.level1 { font-size: 150%; padding-left: 0; text-align: center; background: lightgrey; }
.level2 { font-size: 60%; padding-left: 0; text-align: left; text-indent: -2em;}
.level3 { font-size: 80%; text-indent: -4em;}
If I view Edge under Win10: ok
If I view under Android, with Eboox, Google Play or ReadEra, I have very different behaviour.
Eboox does not at all take into accounts the above css.
alegriadelarte is offline   Reply With Quote
Old 05-22-2018, 11:09 AM   #9
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: 21,665
Karma: 20975546
Join Date: Aug 2009
Location: (The original) Silicon Valley, USA
Device: K4NT, Galaxy Tab 2(RIP)
Quote:
Originally Posted by alegriadelarte View Post
Not satisfied, behaviour is inconsistent according to reader.



If I view Edge under Win10: ok
If I view under Android, with Eboox, Google Play or ReadEra, I have very different behaviour.
Eboox does not at all take into accounts the above css.
You have blundered into the nasty truth about some Viewer apps.
'We know better" (and will only do it our way)
theducks is online now   Reply With Quote
Old 05-22-2018, 03:18 PM   #10
Nicolas F
Zealot
Nicolas F doesn't litterNicolas F doesn't litter
 
Posts: 138
Karma: 108
Join Date: Jan 2016
Device: Kobo Glo HD
Quote:
Originally Posted by alegriadelarte View Post
Not satisfied, behaviour is inconsistent according to reader.



If I view Edge under Win10: ok
If I view under Android, with Eboox, Google Play or ReadEra, I have very different behaviour.
Eboox does not at all take into accounts the above css.
Sadly, theducks is right, since different readers don't render things the same your CSS will not always give you the same result and it can be difficult to change this...

You could try to add
Code:
  li, ul {
    list-style-type: none;
    text-indent: 0;
    margin: 0;
    padding:0;
  }
to put everything at 0 before your code
Nicolas F is offline   Reply With Quote
Old 05-23-2018, 01:54 AM   #11
DoctorOhh
US Navy, Retired
DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.
 
DoctorOhh's Avatar
 
Posts: 9,559
Karma: 13662888
Join Date: Feb 2009
Location: North Carolina
Device: Icarus Illumina XL HD, Nexus 7
Quote:
Originally Posted by alegriadelarte View Post
If I view Edge under Win10: ok
If I view under Android, with Eboox, Google Play or ReadEra, I have very different behaviour.
Eboox does not at all take into accounts the above css.
Why bother with an inline TOC page when all of the readers you cited have the ability to open the standard epub TOC?
DoctorOhh is offline   Reply With Quote
Old 05-23-2018, 09:16 AM   #12
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: 21,665
Karma: 20975546
Join Date: Aug 2009
Location: (The original) Silicon Valley, USA
Device: K4NT, Galaxy Tab 2(RIP)
Quote:
Originally Posted by DoctorOhh View Post
Why bother with an inline TOC page when all of the readers you cited have the ability to open the standard epub TOC?
Because they need some place to us Page Numbers?
So it looks exactly like the dead tree version?
(Gah! Years ago, I sent hours making a data entry form look EXACTLY like the paper version that they (the client) had used for decades. <surprised they didn't have quills and ink wells in the home office >
theducks is online now   Reply With Quote
Reply

Tags
toc pages

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Generate TOC and linebreaks AlanHK Sigil 24 09-25-2017 08:37 PM
How to generate a physical TOC? Books987 Conversion 2 01-24-2015 11:08 PM
html does not generate TOC iliakan Conversion 3 01-05-2015 01:56 PM
Can't tell ebook-convert to NOT generate inline TOC for Mobi EliW Conversion 17 05-10-2013 11:08 AM
How to generate cover from the first page of an ebook? purgatorios Library Management 2 11-17-2012 07:42 AM


All times are GMT -4. The time now is 11:49 AM.


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