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).

  • (meekly says hello to the first question posted from sx.el) – Sean Allred Dec 4 '14 at 0:22
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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.