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

Go Back   MobileRead Forums > E-Book Formats > Kindle Formats

Notices

Reply
 
Thread Tools Search this Thread
Old 05-17-2012, 04:56 PM   #1
Streadmob
Member
Streadmob began at the beginning.
 
Posts: 17
Karma: 10
Join Date: Dec 2011
Device: none
Internal links, and Contents as illustration directory

Hi all –

I’d like to mention an illustration located in another chapter, and allow the reader to click on its name to go to it.

I’d hoped the code used by the Contents would allow this. Surely, if at some point in the code you have:

<p class="contents"><a href="#Preface">Preface</a></p>

...it would produce a clickable example of ‘Preface’, which should take the reader to:

<a name="Preface">

This works in the Contents, but why won’t it work when I use the same structures elsewhere? It looks like it’s going to work but transfers to the next new chapter after where it should have gone. :-(

Also, once I’ve solved that, how would it be to convert the Contents into a list of illustrations? Could it be called something other than Contents?

I’m using Calibre to construct e.g. mobi files from html and it’s going ok.

Cheers...
Streadmob is offline   Reply With Quote
Old 05-17-2012, 07:58 PM   #2
Doitsu
Wizard
Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.
 
Doitsu's Avatar
 
Posts: 2,119
Karma: 4861354
Join Date: Dec 2010
Device: Kindle PW2
Quote:
Originally Posted by Streadmob View Post
I’d like to mention an illustration located in another chapter, and allow the reader to click on its name to go to it. [...]
I’m using Calibre to construct e.g. mobi files from html and it’s going ok.
Calibre is a great converter, but IMHO it's better to create an ePub in Sigil first and then convert the ePub with Calibre or Kindle Previewer.
This has the advantage that you can use Sigil's integrated FlightCrew validator to check for structural errors and other issues before the .mobi conversion.

I'm assuming that you want to use images as chapter headers. If that's the case and all chapters are in the same .html file, you could try the following:

Code:
<h3>TOC</h3>
<p><a href="#ch1">Chapter 1</a></p>
<!-- more TOC entries -->

<h3 id="ch1" title="Chapter 1"><img alt="" src="ch1.JPG" /></h3>
(If you use Sigil, you'll need to use <img src="../Images/ch1.JPG" />, because Sigil stores .html files and images in separate folders.)

BTW, using header tags with title attributes will allow you to automatically generate an .ncx TOC once you're done with the book.
Doitsu is offline   Reply With Quote
Old 05-17-2012, 10:04 PM   #3
Streadmob
Member
Streadmob began at the beginning.
 
Posts: 17
Karma: 10
Join Date: Dec 2011
Device: none
Thanks, Doitsu

My choice is either simply to implement a direct 'click to illustration' facility and then publish, or just publish as is. The Calibre route produces mobi output which seems to work fine on the Kindle Previewer, and the KP will also translate epub Calibre output back to mobi and show that pretty ok too.

I'm not using images as chapter headers, I just want to say "...as shown in fig. 5.1..." for example, and allow them to click on 'fig. 5.1' to get to it.

A regards the code you show, I have tried to get to the bottom of TOC but no explanation I've seen ever seems to make full sense. Calibre seems to produce what's required automatically, and as I say, trying to use the grammar in what seems to be the TOC section in my code doesn't do what it should do. Do you know why?

I do have everything (except images) all in the one html file, but my TOC section starts:

<a name="TOC"/>

and not...

<h3>TOC</h3>

as you show.

Cheers, ...
Streadmob is offline   Reply With Quote
Old 05-18-2012, 02:26 AM   #4
Doitsu
Wizard
Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.
 
Doitsu's Avatar
 
Posts: 2,119
Karma: 4861354
Join Date: Dec 2010
Device: Kindle PW2
Quote:
Originally Posted by Streadmob View Post
My choice is either simply to implement a direct 'click to illustration' facility and then publish, or just publish as is.
I'm still a bit confused about what exactly is going wrong with your book. Image links should work like any other link, provided you used unique link ids that start with a letter. (E.g.<a id="F5.1" /> is fine, but <a id="5.1" /> will cause problems later on.)

For example:

Code:
<p>Once the data point is selected, a window as shown
 in <a href="#F5.1">Fig. 5.1</a> will be displayed.</p>

<p>More text...</p>
<p>More text...</p>
<p>More text...</p>

<p><img id="F5.1" src="5.1.JPG" /></p>
BTW, why don't you simply insert the images immediately after the paragraph that references them?

Quote:
Originally Posted by Streadmob View Post
I do have everything (except images) all in the one html file, but my TOC section starts:

<a name="TOC"/> and not... <h3>TOC</h3>
I enclosed my sample TOC header in h3 tags, because all book headings should be enclosed in header tags; I didn't add a name attribute, because I don't backlink to the TOC from my chapter headings.
Doitsu is offline   Reply With Quote
Old 05-18-2012, 07:27 AM   #5
Streadmob
Member
Streadmob began at the beginning.
 
Posts: 17
Karma: 10
Join Date: Dec 2011
Device: none
Thanks again, Doitsu!

What's going wrong it that I can't find a way to click on something and be transported elsewhere within the book, except in the Contents... and I can't see why the mechanism I try to copy from that, doesn't work.

Thanks for the advice on not starting link ids with a number. Mine do though start with letters.

I do try to put images nearest where they will be most discussed, but an image of a skeleton will contain useful points that multiple chapters will want to refer to.

Thanks,

Streadmob.
Streadmob is offline   Reply With Quote
Old 05-18-2012, 08:46 AM   #6
Doitsu
Wizard
Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.
 
Doitsu's Avatar
 
Posts: 2,119
Karma: 4861354
Join Date: Dec 2010
Device: Kindle PW2
Most likely you made a subtle mistake somewhere in the book. Try converting it to ePub and then check it here.
Also, if possible, post a small excerpt of your book with link problems as an ePub file.
Doitsu is offline   Reply With Quote
Old 05-18-2012, 09:13 AM   #7
Streadmob
Member
Streadmob began at the beginning.
 
Posts: 17
Karma: 10
Join Date: Dec 2011
Device: none
Thanks again. I optioned my Calibre output to epub and sent that file to the epub validator, and got back a massive list of errors about a thousand lines long. (When in the past I've output to epub then converted back to mobi using the Kindle Previewer, it worked ok.)

I downloaded Sigil but it always crashed as I opened it.

And I've got someone else's cat hiding in my attic!

Thanks for all your efforts anyway,

Streadmob.
Streadmob is offline   Reply With Quote
Old 05-18-2012, 09:50 AM   #8
AThirstyMind
A Thirsty Mind
AThirstyMind plays well with othersAThirstyMind plays well with othersAThirstyMind plays well with othersAThirstyMind plays well with othersAThirstyMind plays well with othersAThirstyMind plays well with othersAThirstyMind plays well with othersAThirstyMind plays well with othersAThirstyMind plays well with othersAThirstyMind plays well with othersAThirstyMind plays well with others
 
Posts: 81
Karma: 2546
Join Date: May 2011
Location: Lubec, Maine
Device: Kindle Fire, iPad, iPhone
Why are you not bookmarking your image in HTML, then at the text that you want to use to 'go to' that bookmark (see Figure 5-1), just link it back to the bookmark? I do this all the time and it always works.
AThirstyMind is offline   Reply With Quote
Old 05-18-2012, 02:05 PM   #9
Streadmob
Member
Streadmob began at the beginning.
 
Posts: 17
Karma: 10
Join Date: Dec 2011
Device: none
Hi AThirstyMind –

Well, I think that's what I was trying to do! But I just Googled: bookmarking HTML, and found what I may have been doing wrong. When I should have coded:

<a name="figure517"> </a>

...I actually coded:

<a name="figure517">

I've now added the </a> and it works. But I still haven't been able to get it to go straight to an image; I need that extra label line I've shown above, just before the image, which I jump to using:

<p><a href="#figure517"> click here for fig5.17 </a></p>

. If instead I was wanting to jump to:

<p class="center"><img src="fig517.gif" alt="fig517"></p>

, then the following actually jumps a long way earlier than that, to near or at the start of the file:

<p><a href="#fig517"> click here for fig5.17 </a></p>

.

Aha! It works if I add the name parameter in with the other two image parameters separately:

<p class="center"><img src="fig518.gif" alt="fig518" name="figure518"></p>
...if successfully found by:

<p><a href="#figure518"> click here for fig5.18 </a></p>
.

Anyway, thanks for encouraging me to have another go!

Cheers,

Streadmob







Going back to the possibility of converting the Contents list to a list of illustrations, my Contents starts:

<h1>Contents</h1>
<p class="contents"><a href="#Flyleaf/Back cover">Flyleaf/Back cover</a></p>
<p class="contents"><a href="#Preface">Preface</a></p>
<p class="contents"><a href="#Introduction">1 Introduction </a></p>

etc.

It looks like I'm allowed to change the 'Contents' to 'List of Images' , and then just put the image names and labels in. I just hope that won't mess things up if and when I produce an epub file instead of a mobi. ??
Streadmob is offline   Reply With Quote
Old 05-21-2012, 02:30 PM   #10
DaleDe
Grand Sorcerer
DaleDe ought to be getting tired of karma fortunes by now.DaleDe ought to be getting tired of karma fortunes by now.DaleDe ought to be getting tired of karma fortunes by now.DaleDe ought to be getting tired of karma fortunes by now.DaleDe ought to be getting tired of karma fortunes by now.DaleDe ought to be getting tired of karma fortunes by now.DaleDe ought to be getting tired of karma fortunes by now.DaleDe ought to be getting tired of karma fortunes by now.DaleDe ought to be getting tired of karma fortunes by now.DaleDe ought to be getting tired of karma fortunes by now.DaleDe ought to be getting tired of karma fortunes by now.
 
DaleDe's Avatar
 
Posts: 9,777
Karma: 5072196
Join Date: Aug 2007
Location: Grass Valley, CA
Device: EB 1150, EZ Reader, Literati, iPad 2
By the way name= is now destandardized. It should be id=
If Flyleaf is a folder then the # should be removed in your example. # is only a link within a file at the source level.

Dale
DaleDe is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Internal Links best Practices Jamestoo ePub 2 02-26-2012 12:26 PM
Directory contents & opening books through kindlets firefoxpdm Kindle Developer's Corner 5 08-10-2011 11:28 AM
Links to URLs work, internal links don't? NewDay ePub 36 10-27-2010 05:09 AM
Is there a way to browse the Kindle contents by directory? sweevo Amazon Kindle 1 09-15-2010 05:07 PM
Internal Links??? Guns4Hire PocketBook 11 04-18-2010 03:25 AM


All times are GMT -4. The time now is 11:35 PM.


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