View Single Post
Old 12-13-2025, 06:53 PM   #3
gbm
Wizard
gbm ought to be getting tired of karma fortunes by now.gbm ought to be getting tired of karma fortunes by now.gbm ought to be getting tired of karma fortunes by now.gbm ought to be getting tired of karma fortunes by now.gbm ought to be getting tired of karma fortunes by now.gbm ought to be getting tired of karma fortunes by now.gbm ought to be getting tired of karma fortunes by now.gbm ought to be getting tired of karma fortunes by now.gbm ought to be getting tired of karma fortunes by now.gbm ought to be getting tired of karma fortunes by now.gbm ought to be getting tired of karma fortunes by now.
 
Posts: 2,223
Karma: 8888888
Join Date: Jun 2010
Device: Kobo Clara HD,Hisence Sero 7 Pro RIP, Nook STR, jetbook lite
I covert every ebook to epub then edit the epub when I have it the way I like then convert the epub to AZW3.

Here is how I fix Em dashes :

First in the calibre editor create a function name it Em dashes
Code:
def replace(match, number, file_name, metadata, dictionaries, data, functions, *args, **kwargs):
    return match.group().replace(' – ', '—').replace(' –', '—').replace('– ', '—').replace('--', '—').replace(' - ', '—').replace(' —', '—').replace(' — ', '—').replace('— ', '—')

This is the search that I use:
Code:
<body.*?>.*?</body>

https://manual.calibre-ebook.com/function_mode.html

be sure to save it.

https://manual.calibre-ebook.com/edi...saved-searches

This change a - a to a—a and will remove all spaces before and after em dashes.
bernie
Quote:
Originally Posted by Siavahda View Post
It's not every ebook, but it happens often enough that I thought I'd try asking for help.

I'm reading on a Paperwhite (10th gen) running 5.15.1.1. I do not want to update at this time.

Example book is Recipes For an Unexpected Afterlife by Deston J. Munden. EPUB converted to AZW3. In the Calibre viewer, both the EPUB and AZW3 file display perfectly. If I open the files up, there are no spaces around the em dashes. So I'm confident it's not an issue with the file/s.

But on my Paperwhite, there is a space before each em dash. Photo at the link below.

https://everybookadoorway.com/wp-con...5640491405.jpg

I've tried changing fonts and text size and layouts and margins on the Paperwhite. I've tried altering the AZW3 file from justified text to left-align. None of it worked, and I'm pretty clueless about what else to try. I've spent hours looking for a solution online, but I suspect I don't know the right search terms because nothing's coming up.

If I convert the EPUB to MOBI, the em dashes display perfectly in the MOBI.

Does anyone know what causes this, and how to fix it in AZW3?

Last edited by gbm; 12-13-2025 at 06:56 PM.
gbm is offline   Reply With Quote