subscript, superscript

Bug #170324 reported by Bug Importer on 2004-07-07
This bug affects 24 people
Affects Status Importance Assigned to Milestone
Tavmjong Bah
Nominated for Old by Hatta

Bug Description

Subscripted and superscripted text display is pure mess
in inkscape 0.39cvs, and the previous versions as well.

        <text x="470" y="406"
style="font-family:Helvetica; font-size:18pt;
            <tspan style="font-size:14pt"
is displayed as some funny overlapping characters. It
is obvious that the basic baseline-shift="sub" and
baseline-shift="sup" tag code is still broken, or even
missing in the inkscape sources.

In my humble opinion the authors should not concentrate
to much to the fancy eye-popping features but they
should bring the real productivity work needs into
focus instead (as this bug has been reported months ago).

R.Liboska,PhD. <email address hidden>

Related branches

The development direction is determined by many factors,
including difficulty of implementation, availability of the
underlying infrastructure in the codebase, and developers'
needs. In particular, what is "eye-popping" for you may be
absolutely essential for a developer (who is also a user),
and vice versa. If you want to affect this more, join the
development team.

As for this particular feature, implementing it requires
first implementing proper support for tspans, and that
requires implementing in-text selection UI which is
currently missing. All this is in our plans, but it's a
tremendous amount of work and we're moving towards it

Originator: NO

Please implement this already. It's been years.

"If you want to affect this more, join the development team."

Wouldn't it be nice if everyone could code?

Originator: NO

Actually, since tspans and text selection work already, it should not be
too difficult to implement sub/sup. Cyreve, what do you think?

Richard Hughes (cyreve) wrote :

Originator: NO

Since baseline-shift does not change the font size itself, it can
trivially be emulated using kerning for non-flowed text. The issues with
doing it properly are to add handling to the style system, and get the
correct baseline shift from the font. Neither of these are difficult, but I
haven't got around to it yet.

Dvlierop2 (dvlierop2) wrote :

Originator: NO

Cyreve, it would be absolutely marvelous if this could be implemented. I'm
really dying for this one, too bad I 'm not skilled enough to do this
myself ;-)

Ryan Lerch (ryanlerch) on 2007-12-14
Changed in inkscape:
importance: Low → Wishlist
status: New → Confirmed
Jim Pivarski (jpivarski) wrote :

I second (or third, or fourth, or whatever) this request for Inkscape to properly render *-baseline SVG properties. I'm creating SVG files with plotting software that vertically aligns text labels with these attributes; it looks okay in Firefox, but not in Inkscape, where I'd like to edit them (or in Inkview, where I'd like to get a quick look at the plot). Beyond looking bad, the y-axis labels can be misleading if they're off by one tick-mark. This is not just a wishlist item, but also an SVG-correctness issue, or a file-reading bug.


I agree. If it's not a huge effort, I think it should be high priority. I and a number of colleagues want to use (and do use, sometimes) inkscape for making posters, for scientific conferences etc. Not being able to do sub/superscripts in flowing text is really a huge functionality hole for this usage, and it appears inconsistent.

(You may argue that inkscape is not the right tool for this kind of job, but I don't think it's intrinsically less suitable than e.g. powerpoint, which is what most people seem to use. Scribus, which might be more suitable, has a much higher learning threshold than inkscape, and I don't like it as much.)

The LaTeX rendering extension is useful, but not practical for large pieces of text. Inability to do (easily) sub/superscript in any inkscape text is, in my experience, the one thing putting most people off inkscape for the purpose of scientific posters, presentations etc. Well that, and the sometimes flaky pdf/eps export, but that is off topic :)

Hatta (hatta00) wrote :

I'll throw my hat in this one. I also want to use Inkscape for drawing scientific figures, but the text handling is just not there. I *need* superscripts.

I'm just going to have to go back to photoshop. :( Please, do something about this.

Andy Walker (walkeraj) wrote :

I concur. If you are going to add features such as "create diagram connectors", it is utterly essential that you include sub and superscript, as these are indispensable for generating these very same diagrams. Most useful diagrams that I am aware of (including the large one I was just now considering using Inkscape for) make use of sub or superscript in at least one place, whether it be to refer to a variant, exception, or other notation.

logari81 (logari81) wrote :

I need this feature too.

alkemyst (stefano-mersi) wrote :

Me too

L_F_B (lars-behrens) wrote :

Yepp, also needed badly here, for a working group of scientists.
For creating scientific drawings, sub/superscript is absolutely essential.

I add my humble "me too" to this. Even a "dummy" implementation like the one in xfig would be better than nothing, although having a mechanism similar to the one in xcircuit would be great.

Please implement it; otherwise the usability of inkscape in scientific tasks is greater reduced. Thanks.

I just used Inkscape to make a scientific poster for a conference. It did suit my needs perfectly well - with exactly this exception: subscript and superscript. For a few ones, manual kerning can do the trick, but it's not possible in flow text, and not feasible for a large number of occurrences. It would be great to see this on the roadmap for the upcoming 0.48 (i understand development for 0.47 is about to be frozen).

Leo (leopoldo-pena) wrote :

Absolutely essential. I'm scientist too and this is a must for us. I love inkscape but I'd love it even more with that feature.
What I'm doing now is editing my text in scribus (that has super sub script support) and export the text to inkscape.

pepa_u (josef-uher) wrote :

Well, what else to add. I need super/subscript too! I have always used CorelDraw for creating my scientific posters, but InkScape is for this purpose at least as good as Corel, with one exception - sub/superscript. It would be great to have it implemented.

hechz (mars-photosphere) wrote :

I shall throw my 2¢ in the pot as well. Building molecular diagrams with inkscape would be quite nice if I could only sub and superscript text within a block. Writing Formulæ without it is rather irksome.

sv3t (tassev) wrote :

PLEASE, implement this feature! It's absolutely essential for me as well.

dr_who (dr-who-freemail) wrote :

Why can't somebody implement this?! It's been for more than five years when the need first appeared on this page. Is there any reason other than ignorance not to implement this? Working with formulas is not an uncommon task as you can see...

0.47 has just been released. In the release notes there is no hints about super/subdcript. Has anyone tested it? I am sorry to say that without them inkscape is almost unusable for scientific tasks...

su_v (suv-lp) on 2010-01-05
tags: added: styles
Sam S. (smls) wrote :

I would also really love to see this feature implemented...

Inkscape is a *so* much better choice than conventional word processors for creating compact cheat sheets / posters / etc. for science/math/engineering content, but the lack of proper subscript & superscript support is a major inconvenience...

It's not just about standalone mathematical formulae... (for those, there is always the textext plugin!)
Many simple things like
  - footnotes/citations
  - ordinal indicators (1ˢᵗ, 2ⁿᵈ, 3ʳᵈ, ...)
  - indexed/named variables (x_i, v_first, v_last, ...)
  - chemical compounds (H₂O, ...)
  - charges of subatomic particles (μ+, e⁻, ...)
  - copyright/trademark symbols (℠, ™, ©, ®, ...)
and many many more, *really* need support for sub-/superscript within normal text...

Please consider adding this feature to Inkscape...

Mathijs de Meijer (mdemeijer) wrote :

Excellent explanation smls, I agree wholeheartedly.

I'm afraid that the lack of proper sub- and superscript is a major drawback when it comes to scientific drawings. I'm currently typesetting with latex and then importing the eps to inkscape, which is just ridiculously tedious. I'd be happy to help coding if someone could point me where to start. I suppose that using the implementation of the "italic" button as a template should be a good starting point?

Found a solution that I can live with: I've patched the LaTeX import extension so that custom packages can be used. This allows typesetting with sans-serif fonts for example. The patch is attached to bug #555128.

Tavmjong Bah (tavmjong-free) wrote :

In v0.48 the dy (y shift) attribute can be set from the text toolbar. This coupled with changing the font size can be used to typeset superscripts and subscripts.

SVG 1.1 doesn't appear to include much support for superscripts and subscripts. The baseline-shift attribute does have "sub" and "super" values. These are not well defined (different SVG viewers can shift the superscripts and subscripts by different amounts). Using baseline-shift will not automatically change font size.

To properly support superscripts and subscripts, Inkscape would probably have to add -inkscape-superscript and -inkscape-subscript attributes. This would then be used to automagically change the dy and font-size values. It would be some work to code. As a medium term solution, one could implement baseline-shift. If it is set to "super" or "sub" then Inkscape would assume that the text is a superscript or subscript. Font-size would be decreased or increased along with adding or removing the baseline-shift.

A short term solution would be to add extensions to create superscripts and subscripts. These could them be tied to keyboard shortcuts.

BTW, Scribus appears to export text as paths to SVG.

Hi Tavmjong, thanks for exposing the dy in the GUI, this already makes it a more acceptable workaround!

Tavmjong Bah (tavmjong-free) wrote :

I've added support for baseline-shift to Inkscape trunk. I've also added buttons on the text toolbar for superscripts and subscripts (they are missing correct icons at the moment). Superscript and subscript support uses the "sub" and "super" tags as I described in an earlier post. Please check it out and give me your feedback. Release of Inkscape 0.48 will be soon so prompt response would be appreciated.

I have a couple of questions about superscripts and subscripts:

1. What should the baseline shifts be for superscripts and subscripts. The SVG standard does not specify the shift. It does recommend using baseline information from the font but this data isn't easy to access (and may not be in most fonts). OpenOffice and Adobe use offsets of +/-0.33 of the font size, Word +0.35/-0.14. LaTeX appears to use +0.45/-0.2. Note, other SVG viewers are free to choose other values. Opera and Chrome support baseline-shift and seems to use +/-0.33 for scripts. Firefox trunk does not support baseline-shift. Squiggle (Batik) uses larger values.

2. What should the font-size reduction be? OpenOffice and Adobe use 58%, Word 65%, LaTex approximately 70%. Eventually this could be customizable and stored as a preference.

L_F_B (lars-behrens) wrote :

Maybe you can get ideas from Scribus? From my point of view it would be best to make baseline shifts adjustable, just like they did.
Don't know if that's possible though.


Running a nightly version of Inkscape, support for sub- and superscript text is implemented now. This works even in flow text. This addition is also mentioned in the preliminary version of the 0.48 release notes.

Thanks to whoever made this happen!

Changed in inkscape:
status: Confirmed → Fix Committed
su_v (suv-lp) wrote :

Support for baseline-shift attribute (sub-, superscript) added in revision 9475 (refined in 9481, 9487, 9489, 9490) by Tavmjong Bah.

Changed in inkscape:
assignee: Richard Hughes (cyreve) → Tavmjong Bah (tavmjong-free)
milestone: none → 0.48
jazzynico (jazzynico) on 2010-08-24
Changed in inkscape:
status: Fix Committed → Fix Released
Sam S. (smls) wrote :


Paul A. Bristow (pbristow) wrote :

This is great! Many Thanks.

BUT the browser rendering doesn't seem up to Inkscape/Inkview yet :-(

I've got a small test using both.

Firefox 3.6.8 creates a big rectangle and a mess with no subing or superring :-(

Chrome does m sec-1 with 1 superscripted, but more text missing

IE 8 with Adobe plugin gets the subs and super right, but the text positioning is wrong.

Hope others can do better!

This a realy, really, really important feature for many reasons as mentioned above.


To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers

Related questions