11.1.6 Inserting ‘&’ with @& and @ampchar{}

Ordinarily, an ampersand ‘&’ is a normal character in Texinfo that can be simply typed in your input where you need it. The result is to typeset the ampersand character.

However, the ampersand character is treated specially in just one restricted context. In the argument to a definition command (see Definition Commands), an ampersand followed by a series of letters may be typeset specially when processing with TeX 7 (see Conventions for Writing Definitions). For example:

@defun foo integer1 &optional integer2 &rest integers
@code{foo} described here.
@end defun

may have ‘&optional’ and ‘&rest’ formatted in bold, even without any @-command involved.

So, in order to typeset an ampersand in such a context, it’s necessary to use @& or some other construct. Here’s an example of a C++ function taking a reference as a parameter:

@deftypefn Function int foo (const std::vector<int>@& @var{bar})
Documentation of @code{foo}.
@end deftypefn

This gives the output

Function: int foo (const std::vector<int>& bar)

Documentation of foo.

Although ‘@&’ and ‘@ampchar{}’ can be used nearly anywhere, there is no need for them anywhere except this unusual case.


Footnotes

(7)

This syntax is used for Emacs Lisp keywords. See A Sample Function Description in GNU Emacs Lisp Reference Manual.