|  03-30-2010, 09:01 PM | #1 | 
| Captain Courageous   Posts: 239 Karma: 102 Join Date: Apr 2009 Device: calibre, PRS 505 |  Book, Part, Chapter 
			
			I use a txt file and convert that to epub. When I have a book title and chapter symbols I use # for the title, ##chapter using markdown everything works fine. The problem occurs when I have a book broken down into parts and further broken down into chapters. I have tried using # for the title ## for the parts and ### for the chapters but it doesn't work. Calibre just doesn't seem to recognize the triple #'s. Can anyone help me? TIA, Paul   | 
|   |   | 
|  03-30-2010, 09:25 PM | #2 | 
| creator of calibre            Posts: 45,604 Karma: 28548974 Join Date: Oct 2006 Location: Mumbai, India Device: Various | 
			
			That's strange. Can you attach a test case.
		 | 
|   |   | 
| Advert | |
|  | 
|  03-30-2010, 11:09 PM | #3 | 
| Captain Courageous   Posts: 239 Karma: 102 Join Date: Apr 2009 Device: calibre, PRS 505 | 
			
			Ok I have shortened the file to a couple of parts and the chapters to two or three. I am using the latest version of Calibre .6.45. I am using the program itself to convert, selecting Markdown in Text input. As you can see, the parts are in the TOC because of ## but the chapters are missing. I used ### in front of the chapter headings | 
|   |   | 
|  03-31-2010, 12:29 AM | #4 | 
| creator of calibre            Posts: 45,604 Karma: 28548974 Join Date: Oct 2006 Location: Mumbai, India Device: Various | 
			
			If you want page breaks before the ### elements you have to change the  insert page breaks before setting to //*[name()='h1' or name()='h2' or name()='h3'] | 
|   |   | 
|  03-31-2010, 01:24 AM | #5 | 
| Captain Courageous   Posts: 239 Karma: 102 Join Date: Apr 2009 Device: calibre, PRS 505 | 
			
			I just want the chapter names to show in the TOC. As it is only part names(the ones with##) are showing in the TOC I thought the hash marks would indicate to the parser that a ###Chapter is to be placed in the TOC below the Part name or number that begins with ##. That doesn't seem to be the case here.
		 | 
|   |   | 
| Advert | |
|  | 
|  04-01-2010, 01:53 AM | #6 | 
| Captain Courageous   Posts: 239 Karma: 102 Join Date: Apr 2009 Device: calibre, PRS 505 | 
			
			I was able to get the chapters but not the parts listed in the TOC in a RTF file by using //h3 in the preferences. Well I guess this problem is so far down in the list it will never get solved sigh...... | 
|   |   | 
|  04-01-2010, 02:18 AM | #7 | 
| creator of calibre            Posts: 45,604 Karma: 28548974 Join Date: Oct 2006 Location: Mumbai, India Device: Various | 
			
			What happens is the following: # gets turned into h1 ## gets turned into h2 ### gets turned into h3 By default calibre creates a TOC base donly on h1 and h2 If you want to create one based on h3 as well, you have to explicitly tell it so, via the level 1/2/3 TOC options, as I outlined above | 
|   |   | 
|  04-01-2010, 04:44 PM | #8 | |
| Captain Courageous   Posts: 239 Karma: 102 Join Date: Apr 2009 Device: calibre, PRS 505 | Quote: 
 Title rendered by h1 or # Part one as h2 or ## Chapter one as h3 or ### Chapter Two as h3 or ### Chapter Three as h3 or ### Part Two as h2 or ## Chapter One as h3 or ### Chapter Two as h3 or ### It may be that Calbre simply can't do this or that it was not written to do this. This is the way the TOC would appear in a paper book. It also may be that it can be done with css? Thanks, Paul | |
|   |   | 
|  04-01-2010, 08:13 PM | #9 | |
| US Navy, Retired            Posts: 9,897 Karma: 13806776 Join Date: Feb 2009 Location: North Carolina Device: Icarus Illumina XL HD, Kindle PaperWhite SE 11th Gen | 
			
			Let me preface this by saying I have never attempted this before.   I took your Test Case text file, followed Kovid's suggestion as quoted above. To avoid confusion I attached an image of the settings I used. Quote: 
 I also attached the ePub it created. Isn't this what you asked for? Last edited by DoctorOhh; 04-01-2010 at 08:16 PM. | |
|   |   | 
|  04-01-2010, 10:42 PM | #10 | 
| Captain Courageous   Posts: 239 Karma: 102 Join Date: Apr 2009 Device: calibre, PRS 505 | 
			
			Yes that's exactly what I wanted. Why can't it work for me? Here is the setting I used, as cut and pasted into this post. (1) This under "Detect Structure: Detect Chapters at(xpath expression) //*[((name()='h1' or name()='h2' or name()='h3') and re:test(., 'chapter|book|section|part\s+', 'i')) or @class = 'chapter']All I did was add "or name()='h3' to the default line. (2) In "Table of Contents" I just added //h3 (3) in Text Input I checked "Use Markdown" Isn't this the same as you and Kovid said was what to do? | 
|   |   | 
|  04-01-2010, 11:13 PM | #11 | |
| US Navy, Retired            Posts: 9,897 Karma: 13806776 Join Date: Feb 2009 Location: North Carolina Device: Icarus Illumina XL HD, Kindle PaperWhite SE 11th Gen | Quote: 
 I didn't put anything in the "Table of Contents" area. I left it blank. Kovid said to do one thing, so that's what I did. I thought I saw you say you didn't want pagebreaks so I did change that to none (see previous image). I selected this too. No, but I hope you understand now. I'm glad this solution does what you want.   Last edited by DoctorOhh; 04-01-2010 at 11:15 PM. | |
|   |   | 
|  04-01-2010, 11:57 PM | #12 | 
| Captain Courageous   Posts: 239 Karma: 102 Join Date: Apr 2009 Device: calibre, PRS 505 | 
			
			hi! thanks for answering so quickly and thanks for taking the trouble to troubleshoot my code. You know, when I was composing that last post, I looked back and saw that Kovid just had an abbreviated line of code and I wondered, but just thought he didn't want to put the whole thing there. I guess all that chapter stuff can't be there if you want the TOC to be hierarchical in form. I havn't tried it yet but I'm sure the solution is what you said. It sure makes sense. Thanks,  Paul | 
|   |   | 
|  | 
| 
 | 
|  Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post | 
| OpticBook 3600 Book Scanner Review - Part I | Bob Russell | Workshop | 68 | 01-28-2011 09:17 AM | 
| Removing part of a book :( | Katdragon | Sigil | 3 | 07-10-2010 08:44 AM | 
| MobiDeDRM removes part of the book?? | highwaykind | Kindle Formats | 4 | 04-04-2010 02:26 PM | 
| Only part of a Mobi book converting? | AFK_Matrix | Calibre | 3 | 02-07-2010 07:57 PM | 
| I need your help, users of e-book readers: Part 2... | PEAL | Which one should I buy? | 1 | 08-03-2009 03:46 AM |