View Full Version : Right Aligning Wrapped Text Only


ghostyjack
11-03-2010, 07:10 AM
I'm putting together some poetry epubs and using PDF's of the original books from archive.org and they show that when a particular line is too long for the page they wrap it (as with any long line) but the wrapped text is right-aligned while the rest of the text is left-aligned.

Now if I was only producing the epubs for a single device I could split the line at the point it reaches the far edge and then right-align the last part.

Unfortunately I was planning on uploading them here so there is no way of knowing what devices they will be displayed on so the above mentioned technique wouldn't work.

So, does anyone know how I could set a line to be left-aligned but have a right-aligned wrapping if the line has to wrap?

Jellby
11-03-2010, 11:35 AM
Now if I was only producing the epubs for a single device I could split the line at the point it reaches the far edge and then right-align the last part.

Even if it were for a single device, it would also be for a single font size, orientation, etc.

So, does anyone know how I could set a line to be left-aligned but have a right-aligned wrapping if the line has to wrap?

It's not possible with XHTML+CSS, but I've suggested (http://www.daisy.org/epub/issues/special-alignment-option-poetry) it to the ePUB board as a possible enhancement.

ghostyjack
11-03-2010, 03:16 PM
Damn it! Oh well lets hope they pick it up for the next update to the spec.

I really do not want to have the text in my poetry books to left-align on a wrap as this was not in the layout for the author when they wrote the poem, so it should not be used in ebooks either. Right-aligning wrapped text is a widely used convention for poetry and the ebooks should comply with it.

charleski
11-03-2010, 03:58 PM
I think a slightly more common convention is to use hanging paragraphs.

.poetry {
margin-left: 1.5em;
text-indent: -1.5em
}

See, for instance, the bottom picture here (http://www.npr.org/blogs/thetwo-way/2010/10/06/130381876/publishers-weekly-editor-spots-egregious-formatting-problems-in-poetry-e-books). Of course, some poetry authors have very specific requirements, some of which can't be handled by css2.

Jellby
11-04-2010, 06:26 AM
I think a slightly more common convention is to use hanging paragraphs.

See, for instance, the bottom picture here (http://www.npr.org/blogs/thetwo-way/2010/10/06/130381876/publishers-weekly-editor-spots-egregious-formatting-problems-in-poetry-e-books).

That looks like unconventional poetry (very long lines) to me. "Traditional" poetry tends to have shorter lines, that usually fit in the page and only exceptionally need to be broken. The printing/typesetting conventions probably change between languages and countries, but over here the most common way to solve wrapping in poetry is right-aligning the wrapped part with a "[" before it.

Anyway, even if this need is addressed in a coming spec version, we'd have to wait for reading systems to support it...

charleski
11-04-2010, 07:15 AM
The printing/typesetting conventions probably change between languages and countries, but over here the most common way to solve wrapping in poetry is right-aligning the wrapped part with a "[" before it.


Hanging indents are definitely the norm in English, though as you say this may vary in other languages.

Ken Irving
11-04-2010, 09:35 AM
Charleski has it exactly right. A hanging indent (also called an outdent or undent) is the proper way to do it, unless of course ghostyjack really does want to right align the overlapping lines, which seems to me a whole different thing. Using the CSS poetry snippet above will indent the wrapped lines and reflow them no matter what the reader or font size. The only extra I might add would be "!important" to force the reader/browser/app to recognize the hanging indent. By the way, that Publishers Weekly example of a mangled "Howl" seems all too typical of ebooks right now. I've come across some very nicely formatted ones, but get the impression that a lot of ebooks of print editions are nothing more than document dumps done by people who don't have a clue and don't care. Apparently this thoughtless 1200-page edition of Ginsberg is a prime example.

ghostyjack
11-04-2010, 09:54 AM
It's not that I want to right-align the text, but if the original text is right-aligned for the wrapping, the ebook should be as well.

A lot can be lost if you do not stick to the original formatting.

As epub is supposed to be a universal format that can handle a wide variety of book types (fiction, non-fiction, reference, etc), then there should be some consideration of the different forms of poetry as it is a major type of book.