turn off automatic justification, when left align justification is turned on.

Hello everyone,
Not a native speaker, but I try my best to write correctly:

I write poems.
After I compiled some poems into the epub format I noticed that short poem lines are justified throughout the line. Only of the line is approx. less than half filled will the spacing jump to regular left aligned word spacing.

How do I completely turn off justification?

I want to publish around 20 poems on kindle competitors.

I tested with the native mac os books app.

Epub and kindle (.mobi) formats are adapted to ebook readers, and in those the user can decide if they want to have the text left aligned or justified, and also font, font size, line space, margins to some extent, etc. If you want to have full control of the way the text looks, don’t use .epub or .mobi format.

For the reason lunk explained, Scrivener intentionally removes alignment settings for body text in ebooks. Some book vendors will even reject a book that tries to force paragraph alignment formatting. But it is worth trying, for something like poetry, where you have a clear case for wanting a certain sensible look to each line.

So while Scrivener won’t add the formatting, you can do so yourself. There are several ways to do so, and the best depends on how many poems there are in the book. Is there standard prose text as well, are the poems just scattered around, or is it better to say that the book is more a collection of just poems, with title text? Are they in separate items in the binder, or mixed in with text?

Some hints:

  • In the compile Format designer, Section Layouts, Settings tab, you’ll find a CSS class name field. Put a valid CSS name in that, and Scrivener will wrap this section’s text in a div. Say you put “verse” into this field, then you will get:

[code]


First line of poem…


Second line of poem…

[/code]

So that will be good if the entire section in the binder is a poem. This could be a special Section Layout for poetry, meaning the rest of the book continues to print normally.

  • Another approach is to use a style in the text. This is better for where the text is mostly prose, but has poems and songs within it, like Lord of the Rings. With styles, the name of the style becomes a CSS class, like this:

[code]

Last line of poem…

And now back to normal paragraph text.

[/code]

In both of these examples, the CSS itself (which of course goes into the CSS compile format pane) is the same:

.verse { text-align: left; }

Lastly, if the whole book is poetry and you don’t need to mark special text, like the above two would let you do, then you can just override how the default works. If you look at the “Section Text” Section Layout in the “Ebook” format, you’ll see it already has a “section” div setting. So then all you’d need to do is change the CSS above to use “.section” instead of “.verse”.

A disclaimer: while this will set the paragraph formatting to left alignment, that does not mean the book reader will care. It is free to ignore your formatting, and indeed many will ignore some kinds of CSS. It is not a web browser, where the browser does its best to faithfully transmit the HTML and CSS intention of the designer. CSS is more like giving the book reader hints, and not all of them will work the same. Calibre’s book viewer is a pretty “faithful” viewer in that it works more like a browser. It helps you know that you have your settings right. But more opinionated programs might hide the fact that your settings are right, by ignoring them.

But again, it is worth a try. Let me know if anything is not clear.

Thank you lunk for your answer, From now on, I will always test with at least two epub readern.

I try to do work on the solution for now. thank you for your time!

hey Amber, I tried to work on this problem. Thank you so much for your solution! I have tried to make this work. I copied the default stylesheet and copied the code example that you gave into the custom style css stylesheet that is the default stylesheet plus .verse { text-align: left; } I also assigned the the verse as you suggested but it still does not seem to work.

Question: As of now a poem is a scene. The name of the scene is the heading and the text of the scene is the poem. Since the whole Heading is centered. Am I “breaking” the css by using it this way? should i generate extra scenes or folders to create stand alone titles? or what am I possible missing?

I am attaching a test project for you to look at, which shows how to set things up so that whole sections (“scenes”) can be set to a verse type. When I compile this project and open the ePub in Calibre’s editor, I get this:

[size=80][/size]

Some notes:

  • The test project also sets the colour of the text to red for “verse”. This is a useful way to tell whether your CSS is working on the right thing. If the text is red, but it is still aligned justify, then something else is wrong.
  • Calibre lets you set your own reading style. For this test, I set it to show ebook paragraph formatting as right aligned, as you can see in the block of prose below. This way we can tell for sure that the verse is left aligned.
  • You can also see that the heading is centre aligned (and red, to prove it follows the same “.verse” rule set). And no, this is fine to do, you aren’t breaking things by having some alignment different. CSS works top down. This is what is meant by “cascading style”. You are telling the .verse div to format everything inside of it (down) text-align left. But if something inside that says, “no, I want to be text-align centre”, then it can do so by itself without changing the other things in the div that have no special rules. And that is how the book as a whole is working too. With my Calibre rule, I told all of HTML to be text-align right. The .verse div is inside this thing, so it would have been right aligned too, except it had CSS saying it wants to be left.