Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Calibre

Notices

Reply
 
Thread Tools Search this Thread
Old 09-16-2018, 07:58 AM   #1
JustinTeim
Junior Member
JustinTeim began at the beginning.
 
Posts: 4
Karma: 10
Join Date: Sep 2018
Device: Samsung Galaxy Tab S3
How to force superscripts inline ?

Is there a CSS script I can add (or any other solution) to force superscripts (or subscripts) to be "inline" (on the same level as the text) ? I have tried reducing the font size for the superscripts, and increasing the line spacing, but neither is a good solution. Thanks in advance for any suggestions.
JustinTeim is offline   Reply With Quote
Old 09-16-2018, 09:46 AM   #2
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,082
Karma: 8796704
Join Date: Jun 2010
Device: Kobo Clara HD,Hisence Sero 7 Pro RIP, Nook STR, jetbook lite
Quote:
Originally Posted by JustinTeim View Post
Is there a CSS script I can add (or any other solution) to force superscripts (or subscripts) to be "inline" (on the same level as the text) ? I have tried reducing the font size for the superscripts, and increasing the line spacing, but neither is a good solution. Thanks in advance for any suggestions.
I use:
Code:
 line-height: 0;
or
Code:
 line-height: normal;
bernie
gbm is offline   Reply With Quote
Old 09-16-2018, 10:39 AM   #3
JustinTeim
Junior Member
JustinTeim began at the beginning.
 
Posts: 4
Karma: 10
Join Date: Sep 2018
Device: Samsung Galaxy Tab S3
Bernie, Thanks for your reply. I went to
preferences/conversion/common options/look & feel/styling/Extra CSS
and added:
.end-note { line-height: 0; }
but it does not change the output. I am a 'newbie' to CSS, so apologies in advance, but....any idea what I'm doing wrong? (I did also try "line-height: normal;").
Thanks !
JustinTeim is offline   Reply With Quote
Old 09-16-2018, 12:07 PM   #4
pdurrant
The Grand Mouse 高貴的老鼠
pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.
 
pdurrant's Avatar
 
Posts: 71,504
Karma: 306214458
Join Date: Jul 2007
Location: Norfolk, England
Device: Kindle Voyage
I beleive the only way around this problem is to have a fixed line height, e,.g.

line-height: 1.2em;

But this will annoy people who like to have a different line height on their reader.
pdurrant is offline   Reply With Quote
Old 09-16-2018, 12:21 PM   #5
JustinTeim
Junior Member
JustinTeim began at the beginning.
 
Posts: 4
Karma: 10
Join Date: Sep 2018
Device: Samsung Galaxy Tab S3
Thanks, pdurrant; Unless I'm doing something wrong, pasting
sup {
line-height: 1.2em;
}
in Look & Feel / Styling / Extra CSS

does not solve the problem (the superscript is still elevated so that it changes the line spacing).
JustinTeim is offline   Reply With Quote
Old 09-16-2018, 12:49 PM   #6
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,082
Karma: 8796704
Join Date: Jun 2010
Device: Kobo Clara HD,Hisence Sero 7 Pro RIP, Nook STR, jetbook lite
Quote:
Originally Posted by JustinTeim View Post
Thanks, pdurrant; Unless I'm doing something wrong, pasting
sup {
line-height: 1.2em;
}
in Look & Feel / Styling / Extra CSS

does not solve the problem (the superscript is still elevated so that it changes the line spacing).
You will have to use the ebook editor, do not do during conversion.

See screenshot I find were a sup or sub is used, get the css property name see the highlighted areas in the File preview and text editor sections.

Click image for larger version

Name:	Screenshot from 2018-09-16 12-26-42.png
Views:	142
Size:	385.8 KB
ID:	166335

See screenshot two I go to the css file and edit the css property values.

Note these are just the general ones that I use, for some I will add font bold and letter spacing--example a linked footnote.

Click image for larger version

Name:	Screenshot from 2018-09-16 12-27-21.png
Views:	143
Size:	326.6 KB
ID:	166336

See screenshot three for what is looks like in the calibre ebook viewer.

Click image for larger version

Name:	Screenshot from 2018-09-16 12-28-42.png
Views:	124
Size:	235.8 KB
ID:	166337

bernie
gbm is offline   Reply With Quote
Old 09-16-2018, 01:26 PM   #7
JustinTeim
Junior Member
JustinTeim began at the beginning.
 
Posts: 4
Karma: 10
Join Date: Sep 2018
Device: Samsung Galaxy Tab S3
There is a learning curve here. :-( I will tackle this next weekend. Thank you very much!!
JustinTeim is offline   Reply With Quote
Old 09-16-2018, 04:47 PM   #8
Brett Merkey
Not Quite Dead
Brett Merkey ought to be getting tired of karma fortunes by now.Brett Merkey ought to be getting tired of karma fortunes by now.Brett Merkey ought to be getting tired of karma fortunes by now.Brett Merkey ought to be getting tired of karma fortunes by now.Brett Merkey ought to be getting tired of karma fortunes by now.Brett Merkey ought to be getting tired of karma fortunes by now.Brett Merkey ought to be getting tired of karma fortunes by now.Brett Merkey ought to be getting tired of karma fortunes by now.Brett Merkey ought to be getting tired of karma fortunes by now.Brett Merkey ought to be getting tired of karma fortunes by now.Brett Merkey ought to be getting tired of karma fortunes by now.
 
Posts: 194
Karma: 654170
Join Date: Jul 2015
Device: Paperwhite 4; Galaxy Tab
@Justin:
You haven't fully described what you mean by "inline" superscripts or what your goal is in terms of usage. The style property to use normally to keep superscripts inline is vertical-align. Values of this is what you want probably.

Here are two rulesets I use all the time: the first SUP is for footnotes references and the like. The SUP with class "ordinal" is what I use for ordinal numbers (like 1st, 2nd, etc.)


Code:
sup {
   vertical-align: super;
   font-size: 0.8em;
   padding: 0 4px;
   font-weight: bold;
}
sup.ordinal {
   vertical-align: text-top;
   font-size: 0.8em;
   padding: 0;
   font-weight: normal;
}
vertical-align: text-top; forces the superscript text to stay below the normal top of a font height. It is a nice effect and probably what you want.

Last edited by Brett Merkey; 09-16-2018 at 05:02 PM.
Brett Merkey is offline   Reply With Quote
Old 09-16-2018, 09:16 PM   #9
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: 43,850
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
You can actually do this fairly easily using the "Transform styles" feature of the Look & feel section of the conversion dialog. Create a rule something like:

If the vertical-align is not baseline remove the property.
kovidgoyal is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Line spacing with sub- and superscripts lizzielou Conversion 3 08-15-2016 11:34 AM
How do I reduce line spacing when I have superscripts jrjung Conversion 2 09-04-2015 03:36 PM
Aura HD Superscripts rendered as subscripts Nick Payne Kobo Reader 4 01-07-2015 03:47 AM
superscripts and subscripts lost in ePub cyberbaffled ePub 3 10-13-2009 11:52 AM
Superscripts in LRF dynabook Calibre 6 09-10-2008 01:26 PM


All times are GMT -4. The time now is 10:11 AM.


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