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 06-18-2011, 02:25 PM   #16
Hitch
Bookmaker & Cat Slave
Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.
 
Hitch's Avatar
 
Posts: 11,447
Karma: 157030631
Join Date: Apr 2010
Location: Phoenix, AZ
Device: K2, iPad, KFire, PPW, Voyage, NookColor. 2 Droid, Oasis, Boox Note2
Quote:
Originally Posted by Christopher Wood View Post
It is fully reflowable. Try it! That's why I posted the .prc.

The numbering and lettering themselves are actually hard-coded, not generated at view time by an OL element. However, I am assuming that by the time a piece of text gets to the stage of formatting for the Kindle, it's pretty much finalized, and the numbers aren't going to change. So who cares if it's not an OL with on-the-fly numbering?
Hi:

I did try it--anyone who codes for Mobi would do so. I don't disagree that it looks good in Previewer (for K2, K3), but my point was that while yes, it reflows...it's not resizable, which is always a pain. It seems pretty clever, but it's all hand-coding. We've done similar, multi-level indented TOC's with tables, when we've had clients who've insisted on TOC's with hanging-indent-style "paragraphs" as the titular description of their numbered entry. (Even though Mobi is not supposed to use tables for its toc...we've made it work when we've had to).

There are no "Mobi developers," really, now; Amazon is developing KindleGen and MobiGen, and perhaps they'll manage to do something with the ol & ul issues...but both really only work at the left margin.

However, nicely done with your outline. It's something I'll tuck away for future reference. It's a clever workaround.

HTH,
Hitch
Hitch is offline   Reply With Quote
Old 06-18-2011, 02:40 PM   #17
Christopher Wood
Enthusiast
Christopher Wood began at the beginning.
 
Christopher Wood's Avatar
 
Posts: 28
Karma: 10
Join Date: May 2011
Device: Kindle 3
The problem with tables is that the Kindle won't pagebreak in a cell. Any long TD will simply render past the bottom edge, and no one will be able to read it. So, I didn't use tables here.

I wish the numbers were resizable, but I don't know how to do that. At least I got all the text to resize & reflow properly, sans tables.

I'd be enjoyed beyond utterance if somebody had a better solution.
Christopher Wood is offline   Reply With Quote
Advert
Old 06-18-2011, 03:01 PM   #18
Hitch
Bookmaker & Cat Slave
Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.
 
Hitch's Avatar
 
Posts: 11,447
Karma: 157030631
Join Date: Apr 2010
Location: Phoenix, AZ
Device: K2, iPad, KFire, PPW, Voyage, NookColor. 2 Droid, Oasis, Boox Note2
Yes, we'd all be thrilled if there were a better solution, and I know that tables won't pagebreak in a cell. It's frustrating. I know you didn't use tables--I see what you did. Like I said, it's clever. Outlines and indented lists are the bane of mobi...well, that and tables, LOL!!

Best,
Hitch
Hitch is offline   Reply With Quote
Old 06-18-2011, 03:32 PM   #19
Christopher Wood
Enthusiast
Christopher Wood began at the beginning.
 
Christopher Wood's Avatar
 
Posts: 28
Karma: 10
Join Date: May 2011
Device: Kindle 3
Sorry, I'm speaking not directly to you, Hitch, you who rather obviously know the details of what's going on here; I am trying to speak also to those who (like me, a day or two ago) are wandering through the arid wilderness of Mobi support on the web, looking for some water and an outdent solution. I want to be explicit and general enough for everybody. No offense intended!
Christopher Wood is offline   Reply With Quote
Old 06-18-2011, 03:32 PM   #20
Christopher Wood
Enthusiast
Christopher Wood began at the beginning.
 
Christopher Wood's Avatar
 
Posts: 28
Karma: 10
Join Date: May 2011
Device: Kindle 3
source code & theory

Theory behind the source code:

A boiled-down overview of the challenge:
There's nothing similar to a CSS's position:relative in Mobi; there's only positive or negative "width," which becomes (positive) all-paragraph block indent or (negative) block indent with first-line outdent that goes all the way back to the left edge, always, period. For an outdent used as a numbered list or hanging asterisks such as footnotes, we're left with the problem of making the first character of the following text line up with the following lines, and also of positioning the list-numbering or the footnote asterisk to the left of the block. The reader (human operator of the ereader hardware) can change font size at will, and the only thing we can have in that outdented space is characters (HTML has rarely known "tabs," and never well), so the problem becomes how to match the total width of the first line's outdented characters with the block indent (the negative "width") of the following lines; and we must achieve a solution that allows us to use any characters we want in that space, and still know their width: we might want * or ** or iv. or who-knows-what. And before you say, "just use a table!" note that the Kindle won't pagebreak in a table cell, so if you have a long list element or footnote, it'll render off the bottom edge of the screen, unreadable no matter what you do.

My solution is multifold.

First, to guarantee that we know the width of the outdented characters, we (a) use a <CODE> tag to force the text into a monospace font, and then a <FONT SIZE="-99"> tag to force the ereader hardware (this is for Kindle 3, remember) to use its smallest font size, no matter what size the (human) reader has set his Kindle for. (You'd think, because the Kindle only has 8 font sizes, that SIZE="-7" would be enough; but -7 and even -9 both embiggen when the Kindle is set for very large type; so, if I must go beyond the single digit of -9, I'll go all the way to -99, which works.) These smallest characters, I call "tmc" for "tiny monospace characters."

Next, having made careful measurements and determined that a tmc is 11points wide at all times, no matter what font size or face the Kindle is set for, we set the paragraph's (negative) width to some multiple of 11: say, <p width="-66pt">, which outdents the first line by 6tmc. (Using ems results in variable indent widths depending on Kindle font size settings, but pts is a fixed unit.)

Lastly, we add the appropriate number of tmcs to the beginning of the outdents paragraph. Call that number, X (here, 6). The last tmc will be a &nbsp;, so that our outdented text doesn't crash into the first character of the block. That leaves X-1 tmcs to fill (here, 5). Some of those will be our outdented text -- say, iv. or some such object -- from the X-1 we subtract that number of tmcs (here, 3), leaving some number (here, 2) to fill in with more &nbsp; characters. And we must use &nbsp;, because, despite the <CODE> tag, multiple plain spaces don't render, as we might expect with HTML's <pre>. Go figure.

We end up with a left-indented block of text, rendered in whatever font face & size the Kindle is set for, with some outdented text, consistently right-aligned, albeit rendered in the Kindle's smallest size, in its monospace font.

Not a perfect solution -- rather old-school -- but it's all text, no tables, no images (III.jpg hahaha), fully reflowable and resizable (except the outdented text). Until Mobi better supports <OL> types and values, and/or tables, this is all I've got. At least it works!

Source code:

Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http: //www.w3.org/TR/html4/strict.dtd">
<html lang="EN-US">
<head>
<meta http-equiv="Content-Type" content="text/html">
<title>Acid Test 213x</title>
</style>
</head>
<body>
 
<p width="0">A Roman-numeral list. Try it at any font size or face. All numerals should remain right-aligned, all lists elements left-aligned.
<p width="0">&emsp;This is a <i>Kindle3-specific effort</i>. It is not intended as a universal Mobi solution because the diverse Mobi readers render formatting so differently from device to device.</p>
	<p width="-66"><font size="-99"><code>&nbsp;&nbsp;&nbsp;I.&nbsp;</code></font>This is the first list element.</p> 
	<p width="-66"><font size="-99"><code>&nbsp;&nbsp;II.&nbsp;</code></font>This is the second list element. This one is very long to cause line wrap. Lorem ipsum, lorem ipsum, lorem ipsum, lorem ipsum!</p> 
	<p width="-66"><font size="-99"><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code></font>&emsp;This second element has a second paragraph, of which the first line is indented. Lorem ipsum!</p> 
	<p width="-66"><font size="-99"><code>&nbsp;III.&nbsp;</code></font>This is the third list element.</p> 
	<p width="-110"><font size="-99"><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;a.&nbsp;</code></font>This is the third list element's first subpoint.</p> 
	<p width="-110"><font size="-99"><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;b.&nbsp;</code></font>This is the third list element's second subpoint.</p> 
	<p width="-154"><font size="-99"><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;i.&nbsp;</code></font>This is the nitty gritty stuff! a third level.</p> 
	<p width="-154"><font size="-99"><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ii.&nbsp;</code></font>More nitty gritty. Who reads it? Same people who read the fine print on contracts.</p> 
	<p width="-154"><font size="-99"><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code></font>&emsp;This is a second paragraph of the nitty gritty, with a first-line indent.</p> 
	<p width="-110"><font size="-99"><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;c.&nbsp;</code></font>I've had enough of this now.</p> 
<p width="0">&emsp;The above multi-level list should format well at any font size or face. All numerals should remain right-aligned, all lists elements left-aligned.
 </body>
</html>
Christopher Wood is offline   Reply With Quote
Advert
Old 06-18-2011, 03:36 PM   #21
Christopher Wood
Enthusiast
Christopher Wood began at the beginning.
 
Christopher Wood's Avatar
 
Posts: 28
Karma: 10
Join Date: May 2011
Device: Kindle 3
The astute formatter will note that this solution offers a very easy method for formatting poetry and song lyrics, which usually require fixed outdents when lines wrap, and multiple block indents for verses (say, 3em hanging by 1em) and choruses (say, 5em hanging by 1em). In fact, the formatting becomes even simpler, because you don't need the tmc at all -- you can just use <p width=-(#)em> and lead-in with &emsp;. It works great, trust me! If you can't figure it out, I'll post source code.

Last edited by Christopher Wood; 06-18-2011 at 08:18 PM.
Christopher Wood is offline   Reply With Quote
Old 06-18-2011, 04:01 PM   #22
Christopher Wood
Enthusiast
Christopher Wood began at the beginning.
 
Christopher Wood's Avatar
 
Posts: 28
Karma: 10
Join Date: May 2011
Device: Kindle 3
I just noticed, I left the "pt" out of the width attribute values. Apparently, it defaults to pt, or maybe px is the same as pt. Who knows ... I'm rather braindead after all the trials. Anyway, at least it works reliably.
Christopher Wood is offline   Reply With Quote
Old 06-20-2011, 05:33 AM   #23
HarryT
eBook Enthusiast
HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.
 
HarryT's Avatar
 
Posts: 85,544
Karma: 93383043
Join Date: Nov 2006
Location: UK
Device: Kindle Oasis 2, iPad Pro 10.5", iPhone 6
Quote:
Originally Posted by Christopher Wood View Post
In fact, the formatting becomes even simpler, because you don't need the tmc at all -- you can just use <p width=-(#)em> and lead-in with &emsp;. It works great, trust me! If you can't figure it out, I'll post source code.
Yes, that's exactly the way that I indent poetry in my Mobi books.
HarryT is offline   Reply With Quote
Reply

Tags
kindle, lettered, list, mobi, ordered list

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Ordered lists and ADE dynabook Sigil 3 01-27-2011 04:53 AM
Book Lists ballast Calibre 3 08-14-2010 02:46 PM
Authors' Lists? LadyLou Calibre 2 02-07-2010 03:06 PM
Save for Later replaced with Wish Lists RobbieClarken Amazon Kindle 0 12-08-2009 12:09 PM
Managing wish lists Elsi Amazon Kindle 5 02-28-2009 03:20 PM


All times are GMT -4. The time now is 04:05 PM.


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