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

Go Back   MobileRead Forums > E-Book Software > Calibre

Notices

Reply
 
Thread Tools Search this Thread
Old 12-05-2010, 03:44 PM   #1
jtarnvik
Junior Member
jtarnvik began at the beginning.
 
Posts: 2
Karma: 10
Join Date: Dec 2010
Device: Kindle 3
2 cm left margin

Hi!

I am trying to convert an epub book to mobi. The conversion seems to work but when I view the file on my Kindle 3 it has a 2 cm (1/2 inch I suppose) left margin on every line. The right margin is OK, ie more or less nothing. I have tried to adjust the margins when converting, but even setting them to 0 pt does not affect this. I assume there is an obvious setting somewhere which I am missing. Can someone please enlighten me as to what it is! Having a 6 inch Kindle screen is small enough, not using the entire screen seems utterly useless.

Regards
/Jesper
jtarnvik is offline   Reply With Quote
Old 12-05-2010, 06:36 PM   #2
toddos
Guru
toddos ought to be getting tired of karma fortunes by now.toddos ought to be getting tired of karma fortunes by now.toddos ought to be getting tired of karma fortunes by now.toddos ought to be getting tired of karma fortunes by now.toddos ought to be getting tired of karma fortunes by now.toddos ought to be getting tired of karma fortunes by now.toddos ought to be getting tired of karma fortunes by now.toddos ought to be getting tired of karma fortunes by now.toddos ought to be getting tired of karma fortunes by now.toddos ought to be getting tired of karma fortunes by now.toddos ought to be getting tired of karma fortunes by now.
 
toddos's Avatar
 
Posts: 694
Karma: 822675
Join Date: May 2010
Device: Kobo Aura, Nokia Lumia 920 (Freda)
Perhaps the epub has the margin already set inside it? Try opening the epub using the "Tweak epub" option (shortcut: T) and look at the .css file to see if there are any large margins set. I find that a lot of epub books like to have 1em or even 2em margins, which depending on your font size could be around 2cm. Since I read on an iPhone and such large margins leave me with only 3-4 words per line on the small screen, I'm very sensitive to this and end up editing a lot of epubs to de-marginize them.
toddos is offline   Reply With Quote
 
Advertisement
Old 12-06-2010, 02:36 AM   #3
jtarnvik
Junior Member
jtarnvik began at the beginning.
 
Posts: 2
Karma: 10
Join Date: Dec 2010
Device: Kindle 3
Thank you, you were right. There was a 1,5 em margin in the css.
jtarnvik is offline   Reply With Quote
Old 12-06-2010, 03:52 AM   #4
cybmole
Wizard
cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.
 
Posts: 2,997
Karma: 1285294
Join Date: Sep 2010
Device: Kobo aura HD, Kobo Arc, Kindle Fire HDX 8.9 , Kindle for PC
could we have an idiots guide / step by step instructions for fixing this please i.e. for finding & then editing the css lines.

i have been fixing it by converting to .rtf and then to .mobi but ( as reported elsewhere) calibre's rtf output is buggy and sometimes creates a corrupt file.
cybmole is offline   Reply With Quote
Old 12-06-2010, 04:07 AM   #5
toddos
Guru
toddos ought to be getting tired of karma fortunes by now.toddos ought to be getting tired of karma fortunes by now.toddos ought to be getting tired of karma fortunes by now.toddos ought to be getting tired of karma fortunes by now.toddos ought to be getting tired of karma fortunes by now.toddos ought to be getting tired of karma fortunes by now.toddos ought to be getting tired of karma fortunes by now.toddos ought to be getting tired of karma fortunes by now.toddos ought to be getting tired of karma fortunes by now.toddos ought to be getting tired of karma fortunes by now.toddos ought to be getting tired of karma fortunes by now.
 
toddos's Avatar
 
Posts: 694
Karma: 822675
Join Date: May 2010
Device: Kobo Aura, Nokia Lumia 920 (Freda)
Wow, that's about the most convoluted method I've ever heard of for fixing simple CSS issues

There are three ways you can go about doing this:
  1. Use Calibre's "Tweak epub" option. This will expand the epub and open the temporary folder where the epub was expanded. Open the .css file (there should be only one) in your favorite text editor (or Notepad, if you have nothing else) and then look for any "margin-left" or "margin-right" entries.
  2. Use an epub editor like Sigil. You can open the file directly from Calibre's storage folders. Use the "Open containing folder" option (shortcut key: O) to find the path to the folder, and then open the epub from that location in Sigil. As in 1, find the .css file in the list of files on the left in Sigil, and then look for any "margin-left" or "margin-right" entries.
  3. Since epub is just a zip file renamed, you can do this manually as well. Go to the containing folder location (see 2 above), rename the .epub file to .zip ("foo.epub" would become "foo.zip"). Open this file with your favorite zip tool (or Windows Explorer) and extract the contents including all folders to a temporary working directory. Find the .css file and follow the rest of 1 above. When done, zip up all of the files/folders in the temporary folder (do not zip up the folder itself -- when you look at the final zip, the files should be at the root level), give it the same name as the original zip file, and then rename the extension back to .epub and copy it into Calibre's folder structure. It's probably best to keep a backup of the original epub until you've verified that your new one works.

Within the CSS file, my solution to margin problems is generally to remove the lines entirely. If I want any margins, I'll let Calibre add them on convert (usually go with 5pt all around). Also, make sure you don't accidentally remove any intentional indentation margins, such as for blockquote-type text. Unfortunately this is pretty difficult to do without context, since the class names are never descriptive (calibreN, where N is a number). This is why I like using option 2 above. I can search for a class name across all files in the epub and see where it's being used. From that, I can get enough context to understand what the class is intended to do, and thus whether or not I should remove margins.

Also note that this assumes all styles are put into a separate .css files. Most (all?) calibre conversions should not have any inline styles, but if you're working with a non-calibre-created epub (for example, an epub you've purchased from a store and liberated) you might find that some styles have been sprinkled around the HTML code. If this happens, you're basically screwed. You'll have to go through every single HTML file in the epub and verify that the inline styles are correct.
toddos is offline   Reply With Quote
Old 12-06-2010, 04:14 AM   #6
cybmole
Wizard
cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.
 
Posts: 2,997
Karma: 1285294
Join Date: Sep 2010
Device: Kobo aura HD, Kobo Arc, Kindle Fire HDX 8.9 , Kindle for PC
Quote:
Originally Posted by toddos View Post
Wow, that's about the most convoluted method I've ever heard of for fixing simple CSS issues
thanks for posting the "proper" way.

PS mine may be convoluted but it's a hell of a lot simpler & needs no extra software - if it were a race to produce say 10 fixed up .mobi books I'd be over the finishing line while you were still on book 1. & the newer contestants were still googling & downloading sigil :-)

but as my method occasionally fails it's good to know of an alternative.
cybmole is offline   Reply With Quote
Old 12-06-2010, 04:18 AM   #7
cybmole
Wizard
cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.
 
Posts: 2,997
Karma: 1285294
Join Date: Sep 2010
Device: Kobo aura HD, Kobo Arc, Kindle Fire HDX 8.9 , Kindle for PC
PS - one other thing I don't "get" about this issue.
When I view an offending book in it's .epub format with calibre viewer, there is no visible wide left margin, even though it contains css margins code. - does the calibre epub viewer intelligently ignore that code ? . IF so, then why does the calibre .mobi viewer not do the same thing ?

or to put it another wy , why is it a .mobi specific problem
cybmole is offline   Reply With Quote
Old 12-06-2010, 04:26 AM   #8
DoctorOhh
US Navy, Retired
DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.
 
DoctorOhh's Avatar
 
Posts: 8,909
Karma: 12755553
Join Date: Feb 2009
Location: North Carolina
Device: Nexus 7
Quote:
Originally Posted by cybmole View Post
why is it a .mobi specific problem
Because of the way Kindle renders the ebook. Here is Kovids quick explanation.

Quote:
Originally Posted by kovidgoyal View Post
A quick explanation: Left margins in the MOBI format for the kindle can only be set in 2em blocks. That is a hard limitation of the Amazon MOBI renderer. So if you have a smaller left margin in your EPUB file, say 0.5em when translated to MOBI it becomes 2em.
DoctorOhh is offline   Reply With Quote
Old 12-06-2010, 05:10 AM   #9
toddos
Guru
toddos ought to be getting tired of karma fortunes by now.toddos ought to be getting tired of karma fortunes by now.toddos ought to be getting tired of karma fortunes by now.toddos ought to be getting tired of karma fortunes by now.toddos ought to be getting tired of karma fortunes by now.toddos ought to be getting tired of karma fortunes by now.toddos ought to be getting tired of karma fortunes by now.toddos ought to be getting tired of karma fortunes by now.toddos ought to be getting tired of karma fortunes by now.toddos ought to be getting tired of karma fortunes by now.toddos ought to be getting tired of karma fortunes by now.
 
toddos's Avatar
 
Posts: 694
Karma: 822675
Join Date: May 2010
Device: Kobo Aura, Nokia Lumia 920 (Freda)
Quote:
Originally Posted by cybmole View Post
thanks for posting the "proper" way.

PS mine may be convoluted but it's a hell of a lot simpler & needs no extra software - if it were a race to produce say 10 fixed up .mobi books I'd be over the finishing line while you were still on book 1. & the newer contestants were still googling & downloading sigil :-)

but as my method occasionally fails it's good to know of an alternative.
Really? You have to do two conversions (epub -> rtf, rtf -> epub), which takes time. If this were a race, I'd use Calibre's Tweak epub option to pop open each book, open the .css into Notepad (opens really quickly), find my offending left-margins and delete them, and be on the 10th book before you had finished your first conversion back from rtf to epub. And my books wouldn't suffer from potential conversion issues (it's not as bad as re-re-recompressing video, but you absolutely can run into formatting and character errors if you go back and forth between formats).

Good thing it's not a race

Also, why would anybody Google for Sigil? I provided a link. And I think you and I have had this discussion before, so obviously you're not going to change how you clean up your epubs. Just as I'm not going to change my view that you're pounding in a thumbtack with a sledgehammer.
toddos is offline   Reply With Quote
Old 12-06-2010, 06:49 AM   #10
EowynCarter
Wizard
EowynCarter ought to be getting tired of karma fortunes by now.EowynCarter ought to be getting tired of karma fortunes by now.EowynCarter ought to be getting tired of karma fortunes by now.EowynCarter ought to be getting tired of karma fortunes by now.EowynCarter ought to be getting tired of karma fortunes by now.EowynCarter ought to be getting tired of karma fortunes by now.EowynCarter ought to be getting tired of karma fortunes by now.EowynCarter ought to be getting tired of karma fortunes by now.EowynCarter ought to be getting tired of karma fortunes by now.EowynCarter ought to be getting tired of karma fortunes by now.EowynCarter ought to be getting tired of karma fortunes by now.
 
Posts: 4,133
Karma: 1604192
Join Date: Oct 2008
Location: Paris
Device: Cybooks; Sony PRS-T1
I usually open the ePub with 7zip (or any program able to read zip, that most OS will provide out of the box), edit css directly, and voila.
And sigil when i want to do some more serious editing.
EowynCarter is offline   Reply With Quote
Old 12-06-2010, 06:51 AM   #11
cybmole
Wizard
cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.
 
Posts: 2,997
Karma: 1285294
Join Date: Sep 2010
Device: Kobo aura HD, Kobo Arc, Kindle Fire HDX 8.9 , Kindle for PC
OK - I'm trying your method but failing to find the tweak epub feature :-( I have calibre open at the relevant book - cant see a suitable menu option anywhere ?

so tried 2nd route - could not get 7z to work - used winzip - found the css file margins - they look ok in there at 1st glance (5pt)

here's what is in the epub, ( via caliibre wizard)
[code]
</head>
<body text="#000000" link="#0000ff" dir="LTR" class="calibre">
<p class="western">
<span class="calibre1"><b class="calibre2">Excession</b></span></p>
<p class="calibre3">
Culture Book 4</p>
<p class="calibre3">
Iain M. Banks</p>
<p class="calibre4">
<br class="calibre5"/></p>
<p class="calibre6">
Two and a half millennia ago, the artifact appeared in a remote
corner of space, beside a trillion-year old dying sun from a
different universe. It was a perfect black-body sphere, and it did
nothing. Then it disappeared. Now it is back.</p>
<p class="calibre6">
Silent, motionless, and resisting all efforts to make contact, the
[code]

everything after culture book 4 Iain Banks gets indented in mobi, but not in epub viewer ???

so is it something to do with calibre 6 class ??

back to the css file - i guess I have to edit & save this chunk: ( which is using inches, not pts ? )

.calibre6 {
direction: ltr;
display: block;
margin-bottom: 0.02in;
margin-left: 0.1in;
margin-right: 0.1in;
margin-top: 0.02in;
orphans: 2;
text-align: LEFT;
text-indent: 0;
widows: 2


NB the styles go all the way up to calibre 15, + some other western ones. would I have to edit every style for consistency - look complex !

Last edited by cybmole; 12-06-2010 at 07:04 AM.
cybmole is offline   Reply With Quote
Old 12-06-2010, 07:36 AM   #12
ldolse
Wizard
ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.
 
Posts: 1,337
Karma: 123455
Join Date: Apr 2009
Location: Malaysia
Device: PRS-650, iPhone
The tweak epub feature is in the right-click menu for any given book, or just press the letter 't' on your keyboard.

The simplest approach is just to delete every line with 'margin-left' in the css file (it's highly unlikely to exist with every style), though if there was some book content that was actually supposed to be indented you will lose that - then again you've been losing it by converting to rtf, so it probably doesn't matter.
ldolse is offline   Reply With Quote
Old 12-06-2010, 07:38 AM   #13
DoctorOhh
US Navy, Retired
DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.
 
DoctorOhh's Avatar
 
Posts: 8,909
Karma: 12755553
Join Date: Feb 2009
Location: North Carolina
Device: Nexus 7
Quote:
Originally Posted by cybmole View Post
OK - I'm trying your method but failing to find the tweak epub feature :-( I have calibre open at the relevant book - cant see a suitable menu option anywhere ?
Right click on the selected book and choose tweak epub (see attached).

If you still don't see the option it means your version is older then 0.7.20 and you might want to consider upgrading.
Attached Thumbnails
Click image for larger version

Name:	tweak_ePub.jpg
Views:	76
Size:	183.7 KB
ID:	62406  

Last edited by DoctorOhh; 12-06-2010 at 07:47 AM.
DoctorOhh is offline   Reply With Quote
Old 12-06-2010, 08:21 AM   #14
cybmole
Wizard
cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.cybmole ought to be getting tired of karma fortunes by now.
 
Posts: 2,997
Karma: 1285294
Join Date: Sep 2010
Device: Kobo aura HD, Kobo Arc, Kindle Fire HDX 8.9 , Kindle for PC
i see the menu option now, thanks & see how it works.

out of curiosity what happens if one just deletes the entire .css file ?
cybmole is offline   Reply With Quote
Old 12-06-2010, 08:43 AM   #15
user_none
Sigil & calibre developer
user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.
 
user_none's Avatar
 
Posts: 2,473
Karma: 1053245
Join Date: Jan 2009
Location: Florida, USA
Device: Nook STR
Quote:
Originally Posted by cybmole View Post
out of curiosity what happens if one just deletes the entire .css file ?
Almost to all formatting within the book will be gone. Width, hight, bold, italic, color, indentation... can all be (usually are) set via css.
user_none is offline   Reply With Quote
Reply

Tags
conversion, epub, mobi

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
[Old Thread] Convert epub to mobi with wide left margin on Kindle victoria0217 Conversion 91 11-15-2011 06:25 PM
Classic Any way to change left-right margin spacing? tanzer21 Barnes & Noble NOOK 7 02-14-2011 05:38 AM
New conversion questions: Getting rid of huge left margin Epub to Mobi geekgeek Calibre 2 09-01-2010 12:00 AM
calibre ignore margin-top and margin-bottom bender Calibre 2 12-11-2009 07:58 AM
Right Margin Control TedPark Sony Reader Dev Corner 4 07-02-2008 08:41 AM


All times are GMT -4. The time now is 09:03 PM.


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