7

latex-mode is has a nice display of superscripts and subscripts. Not only are they reduced in size, but they are respectively raised and lowered a bit relative to the current line.

Q: How can I make part of the text in a line look like a superscript?

I know how to make text small (with the heightface property), but I don't know how to raise it. I tried to investigate latex-mode, but all I could find was that font-latex-superscript-face had a small height property (which doesn't account for the raising).

Malabarba
  • 22,878
  • 6
  • 78
  • 163

1 Answers1

7

Use the raise display property. As explained in (info "(elisp) Other Display Specs"):

`(raise FACTOR)'
     This kind of display specification raises or lowers the text it
     applies to, relative to the baseline of the line.

     FACTOR must be a number, which is interpreted as a multiple of the
     height of the affected text.  If it is positive, that means to
     display the characters raised.  If it is negative, that means to
     display them lower down.

     If the text also has a `height' display specification, that does
     not affect the amount of raising or lowering, which is based on the
     faces used for the text.

For AUCTeX specifically, this behavior is effected by font-latex-script and controlled by font-latex-script-display.

Sean Allred
  • 6,861
  • 16
  • 85
  • There is also `:ascent`, apparently. – Sean Allred Dec 04 '14 at 00:26
  • [`font-latex-script-display`](https://www.gnu.org/software/auctex/manual/auctex/Fontification-of-math.html) does, indeed, use the `raise` display property. – Dan Dec 04 '14 at 00:29