How to Add Subscript and Superscript Characters in WordPress

photo credit: Lori Greig - cc
photo credit: Lori Greigcc

Did you know that WordPress has built-in support for subscript and superscript characters? This information is not easy to find, as it’s tucked away under the Editing Help page in the codex.

Although the WordPress editor doesn’t show subscript and superscript buttons, you can add these characters anytime using the sub or sup tags. For example, to display H20, you would write it like this:

H<sub>2</sub>0

Superscript characters can be added like this:

My reference<sup>1</sup>

That above example would display: My reference1

Add Subscript and Superscript Buttons to the Visual Editor

There are many TinyMCE buttons that are disabled by default so as not to clutter up the WordPress editor with buttons that most people rarely use. If you find that you often need to add characters above or below the normal line of type, you may want to consider adding the Subscript and Superscript buttons to the visual editor for your own convenience.

The WordPress codex section on enabling hidden MCE buttons, which demonstrates how to filter the button list. You can create a quick functionality plugin using the snippet below:

function my_mce_buttons_2($buttons) {/*** Add in a core button that's disabled by default*/$buttons[] = 'sup';$buttons[] = 'sub';return $buttons;}add_filter('mce_buttons_2', 'my_mce_buttons_2');

Filtering mce_buttons_2 will add the buttons to the second line in the visual editor. Filtering mce_buttons_3 will display the added buttons on a third line.

new-buttons

For more technical writing that goes beyond basic subscript and superscript characters, you may need to employ an additional tool such as the open source LaTeX typesetting system. LaTeX makes it possible to post complex scientific and mathematical equations. Jetpack includes a LaTeX module and the WordPress Plugin Directory also has a wide assortment of LaTeX plugins.

There are 6 comments

Comments are closed.