Register Guidelines E-Books Search Today's Posts Mark Forums Read

Go Back   MobileRead Forums > E-Book Software > Calibre > Conversion

Notices

Reply
 
Thread Tools Search this Thread
Old 01-03-2019, 06:58 PM   #1
lumpynose
Junior Member
lumpynose began at the beginning.
 
Posts: 7
Karma: 10
Join Date: Jul 2012
Device: kindle
changing text-align: justified to left

I've downloaded a bunch of books from project gutenberg and some have a stylesheet/css file that contains

body {
margin: 5%;
background: #faebd0;
text-align: justified
}

Others don't have a text-align in the body section.

I prefer a ragged-right margin. If I append the following to the css file that should do it.

body {
text-align: left;
}

That seems like the simplest solution. Or, to every .html file that's the body of the book add before the closing </head> tag the following.

<style>
body {text-align: left;}
</style>

What's the best way to get ragged right if there is a better way than my above two ideas, and if appending to the css file is a good way, how can I do that automatically when I add books to my library?
lumpynose is offline   Reply With Quote
Old 01-03-2019, 07:26 PM   #2
theducks
Well trained by Cats
theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.
 
theducks's Avatar
 
Posts: 22,499
Karma: 22515246
Join Date: Aug 2009
Location: (The original) Silicon Valley, USA
Device: K4NT, Galaxy Tab A, Kobo Aura2
Personal preference:

Always use the stylesheet for changes you want for the entire document

Note: some books set the justification in the P classes. Those override the body justification
theducks is offline   Reply With Quote
Old 01-03-2019, 07:51 PM   #3
lumpynose
Junior Member
lumpynose began at the beginning.
 
Posts: 7
Karma: 10
Join Date: Jul 2012
Device: kindle
Quote:
Originally Posted by theducks View Post
Always use the stylesheet for changes you want for the entire document
What/where is "the stylesheet" and how do I change it? Will it work if update my added css to cover both cases like so

body { text-align: left; }
p { text-align: left; }

Under Preferences > Common Options > Look & Feel > Styling > Extra CSS I added the above body css but it's only adding it when I manually convert a book, not when it automatically converts a book, in my case from epub to azw3 when I send it to my kindle.
lumpynose is offline   Reply With Quote
Old 01-03-2019, 08:43 PM   #4
retiredbiker
Connoisseur
retiredbiker is faster than slow light.retiredbiker is faster than slow light.retiredbiker is faster than slow light.retiredbiker is faster than slow light.retiredbiker is faster than slow light.retiredbiker is faster than slow light.retiredbiker is faster than slow light.retiredbiker is faster than slow light.retiredbiker is faster than slow light.retiredbiker is faster than slow light.retiredbiker is faster than slow light.
 
retiredbiker's Avatar
 
Posts: 66
Karma: 29896
Join Date: May 2013
Location: Ontario, Canada
Device: Kindle KB, Oasis, Ubuntu, Jutoh,Kobo Forma
Have you tried using the conversion option to change alignment? From the conversion main window: Look and Feel-->Text-->Text Justification. The choices are Original, Left, and Justify.
(sorry. last post came up after I posted.)

Last edited by retiredbiker; 01-03-2019 at 08:44 PM. Reason: Timing
retiredbiker is offline   Reply With Quote
Old 01-03-2019, 08:59 PM   #5
retiredbiker
Connoisseur
retiredbiker is faster than slow light.retiredbiker is faster than slow light.retiredbiker is faster than slow light.retiredbiker is faster than slow light.retiredbiker is faster than slow light.retiredbiker is faster than slow light.retiredbiker is faster than slow light.retiredbiker is faster than slow light.retiredbiker is faster than slow light.retiredbiker is faster than slow light.retiredbiker is faster than slow light.
 
retiredbiker's Avatar
 
Posts: 66
Karma: 29896
Join Date: May 2013
Location: Ontario, Canada
Device: Kindle KB, Oasis, Ubuntu, Jutoh,Kobo Forma
If you are in the editor, open the css file (there may be more than one...).

Search in the current file (or all style files) for
Code:
text-align: justify;
and replace with
Code:
text-align: left;
and do a replace all -- save the search so it's dead easy next time.

That's it for books that come fully justified...except for the odd one with really weird coding.

Now I have a Kindle and a Kobo. If there is no justification specified, the Kindle will do full justification, but the Kobo will not, it gives the ragged-right, which is what I need since I have to read with huge print. So if I'm editing a book and not sure where I'll read it (most books), I want to add explicit left justification to cover the Kindle. I find the common text styles for most paragraphs, and just add it in. (Actually I usually just copy in the whole style coding from my cheater file...standard indent, noindent, chapno, and so on styles. Then I have known and predictable code in the css. I always do things I can at the block level, not the body...call me a control freak.)
retiredbiker is offline   Reply With Quote
Old 01-03-2019, 09:17 PM   #6
lumpynose
Junior Member
lumpynose began at the beginning.
 
Posts: 7
Karma: 10
Join Date: Jul 2012
Device: kindle
Quote:
Originally Posted by retiredbiker View Post
Have you tried using the conversion option to change alignment? From the conversion main window: Look and Feel-->Text-->Text Justification. The choices are Original, Left, and Justify.
(sorry. last post came up after I posted.)
Yes I do, because that setting is also under Preferences > Conversion > Common Options > Text, where I have it set to Left. It seems that what's set in the Preferences gets propagated when you do a manual conversion.

But that's my problem at this point; I can't get it to use that setting or the Extra CSS setting and give me a ragged right margin when it does an automatic conversion when I add a book to my library, or when I send it to my kindle and it's only in EPUB format in my library.

And it also doesn't use those settings if I delete the book from my kindle, then delete AZW3 file from my calibre library, then send the book to my kindle which also does an automatic conversion to AZW3.

So at this point it seems that I'm stuck with turning off automatic conversions when adding books to my calibre library and when sending them to the kindle. Not the end of the world since I can convert them manually but it's less convenient.

Last edited by lumpynose; 01-03-2019 at 09:56 PM.
lumpynose is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Text still full justifying on iPad, even through style says align left SamL ePub 13 04-20-2017 11:24 PM
Do you prefer justified or left-aligned text on a your ereader? CalbertAmu General Discussions 103 01-14-2017 12:40 PM
iPhone Text messages justified or left aligned? AlexBell Apple Devices 10 07-03-2012 12:01 PM
Get rid off "left-justified" text SMR Kindle Developer's Corner 3 03-01-2012 02:14 AM
Left-justified text in a right-justified box Skeezix Conversion 4 11-15-2011 09:44 PM


All times are GMT -4. The time now is 06:11 PM.


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