11.1.5 Inserting ‘#’ with @hashchar{}

Ordinarily, a hash ‘#’ is a normal character in Texinfo that can be simply typed in your input where you need it. The result is to typeset the hash character from the current font.

This character has many other names, varying by locale, such as “number sign”, “pound”, and “octothorp”. It is also sometimes called “sharp” or “sharp sign” since it vaguely resembles the musical symbol by that name. In situations where Texinfo is used, “hash” is the most common in our experience.

However, Texinfo uses the hash character as a special character in one restricted context: to introduce the so-called #line directive and variants (see External Macro Processors: Line Directives).

So, in order to typeset an actual hash character in such a place (for example, in a program that needs documentation about #line), it’s necessary to use @hashchar{} or some other construct. Here’s an example:

@hashchar{} 10 "example.c"

Although ‘@hashchar{}’ can be used nearly anywhere, there is no need for it anywhere except this unusual case.