Javatpoint Logo
Javatpoint Logo

Subscript in Markdown

Some markdown editors allows the use of subscript, where a character is placed at a slightly lower height than the normal character or number. We need to use a tilde symbol before and after the text. Subscripts are commonly used in mathematics, such as logarithmic and differential equations.

For example,

log 2~a~

Output:

log 2a

Here,

a is the subscript of log 2

The text inserted between the two tilde symbols will appear as the subscript and the text before and after the two tilde symbols will appear as the usual text.

There should be no space between the words, characters, symbols, or numbers placed inside the tilde symbols for subscript.

Note: There should be no space between the tildes and the text. Both the symbols and the text inside it should be written without any space. Otherwise, the tilde symbols will be considered as the text by default.

For example,

Normal Text ~SubscriptText~

Output:

Normal Text SubscriptText 

Error

The error arises when we insert an extra space between the symbols and text.

Let's the above example.

Normal Text ~ SubscriptText ~

There is one space before and after the text in both the cases.

Output:

Normal Text ~ SubscriptText ~

Reason: The output is the same as that of input. It is due to the extra space before and after the text, which is considered as text by default.

Subscript using HTML

To use the subscript command in HTML, we need to use the <sub> tag.

Syntax

<sub> ... </sub>

For example,

5 <sub> x <sub>

Output:

5x

Examples

Let's discuss an example based on subscript.

Example 1:

log 3 ~b~ + log 4 ~b~ + log 5 ~b~

Output:

Subscript in Markdown





Youtube For Videos Join Our Youtube Channel: Join Now

Feedback


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA