View Full Version : Hanging indents?


llasram
01-02-2009, 02:30 PM
Hi,

I'm trying to figure if it's possible & how to have hanging indents in Mobipocket books. The Mobipocket developer documentation (http://www.mobipocket.com/dev/article.asp?BaseFolder=prcgen&File=justification.htm) suggests that negative paragraph indentation is possible, but nothing I've tried has actually rendered a hanging indent in Mobipocket Reader Desktop 6.2. Mobigen mangles a negative CSS 'text-indent' into a negative "width" attribute, but no combination of <blockquotes> and <p> tags with various "width" attributes has produced a hanging indent for me.

Any ideas?

-Marshall

kovidgoyal
01-02-2009, 02:35 PM
A table with no cell borders?

llasram
01-02-2009, 02:45 PM
A table with no cell borders?

I'm not quite seeing it... The way I'm understanding that, it could work if the "hanging" vs. "indented" parts are already in separate block-level elements, but I can already handle that with separate <p> and <blockquote> tags (<blockquote> being Mobipocket speak for 'margin-left: 1em').

wallcraft
01-02-2009, 02:56 PM
Does Hanging Indents (http://www.mobipocket.com/forum/viewtopic.php?t=13418) at the Mobipocket Forums help? Note that mobi_cs1 indicates that "em" support is broken.

kovidgoyal
01-02-2009, 03:01 PM
I'm not quite seeing it... The way I'm understanding that, it could work if the "hanging" vs. "indented" parts are already in separate block-level elements, but I can already handle that with separate <p> and <blockquote> tags (<blockquote> being Mobipocket speak for 'margin-left: 1em').

You'd have to do the splitting manually, of course. So


<p>blah blah blah</p>

would become

<table><tr><td>blah></td><td>blah blah</td></tr></table>

Jellby
01-02-2009, 04:03 PM
I'm trying to figure if it's possible & how to have hanging indents in Mobipocket books.

According to the documentation, <p width="-2em">Paragraph text</p> should do that, but I gather you've already tried that, and I seem to remember I tried it some time ago and it didn't work, at least in the Cybook and in my version of the desktop reader.

llasram
01-02-2009, 04:06 PM
Does Hanging Indents (http://www.mobipocket.com/forum/viewtopic.php?t=13418) at the Mobipocket Forums help? Note that mobi_cs1 indicates that "em" support is broken.

I had seen that, but I took another look and tried a few more things, and the results are just short of unbelievable:


<p width="-24pt"> creates a paragraph with a hanging indent.
<p width="-24px"> is ignored -- the author of the cited post must have meant width="-30pt" instead of width="-30px".
<p width="-1em"> creates a paragraph with a hanging indent at some font sizes, but not at others. As I zoom in and out, the "outdented" initial line moves back and forth seemingly at random.


What the hell, Mobipocket? :)

AlexBell
01-05-2009, 04:57 AM
From an external CSS file:
.indented {
margin-left: 2.5em;
margin-right: 2.5em;
}

From the XHTML file:
<p class="indented">

I realise that this is not a hanging indent - it indents all the text in the paragraph - but it does work.

Regards, Alex

pdurrant
01-05-2009, 06:37 AM
I done a few experiments using the latest Mobipocket Creator, and then examining the html actually in the created file.

Fractional em sizes don't seem to work at all for anything - you can have 0em, 1em, 2em, etc. But 0.5em doesn't work - it just rounds to 1em

Specifying as point sizes just gets converted to pixel sizes, assuming 96ppi pixels. e.g. 50pt gets converted to 67px (or just 67 - in the absence of units, pixels seem to be assumed.

Specifying negative em for the indent doesn't work. It indents second and subsequent lines correctly, but doesn't hang the first.

When I've specified using pt or px, it has worked.

It looks like the feature isn't fully debugged yet. A work in progress, seeing as it only appeared in Mobipocket Reader 6.

Fascinating how the HTML generated includes a blank div between paragraphs, to enable inter-paragraph spacing to be set, even when the spacing is set to 0.

Goodness - I hadn't realised Mobipocket's rendering engine was quite so non-standard. Mobipocket Creator does a lot of work converting from standard HTML+CSS to Mobipocket's HTML dialect.


I had seen that, but I took another look and tried a few more things, and the results are just short of unbelievable:


<p width="-24pt"> creates a paragraph with a hanging indent.
<p width="-24px"> is ignored -- the author of the cited post must have meant width="-30pt" instead of width="-30px".
<p width="-1em"> creates a paragraph with a hanging indent at some font sizes, but not at others. As I zoom in and out, the "outdented" initial line moves back and forth seemingly at random.


What the hell, Mobipocket? :)

mtravellerh
01-05-2009, 07:00 AM
From an external CSS file:
.indented {
margin-left: 2.5em;
margin-right: 2.5em;
}

From the XHTML file:
<p class="indented">

I realise that this is not a hanging indent - it indents all the text in the paragraph - but it does work.

Regards, Alex

No, it does not Alex. What happens is that you have a body that has larger margins than normal. For this to be working to some extent, you have to have those hanging indents all over the text without exception.

I wonder to what extent the hanging indents, if at all feasible, are portable to other formats (epub should be no prob, but LRF and IMP?) That is always very important for me. I prefer "my" books to have largely the same look and feel in all the formats.

Jellby
01-05-2009, 07:00 AM
Fascinating how the HTML generated includes a blank div between paragraphs, to enable inter-paragraph spacing to be set, even when the spacing is set to 0.

Huh? Why does it do that, if it could set the spacing with <p height=...>? Smart programs are so stupid... :D

kovidgoyal
01-05-2009, 11:59 AM
No, it does not Alex. What happens is that you have a body that has larger margins than normal. For this to be working to some extent, you have to have those hanging indents all over the text without exception.

I wonder to what extent the hanging indents, if at all feasible, are portable to other formats (epub should be no prob, but LRF and IMP?) That is always very important for me. I prefer "my" books to have largely the same look and feel in all the formats.

LRF supports hanging indents and even drop caps.