Armin Günther
Armin Günther

Reputation: 11

How to stack subscript and superscript in xsl-fo (without MathML)

Is there a way using xsl-fo to stack a subscript and a superscript attached to the same character (but without using MathML), e.g. x-square with index i:

x<sup>2</sup><sub>i</sub>

I tried this:

<fo:block>... x<fo:inline-container writing-mode="tb-rl" font-size="smaller">
        <fo:block-container glyph-orientation-vertical="0deg" >
           <fo:block>2i</fo:block>
        </fo:block-container>
    </fo:inline-container>
</fo:block>

But the result is not satisfactory in terms of spacing etc. I guess there is no good solution for this kind of stuff besides MathML - right?

Upvotes: 1

Views: 3297

Answers (1)

Kevin Brown
Kevin Brown

Reputation: 8877

You ask for a solution or a good solution? Of course there is a solution, but it requires knowledge of the fonts and characters and all the possibilities.

Given your question, I format this:

        <fo:block>X<fo:inline vertical-align="sub" font-size="8pt">2</fo:inline><fo:inline
                vertical-align="sup" padding-left="-3pt" baseline-shift="8pt" font-size="8pt"
                >i</fo:inline>
        </fo:block>

And I get this:

enter image description here

Upvotes: 2

Related Questions