Mobileread
cross-referencing in an EPUB?
#1  daudvyd 07-05-2022, 08:23 PM
I'm writing with Sigil. I'd like to automatically number figure captions using a CSS counter and then reference that counter in inline content such as "...see Figure 4..." where the number "4" is automatically produced and updated as I add more figures and shuffle their order. My understanding from these examples is that I can use an id tag to identify which figure caption I want to reference and target-counter to get the counter. The code below numbers the figure captions, but cannot get those numbers afterward to put inline. So, (1) I've written it incorrectly, (2) Sigil does not implement this CSS feature, or (3) both (1) and (2). Can anyone help?

Code
<p>See Fig <a href="#fig3items">000</a></p>
<figure>
<ul>
<li>item1</li>
<li>item2</li>
<li>item3</li>
</ul>
<figcaption id="fig3items">Three Items</figcaption>
</figure>
Code
body {
counter-reset: chapter;
counter-reset: figure;
counter-increment: chapter 5;
}
figure figcaption {	counter-increment: figure;
}
figure figcaption:before {	content: "Figure " counter(chapter) "-" counter(figure) ": ";
}
a::after { content: target-counter(attr(href, url),figure)}
Reply 

#2  Hitch 07-06-2022, 10:59 AM
Well....

Firstly, honestly, writing WITH Sigil is generally a bad idea. It's not a word processor and it does not have most of the functionality that even basic word processors use--like automatically numbering figures.

Secondly, "figure" is not supported in about half of all ePUB-reading software/devices.

Hitch
Reply 

#3  Hitch 07-06-2022, 10:59 AM
Oh, and I'd also suggest you move this to the Sigil forum--ask one of the mods to do it.

Hitch
Reply 

#4  daudvyd 07-06-2022, 11:20 AM
Thank you. What do you personally use for writing ebooks?
Reply 

#5  Hitch 07-06-2022, 11:37 AM
Quote daudvyd
Thank you. What do you personally use for writing ebooks?
ANY Word processor would be better. Word, if you're MSFT-inclined, especially--especially--if you're going to use figures, captions, cross-referencing, etc. I can't emphasize that enough. For example, Pages, which is an Apple/Mac product, doesn't do indexing at all, so you don't want that (presumably).

So, in my personal order of preference, MSFT Word, which is truly the most advanced, followed by Libre Office, which is, all things considered, nearly as advanced as Word (and can also export to ePUB, by the way, which Word as yet does not do).

(n.b./caveat: I'm not a published author, in the sense you're thinking. I've written millions of technical words, how-to manuals, legal docs with x-refs, etc. over the years. I currently own a company that makes eBooks--over 7K of them to date--and print design for paperbacks and hardcovers. So, I have a more-than-passing acquaintance with the HTML and CSS of eBooks.)

You can then export to HTML (filtered HTML, from Word) and open that in Sigil, if you're so inclined. But seriously, the functionality you're seeking--that's a massive uphill battle for eBooks and what will you do, when you export the HTML/ePUB, into devices that won't support count? It'll be a gigantic MESS.

Do that heavy lifting, renumbering with tags, references, etc. in the word processor. When it's all finalized, THEN export to ePUB/HTML. Trust me on this.

Hitch
Reply 

#6  daudvyd 07-06-2022, 01:57 PM
Thanks Hitch. Have you tried technical writing with OxygenXML using DITA? If so, how does that approach compare with exporting from MS Word?
Reply 

#7  Hitch 07-06-2022, 05:56 PM
Quote daudvyd
Thanks Hitch. Have you tried technical writing with OxygenXML using DITA? If so, how does that approach compare with exporting from MS Word?
Do you mind, before I answer this, if I ask what you're doing, precisely? May I ask why you are using DITA? Specifically? I mean...don't get me wrong, but you are sure going about this the bloody hard way.

So, what is it, PRECISELY, that you are creating? I don't mean you have to violate confidentiality agreements or the like, but DITA is a framework. I mean...what is the form of markup that you're trying to deploy here? Presumably, you're trying to, what, map new content or element types? is that what you're doing? And you were planning to do that in Sigil, manually?

MODS, we really need to move this to the Workshop, rather than Sigil. (daudvyd, don't worry, I'll ask them).

Hitch
Reply 

#8  daudvyd 07-06-2022, 08:10 PM
I'm writing a role-playing game book (like Dungeons & Dragons) and would like -- if possible -- to produce an ebook (EPUB, MOBI, etc) and a print-ready PDF with more complex formatting from a single source. I'd like figures & cross-references, TOC, and indexes to be handled through markup rather than manually constructed. I may have a person index, technology index, spell index, etc. I'm not sure what the native format should be to allow maximum flexibility.
Reply 

#9  Hitch 07-07-2022, 01:49 AM
Quote daudvyd
I'm writing a role-playing game book (like Dungeons & Dragons) and would like -- if possible -- to produce an ebook (EPUB, MOBI, etc) and a print-ready PDF with more complex formatting from a single source. I'd like figures & cross-references, TOC, and indexes to be handled through markup rather than manually constructed. I may have a person index, technology index, spell index, etc. I'm not sure what the native format should be to allow maximum flexibility.
Well...Word and Libre Office ("LO") both do that. Open Office ("OO") may, but LO is better maintained and supported. Most of what you're discussing is WHY word processing exists. I mean...they're not just electronic typewriters.

There really isn't any reason for you to dive into DITA. In something like Word, for example, you build almost everything through the use of headings, styles, field codes, and cross-references. You can create multiple indices, although that will take a bit of doing. BUT, you can't do any of it if you treat Word like a typewriter--you need to learn Styles & Headings; cross-referencing; indexing, building TOCs automatically, and working comfortably in outline mode. With those, you should be able to do everything you wish.

DITA...DITA is all well and good, but as I said, it's a framework, not a pre-made platform. Sure, you could do all the work and the brain damage, but I'm not certain it would do anything but CAUSE you work.

As far as a "single-source." Look--nothing does that. NOTHING. (You're talking the Holy Grail of bookmaking, just FYI. Those that claim that they have this are sacrificing a lot to get a single-source file. You can't do it with LaTEX--oh my GOD, you haven't suffered until you try to create an eBook from LaTeX).

You create a master document in Word. (Or LO, whatever.) You then create whichever format you want first--typically print. You create your TOC with the print requirements (page numbers, usually with dot leaders for a non-fiction sort of thing), and then, when you export your PDF, you then remove that TOC and recreate it for the eBook--this is basically push-button, you understand!!!--without page numbers, using links instead, which is what drives the NCX, etc. in ePUB. You also remove running headers, folios (page numbers), and any footers. Then from LO, you export an ePUB; from Word, you export filtered HTML and then you put that filtered HTML into Sigil and build an ePUB.

There's no point in building a MOBI any longer. Amazon no longer accepts mobi. If you want one to put on your own device, to sideload and preview, then you can export one from Kindle Previewer 3, and sideload it. Done and dusted.

Hitch
Reply 

#10  Pierre Lawrence 07-07-2022, 05:58 AM
Don't you still need mobi for legacy reasons, i.e., for readers having early versions of the Kindle? Does amazon still offer that format for these readers?
Reply 

  Next »  Last »  (1/4)
Today's Posts | Search this Thread | Login | Register