Register Guidelines E-Books Search Today's Posts Mark Forums Read

Go Back   MobileRead Forums > E-Book Software > Calibre

Notices

Reply
 
Thread Tools Search this Thread
Old 09-16-2018, 08: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, 10: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: 1,463
Karma: 5435106
Join Date: Jun 2010
Device: Windows 10 tablet,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
Advert
Old 09-16-2018, 11: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, 01: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: 55,410
Karma: 207827416
Join Date: Jul 2007
Location: Norfolk, England
Device: Kindle Voyage, Yotaphone 2
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, 01: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
Advert
Old 09-16-2018, 01: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: 1,463
Karma: 5435106
Join Date: Jun 2010
Device: Windows 10 tablet,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:	27
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:	27
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:	30
Size:	235.8 KB
ID:	166337

bernie
gbm is offline   Reply With Quote
Old 09-16-2018, 02: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, 05:47 PM   #8
Brett Merkey
Enthusiast
Brett Merkey is fluent in JavaScript as well as Klingon.Brett Merkey is fluent in JavaScript as well as Klingon.Brett Merkey is fluent in JavaScript as well as Klingon.Brett Merkey is fluent in JavaScript as well as Klingon.Brett Merkey is fluent in JavaScript as well as Klingon.Brett Merkey is fluent in JavaScript as well as Klingon.Brett Merkey is fluent in JavaScript as well as Klingon.Brett Merkey is fluent in JavaScript as well as Klingon.Brett Merkey is fluent in JavaScript as well as Klingon.Brett Merkey is fluent in JavaScript as well as Klingon.Brett Merkey is fluent in JavaScript as well as Klingon.
 
Posts: 49
Karma: 4868
Join Date: Jul 2015
Device: Paperwhite 3
@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 06:02 PM.
Brett Merkey is offline   Reply With Quote
Old 09-16-2018, 10: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: 33,739
Karma: 10215946
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

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

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


All times are GMT -4. The time now is 01:42 AM.


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