[Enhancement] Add PDF TOC Title, More Margin Options and ePub TOC Heading 1

Bug #1245076 reported by Jonas on 2013-10-26
This bug affects 1 person
Affects Status Importance Assigned to Milestone

Bug Description

I want to suggest three enhancements, which, for me at least, would greatly improve Calibre.

Firstly, it would be useful to specify a TOC title for the PDF output. The ePub and Mobi output both have the ability to specify a title for the table of contents, but the PDF is still missing that feature. If I'm not mistaken, this shouldn't be too hard to implement either.

Secondly, it would be great to have more options when it comes to margins in the PDF output. It's great to be able to specify the left and right margin of the PDF output, but it would be nice to overwrite it with inside and outside margins. In a PDF, inside margins are those on the inside when two opposite pages are shown together (e.g. page 2 and 3). Outside margins are the ones on the outside. It's just another way of looking at the margins and useful if the book is intended for printing an actual book. This might be harder to implement as the PDF engine may need to be altered a bit.

Thirdly, it would be nice to have a heading 1 tag (<h1>) for the title of the ePub TOC output. Currently the output plugin puts the title within a heading 2 tag (<h2>).

Thanks if you choose to implement any of those enhancements!

Option to set pdf toc title will be in next release.

You can style the title for epub/azw3 output however you like using
extra css. Use Tweak Book to see the html/css used for the title. IIRC,
it is:

#calibre_generated_inline_toc h2 {

Fixed in branch master. The fix will be in the next release. calibre is usually released every Friday.

 status fixreleased

Changed in calibre:
status: New → Fix Released
Jonas (jonas96mueller) wrote :

Thank you for including the PDF title!

I realize that I can style the title using the id "calibre_generated_inline_toc", but it would be better if the tag was <h1> and not <h2>. This is because every eReader has its own "stylesheet" to display certain tags. I would like the table of contents title to look identical to any other heading 1.

I guess it would be a greater task to include the PDF margins, but it's definitely something I would like to see in the future. Should I open a separate enhancement request for it, since it may take longer to implement? Or is it not something you plan on implementing?

Thanks again!

I have no interest in implementing custom margins for pdf, so dont
bother opening a separate bug, unless you are willing to submit the code
for it yourself.

Jonas (jonas96mueller) wrote :

What about changing the tag to <h1>?

The PDF margins are certainly important to me, so I will get involved and submit my own code for it.


Kovid Goyal (kovid) wrote :

It has to be some tag, and <h2> makes more sense than <h1>. <h1> is for
book title and <h2> for section title. The ToC is a section. Not to
mention that I dont make behavior changes like that without very good

Jonas (jonas96mueller) wrote :

OK, thank you for the explanation.

In that case, would it be possible to standardize it across all output plugins? I don't mind using all <h2> tags for book sections, but the PDF output plugin (and Mobi too, I think) uses <h1> tags for the table of contents title.


Kovid Goyal (kovid) wrote :


To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers