Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Formats > ePub

Notices

Reply
 
Thread Tools Search this Thread
Old 04-05-2017, 10:16 PM   #1
Just some guy
Enthusiast
Just some guy began at the beginning.
 
Posts: 29
Karma: 10
Join Date: Mar 2017
Device: none
Add empty spaces between characters (Calibre)?

In my ebook, I have a line of text that includes empty spaces, like:

"asdfkl sdfkjsdfl"

But the spaces disappeared in the conversion from InDesign to Calibre.

So I was wondering if there's a way to add empty spaces between characters in Calibre?

As a work-around, I tried to make some 'invisible' characters; e.g. change the text color to white, but then I realized I would obviously need two styles within one line, because some characters would still need to be black, and I couldn't figure out how to do that...
Just some guy is offline   Reply With Quote
Old 04-06-2017, 12:09 AM   #2
GrannyGrump
Obsessively Dedicated...
GrannyGrump ought to be getting tired of karma fortunes by now.GrannyGrump ought to be getting tired of karma fortunes by now.GrannyGrump ought to be getting tired of karma fortunes by now.GrannyGrump ought to be getting tired of karma fortunes by now.GrannyGrump ought to be getting tired of karma fortunes by now.GrannyGrump ought to be getting tired of karma fortunes by now.GrannyGrump ought to be getting tired of karma fortunes by now.GrannyGrump ought to be getting tired of karma fortunes by now.GrannyGrump ought to be getting tired of karma fortunes by now.GrannyGrump ought to be getting tired of karma fortunes by now.GrannyGrump ought to be getting tired of karma fortunes by now.
 
GrannyGrump's Avatar
 
Posts: 3,221
Karma: 35037583
Join Date: May 2011
Location: PA {back in the usa!}
Device: Sony PRS-T2, ADE on PC
Do you mean a space between each character in a word? Like so?
H A P P Y

{oops -- the no-parse tags are not working well. I had to put a space after the ampersand "&" to keep forum software from changing my text into actual whitespace. If you use these in real code, make sure there are no spaces inside the entities.}

You might try using the non-breaking space --- use the html name   or the html number & #160; like so:

Code:
H A P P Y

H& #160;A& #160;P& #160;P& #160;Y
The nbsp *should* keep your word all together without breaking.

The entity for a regular space is & #32;.

Also be aware that rendering will collapse multiple regular spaces into a single space, and you have to fool the engine by using a combination of nbsp and regular space, OR wrap in a tag that defines how you want the whitespace handled. W3schools has information here: https://www.w3schools.com/cssref/pr_...hite-space.asp

If you are producing this book for distribution, it's very good that you decided against the "color" solution. If the user decides to change the background color, your white text would suddenly become visible. You should avoid setting any colors for text --- end-users get upset if your *black* text suddenly disappears when they want to use night-mode.

EDIT TO ADD: While I am thinking of it, if you simply have single spaces between characters, Calibre would not have deleted those. Did you mean MULTIPLE spaces? If so, you will indeed have to use multiple nbsp, or wrap text with a tag defining whitespace. Your example text does not show clearly what you are trying to do. Can you attach a screenshot?

Last edited by GrannyGrump; 04-06-2017 at 01:26 AM.
GrannyGrump is offline   Reply With Quote
Advert
Old 04-06-2017, 09:02 AM   #3
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 45,349
Karma: 27182818
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
Just add the style

letter-spacing: 1em
kovidgoyal is offline   Reply With Quote
Old 04-06-2017, 12:23 PM   #4
dwig
Wizard
dwig ought to be getting tired of karma fortunes by now.dwig ought to be getting tired of karma fortunes by now.dwig ought to be getting tired of karma fortunes by now.dwig ought to be getting tired of karma fortunes by now.dwig ought to be getting tired of karma fortunes by now.dwig ought to be getting tired of karma fortunes by now.dwig ought to be getting tired of karma fortunes by now.dwig ought to be getting tired of karma fortunes by now.dwig ought to be getting tired of karma fortunes by now.dwig ought to be getting tired of karma fortunes by now.dwig ought to be getting tired of karma fortunes by now.
 
dwig's Avatar
 
Posts: 1,613
Karma: 6718541
Join Date: Dec 2004
Location: Paradise (Key West, FL)
Device: Current:Surface Go & Kindle 3 - Retired: DellV8p, Clie UX50, ...
Quote:
Originally Posted by Just some guy View Post
In my ebook, I have a line of text that includes empty spaces, like:

"asdfkl sdfkjsdfl"

But the spaces disappeared in the conversion from InDesign to Calibre.
...
"Calibre" isn't a format and the core Calibre app doesn't display ebooks so I'm assuming that:
  1. In InDesign, you exported the document as an ePub, given that this is the ePub sub-forum.
  2. you then imported the ePub into calibre.
  3. you then opened the ePub in an ePub viewer, perhaps the ebook-viewer app that is bundled with calibre.

Based on those assumptions, the space omission occurred in InDesign, likely a formatting type that its ePub export doesn't handle. This would leave you with two functional fixes:
  • edit the InDesign document to change the way the space was inserted and reexport. This may be a bit of a Trial-and-Terror chore as you may need to experiment with more than one option.
  • simply edit the ePub that is in calibre to add the omitted space, using either the Editor app that is bundled with calibre or with some other ePub editor like Sigil.
dwig is offline   Reply With Quote
Old 04-06-2017, 01:20 PM   #5
jhowell
Grand Sorcerer
jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.
 
jhowell's Avatar
 
Posts: 7,072
Karma: 91577715
Join Date: Nov 2011
Location: Charlottesville, VA
Device: Kindles
In case anyone is wondering the original post was entered like this, with multiple spaces between the words.

Quote:
Originally Posted by Just some guy View Post
Code:
"asdfkl              sdfkjsdfl"
Combining white space is a standard HTML feature. GrannyGrump seems to have covered the best solutions.
jhowell is online now   Reply With Quote
Advert
Old 04-06-2017, 04:25 PM   #6
Turtle91
A Hairy Wizard
Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.
 
Turtle91's Avatar
 
Posts: 3,351
Karma: 20171571
Join Date: Dec 2012
Location: Charleston, SC today
Device: iPhone 15/11/X/6/iPad 1,2,Air & Air Pro/Surface Pro/Kindle PW & Fire
Quote:
Originally Posted by kovidgoyal View Post
Just add the style

letter-spacing: 1em


or even "letter-spacing: 5em"

eg

Code:
CSS
span.wide {letter-spacing: 5em}

<p>This is an example of a <span class="wide">expanded</span> word.</p>
results in:
Code:
This is an example of an   e     x     p     a     n     d     e     d   word.
Turtle91 is offline   Reply With Quote
Old 04-06-2017, 10:35 PM   #7
Just some guy
Enthusiast
Just some guy began at the beginning.
 
Posts: 29
Karma: 10
Join Date: Mar 2017
Device: none
Thank you very much for your time!

First, I have to explain an embarrassing fact that I should have included in my original post (I did so in my first forum post some days ago, but forgot it here):

I'm absolutely new to ebooks, and the embarrassing part is that I don't even have the time to really learn much about it, so I have to fake it as I go along, copying code I don't understand, as I literally don't have a clue about the very basics.

I just happen to have this one long mess of a physical book, with lots of styles and fonts, and thanks to the good people here, my digital version actually looks correct now, with the exception of this space-thing.

And to make matters worse, I only now realize that the forum software here treats my spacing exactly like the ebook readers, e.g. it cuts away extra multiple spaces between words.

So how jhowell actually managed to quote a correct version of my original post (two post up) is completely beyond me!

But this is what it should look like:

"asdfkl xxxxxxxxxx sdfkjsdfl"

(Where the x's represent additional empty spaces.)

So I'm sorry that I inadvertently led GrannyGrump, kovidgoyal, Turtle91 and everybody else in a wrong direction.
Just some guy is offline   Reply With Quote
Old 04-07-2017, 12:43 AM   #8
BetterRed
null operator (he/him)
BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.
 
Posts: 21,725
Karma: 29711016
Join Date: Mar 2012
Location: Sydney Australia
Device: none
Quote:
Originally Posted by Just some guy View Post
So how jhowell actually managed to quote a correct version of my original post (two post up) is completely beyond me!

But this is what it should look like:

"asdfkl xxxxxxxxxx sdfkjsdfl"
Read what he wrote - and you'll see he wrapped your asdfkl <several spaces> sdfkjsdfl in [code][/code] tags

To see what someone actually typed hit the quote button, also see ==>> MobileRead Forums - BB Code List

BR
BetterRed is offline   Reply With Quote
Old 04-07-2017, 01:34 AM   #9
Just some guy
Enthusiast
Just some guy began at the beginning.
 
Posts: 29
Karma: 10
Join Date: Mar 2017
Device: none
Quote:
Originally Posted by BetterRed View Post
Read what he wrote - and you'll see he wrapped your asdfkl <several spaces> sdfkjsdfl in [code][/code] tags
OK, that's clever! Any chance I can do something like that in Calibre?
Just some guy is offline   Reply With Quote
Old 04-07-2017, 04:04 AM   #10
BetterRed
null operator (he/him)
BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.
 
Posts: 21,725
Karma: 29711016
Join Date: Mar 2012
Location: Sydney Australia
Device: none
Quote:
Originally Posted by Just some guy View Post
OK, that's clever! Any chance I can do something like that in Calibre?
Probably, but for a quick and dirty solution in Sigil I would have something like this (which is more or less what GrannyGrump suggested on Post#2).

Click image for larger version

Name:	1.jpg
Views:	445
Size:	79.8 KB
ID:	156050

I forget how to type and display things like non-breaking spaces, shys, etc in the calibre code editor, which is one of the reasons I don't use it much for editing the code.

BR

Last edited by BetterRed; 04-07-2017 at 04:07 AM.
BetterRed is offline   Reply With Quote
Old 04-07-2017, 04:49 AM   #11
Doitsu
Grand Sorcerer
Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.
 
Doitsu's Avatar
 
Posts: 5,727
Karma: 24031401
Join Date: Dec 2010
Device: Kindle PW2
I hate to rain on the parade, but, AFAIK, ADE/RMSDK based epub apps don't support letter-spacing in epub2 books.
ADE 4.5.x/RMSDK 12.5.x supports letter-spacing but only in epub3 books.
Doitsu is offline   Reply With Quote
Old 04-07-2017, 04:53 AM   #12
JSWolf
Resident Curmudgeon
JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.
 
JSWolf's Avatar
 
Posts: 79,752
Karma: 145864619
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
I still don't get what's wanted. Can this be properly explained? Is there letter spacing or is it word spacing where there is more than one space between words?
JSWolf is offline   Reply With Quote
Old 04-07-2017, 05:19 AM   #13
BetterRed
null operator (he/him)
BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.
 
Posts: 21,725
Karma: 29711016
Join Date: Mar 2012
Location: Sydney Australia
Device: none
Quote:
Originally Posted by JSWolf View Post
I still don't get what's wanted. Can this be properly explained? Is there letter spacing or is it word spacing where there is more than one space between words?
The latter - see post#5 where jhowell put JSG's original text onto code tags.

If you press quote on the original post you can see for yourself - must the time of the year, everyone wants to be fed with a spoon.

BR

Last edited by BetterRed; 04-07-2017 at 05:23 AM.
BetterRed is offline   Reply With Quote
Old 04-07-2017, 06:41 AM   #14
JSWolf
Resident Curmudgeon
JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.
 
JSWolf's Avatar
 
Posts: 79,752
Karma: 145864619
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
Quote:
Originally Posted by BetterRed View Post
The latter - see post#5 where jhowell put JSG's original text onto code tags.

If you press quote on the original post you can see for yourself - must the time of the year, everyone wants to be fed with a spoon.

BR
Doesn't work because the code tags are in a quote.
JSWolf is offline   Reply With Quote
Old 04-07-2017, 09:03 AM   #15
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 45,349
Karma: 27182818
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
If you want spaces between words, not letters, add the style
Code:
white-space: pre-wrap
and just enter the spaces as normal.
kovidgoyal is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Add empty MD file to book Dalcyks Library Management 6 11-27-2016 02:05 AM
Generous use of empty spaces (Foolish?) chaot Editor 6 10-29-2015 02:57 PM
Sigil adds spaces between HTML tags, creating strange characters chezjim Sigil 10 06-10-2011 04:00 AM
Can't add files to library if the filename contain spaces mduijkers enTourage Archive 8 09-19-2010 05:10 AM
Add Empty Books? Sydney's Mom Calibre 4 03-14-2010 08:26 PM


All times are GMT -4. The time now is 12:43 PM.


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