Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Formats > ePub

Notices

Reply
 
Thread Tools Search this Thread
Old 03-08-2019, 11:52 PM   #1
AlexBell
Wizard
AlexBell ought to be getting tired of karma fortunes by now.AlexBell ought to be getting tired of karma fortunes by now.AlexBell ought to be getting tired of karma fortunes by now.AlexBell ought to be getting tired of karma fortunes by now.AlexBell ought to be getting tired of karma fortunes by now.AlexBell ought to be getting tired of karma fortunes by now.AlexBell ought to be getting tired of karma fortunes by now.AlexBell ought to be getting tired of karma fortunes by now.AlexBell ought to be getting tired of karma fortunes by now.AlexBell ought to be getting tired of karma fortunes by now.AlexBell ought to be getting tired of karma fortunes by now.
 
AlexBell's Avatar
 
Posts: 3,413
Karma: 13369310
Join Date: May 2008
Location: Launceston, Tasmania
Device: Sony PRS T3, Kobo Glo, Kindle Touch, iPad, Samsung SB 2 tablet
Can I prevent hyphenation in a block of text?

I'm working on an epub ebook which in each of its 18 books and 208 chapters has a 'preface' of several words or a few sentences. The text of the 'preface' is centered, often using several lines, and quite often the last word on a line breaks, and is hyphenated. I think this looks awful.

Is there a way to prevent all of the words in the centered text from breaking? A word at the end of a line which would otherwise break will then drop to the next line.

I know how to prevent a single word from breaking and hyphenating. But I really don't want to have to apply this markup to all or most of the words in each of the 226 'prefaces'.
AlexBell is offline   Reply With Quote
Old 03-09-2019, 06:49 AM   #2
RbnJrg
Wizard
RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.
 
Posts: 1,563
Karma: 7043711
Join Date: Mar 2013
Location: Rosario - Santa Fe - Argentina
Device: Kindle 4 NT
Quote:
Originally Posted by AlexBell View Post
I'm working on an epub ebook which in each of its 18 books and 208 chapters has a 'preface' of several words or a few sentences. The text of the 'preface' is centered, often using several lines, and quite often the last word on a line breaks, and is hyphenated. I think this looks awful.

Is there a way to prevent all of the words in the centered text from breaking? A word at the end of a line which would otherwise break will then drop to the next line.

I know how to prevent a single word from breaking and hyphenating. But I really don't want to have to apply this markup to all or most of the words in each of the 226 'prefaces'.
In your .css file create the following class:

Code:
.no_hyphens {
    adobe-hyphenate: none;
    hyphenate: none;
    hyphens: none;
    -epub-hyphens: none;
    -moz-hyphens: none;
    -webkit-hyphens: none;
}
And in your .xhtml file you have two ways of working:

1) Enclose the text to be not hyphened in a div tag with the class previously defined; i.e:

Code:
<div class="no_hyphens">
  <p>blah, blah, blah...</p>

  <p>blah, blah, blah...</p>

  <p>blah, blah, blah...</p>
</div>
2) If you want to apply the style to only a tag (i.e. h1, h2, h3..., p, etc.) then give the style to that tag; i.e;

if you have:

Code:
<h2 class="title">This is my own title</h2>
then after applying the new style you'll have:

Code:
<h2 class="title no_hyphens">This is my own title</h2>
Or if you have:

Code:
<p class="center">The text of my preface here....</p>
then after applying the new style you'll have:

Code:
<p class="center no_hyphens">The text of my preface here....</p>
Regards
Rubén
RbnJrg is offline   Reply With Quote
Advert
Old 03-10-2019, 12:54 AM   #3
AlexBell
Wizard
AlexBell ought to be getting tired of karma fortunes by now.AlexBell ought to be getting tired of karma fortunes by now.AlexBell ought to be getting tired of karma fortunes by now.AlexBell ought to be getting tired of karma fortunes by now.AlexBell ought to be getting tired of karma fortunes by now.AlexBell ought to be getting tired of karma fortunes by now.AlexBell ought to be getting tired of karma fortunes by now.AlexBell ought to be getting tired of karma fortunes by now.AlexBell ought to be getting tired of karma fortunes by now.AlexBell ought to be getting tired of karma fortunes by now.AlexBell ought to be getting tired of karma fortunes by now.
 
AlexBell's Avatar
 
Posts: 3,413
Karma: 13369310
Join Date: May 2008
Location: Launceston, Tasmania
Device: Sony PRS T3, Kobo Glo, Kindle Touch, iPad, Samsung SB 2 tablet
Thanks so much, Rubén. That's most helpful.
AlexBell is offline   Reply With Quote
Old 03-10-2019, 10:53 AM   #4
RbnJrg
Wizard
RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.
 
Posts: 1,563
Karma: 7043711
Join Date: Mar 2013
Location: Rosario - Santa Fe - Argentina
Device: Kindle 4 NT
Quote:
Originally Posted by AlexBell View Post
Thanks so much, Rubén. That's most helpful.
You are welcome Alex
RbnJrg is offline   Reply With Quote
Old 03-12-2019, 04:45 PM   #5
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: 74,446
Karma: 129358310
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 AlexBell View Post
I'm working on an epub ebook which in each of its 18 books and 208 chapters has a 'preface' of several words or a few sentences. The text of the 'preface' is centered, often using several lines, and quite often the last word on a line breaks, and is hyphenated. I think this looks awful.

Is there a way to prevent all of the words in the centered text from breaking? A word at the end of a line which would otherwise break will then drop to the next line.

I know how to prevent a single word from breaking and hyphenating. But I really don't want to have to apply this markup to all or most of the words in each of the 226 'prefaces'.
However, if the last word fully splits off to the next line, you could end up with gaps depending on the text size and the length of the word. excessive gaps and also look awful. Much more so then a hyphen.
JSWolf is online now   Reply With Quote
Advert
Old 03-12-2019, 11:48 PM   #6
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,200
Karma: 34977896
Join Date: May 2011
Location: JAPAN (US expatriate)
Device: Sony PRS-T2, ADE on PC
@JSWolf -- I think that only happens if you are using text-align: justify.
Centered text shouldn't be changing spacing between words.

Last edited by GrannyGrump; 03-13-2019 at 10:26 PM.
GrannyGrump is offline   Reply With Quote
Old 03-15-2019, 02:41 PM   #7
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: 74,446
Karma: 129358310
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 GrannyGrump View Post
@JSWolf -- I think that only happens if you are using text-align: justify.
Centered text shouldn't be changing spacing between words.
I tested centered text with ADE 2.0.1 I do get hyphenations but the spaces between the words does look the same.
JSWolf is online now   Reply With Quote
Old 03-15-2019, 08:09 PM   #8
AlexBell
Wizard
AlexBell ought to be getting tired of karma fortunes by now.AlexBell ought to be getting tired of karma fortunes by now.AlexBell ought to be getting tired of karma fortunes by now.AlexBell ought to be getting tired of karma fortunes by now.AlexBell ought to be getting tired of karma fortunes by now.AlexBell ought to be getting tired of karma fortunes by now.AlexBell ought to be getting tired of karma fortunes by now.AlexBell ought to be getting tired of karma fortunes by now.AlexBell ought to be getting tired of karma fortunes by now.AlexBell ought to be getting tired of karma fortunes by now.AlexBell ought to be getting tired of karma fortunes by now.
 
AlexBell's Avatar
 
Posts: 3,413
Karma: 13369310
Join Date: May 2008
Location: Launceston, Tasmania
Device: Sony PRS T3, Kobo Glo, Kindle Touch, iPad, Samsung SB 2 tablet
Yes, I am using centered text for the 'preface' to the books and chapters. I don't see any problems at all. Rubén's solution works very well indeed, though I have made very minor changes to give me a space on either side and below the 'preface' text.
AlexBell is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Forcing indexing to skip a block of text? andyb Sigil 15 05-03-2017 08:19 PM
Troubleshooting Text size changed after running the hyphenation plugin on an azw3 book agnul Amazon Kindle 0 10-14-2015 06:23 AM
Aura H2O, no hyphenation in Adobe reader for left-aligned text jchtt Kobo Reader 9 12-02-2014 05:04 PM
Isolated Block of Text crutledge Sigil 10 06-22-2013 02:49 PM
Prevent titles hyphenation in iPad and iPhone fante1998 ePub 0 02-24-2012 05:43 AM


All times are GMT -4. The time now is 04:57 AM.


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