Mobileread
How to make the margins smaller in ePub?
#1  Tior500 11-10-2019, 09:59 AM
Hello!
I'm quite new so I'm hoping that I'm writing this in the correct thread.
My question would be: how am I able to convert my ePub into an ePub with smaller margins using Calibre? Basically, I have an ePub book on my MacBook and I'm hoping to make the margins smaller and send it to my iPad iBooks.
Thank you!
Reply 

#2  theducks 11-10-2019, 10:42 AM
Did you set the device profile to Tablet? That does a number of things, including make the images not shrink.

An ebook is boxes within boxes (AKA the box model). So you also need to know at which nested level, the 'excessive' margins are being applied.

The profile tends to affect the Body. But you could have a nest.
<div
<p
<blockquote

In addition, your device (app) may ignore the publishers (that in the book), and use its settings Or a combination.

So, the basic Q: Are all the books the same? 1)device, 2) Profile
anything else is the individual book
Time to learn some basic CSS (ebooks don't use much above the basic stuff)
Reply 

#3  JSWolf 11-10-2019, 11:48 AM
Quote Tior500
Hello!
I'm quite new so I'm hoping that I'm writing this in the correct thread.
My question would be: how am I able to convert my ePub into an ePub with smaller margins using Calibre? Basically, I have an ePub book on my MacBook and I'm hoping to make the margins smaller and send it to my iPad iBooks.
Thank you!
Use the Calibre eBook editor to edit the eBook. Edit the CSS and remove any @page and change the left/right margins for body, p, and the classes used for p for indented and non-indented paragraphs.

I know this is not the easiest thing to do right away as a novice, but it really helps to learn HTML/CSS and once you do, you will be able to do more modification to the ePub. It's a lot better then going ePub > ePub.
Reply 

#4  deback 11-14-2019, 12:43 PM
In the Editor, you only need to change the left and right margins for the body class (in the *.css file), which is normally "calibre," but not always. If you change the body class and then change the left and right margins in the classes for the paragraphs, you will not have the results you intended.

Another way to change any of the four margins is to use Convert. Open the preferences from the main Calibre window (ctrl-P). Click on Common Options and then click on Page Setup. Over near the bottom on the right, fill in the left and right margin lines with the values you prefer. Click Apply and then when you convert, your margins will be what you've set under Page Setup--and you won't need to edit the page_styles.css or the stylesheet.css files.
Reply 

#5  JSWolf 11-18-2019, 10:21 PM
Quote deback
In the Editor, you only need to change the left and right margins for the body class (in the *.css file), which is normally "calibre," but not always. If you change the body class and then change the left and right margins in the classes for the paragraphs, you will not have the results you intended.

Another way to change any of the four margins is to use Convert. Open the preferences from the main Calibre window (ctrl-P). Click on Common Options and then click on Page Setup. Over near the bottom on the right, fill in the left and right margin lines with the values you prefer. Click Apply and then when you convert, your margins will be what you've set under Page Setup--and you won't need to edit the page_styles.css or the stylesheet.css files.
Converting ePub > ePub is a bad idea. Don't do it.

As to what needs to be changed in the ePub depends on the ePub's code. @page has to go in the CSS. Body has to have the margins set to 0. if there is a p, it has to have the margins set to 0. If there are p modifying classes, they have to have the margins changed depending on what they do. You might also want to reduce the indent and the space used for offset text.

There is not a one size fits all solution. But the more you work with the HTML/CSS, the easier it will get.
Reply 

#6  deback 11-19-2019, 09:58 AM
Quote
Converting ePub > ePub is a bad idea. Don't do it.
I do it all the time and am able to fix many things doing it. It works fine for me and saves me a lot of time not having to manually edit lots of CSS entries.
Reply 

#7  theducks 11-19-2019, 10:46 AM
Quote deback
I do it all the time and am able to fix many things doing it. It works fine for me and saves me a lot of time not having to manually edit lots of CSS entries.
I would use the words: Avoid doing it .

Look at the code on a book before Calibre, then look after a same format conversion. I'd much rather just touch up the CSS in an editor, than risk side effects.

Yes it works. And usually it creates little to no issues. But the dust bunnies that were created if you are a lean-mean coder will drive you to tears
I save the same format conversion route for those books so corrupt that neither Sigil nor the Calibre-editor can open them. Kovid has some miracle code that brings a book back from the dead pile
Reply 

#8  ps67 11-19-2019, 05:54 PM
I seldom use that technique. Almost never. I agree with @theducks and @JSWolf: it should be avoided.

But if I have 52 hypertrophic css files in a fiction book (one for each chapter, I did not check if they are all equal but I think they are) with no particular formatting, except for titles, the time I would loose is more important than a clean work.

So: Epub to Epub with "remove spaces from paragraph" and 1.5em of indentation et voilĂ .

ps: I would like to know who is that made this horrible work. (may be the author itself).
Reply 

#9  DNSB 11-19-2019, 06:32 PM
Quote ps67
ps: I would like to know who is that made this horrible work. (may be the author itself).
In the case of one local author, a 4 book omnibus with 134 CSS files—every bleeping XHTML file had it's own stylesheet so the text display was not consistent from chapter to chapter, never mind within the omnibus. Most of this was due to recovering her early books from her ex-publisher. Ghod alone knows who actually did the formatting or what program they used. I suspected a summer intern from embedding 5 font files for displaying cursive chapter headers and mixing graphics and text dropcaps. A couple of hours later, we were down to 1 CSS file, one embedded font, scene breaks that matched, etc. The miracles of regex/search and replace for the most part.

A bit boring layout but that's my personal preference and the author was happy enough to pay the remainder of the bill on time when Amazon accepted the upload on the first try.
Reply 

#10  deback 11-20-2019, 12:09 PM
Quote theducks
I would use the words: Avoid doing it .

Look at the code on a book before Calibre, then look after a same format conversion. I'd much rather just touch up the CSS in an editor, than risk side effects.
I spent a lot of time coming up with my system of using Convert to fix many things. I have many entries in the Extra CSS and Transform sections. I'm a perfectionist and a lean-mean coder, and yes, I also spend a lot of time (sometimes) manually editing CSS classes, when it's impossible to fix things running Convert. The result after I run Convert is the best looking books and most readable books I've seen anywhere, using very simple coding and a lot less time than if I had manually edited everything I wanted to change. So, the result really depends on how you have all the conversion options set up.
Reply 

  Next »  Last »  (1/2)
Today's Posts | Search this Thread | Login | Register