Contents | < Browse | Browse >
`@code'{SAMPLE-CODE}
--------------------

   Use the `@code' command to indicate text that is a piece of a
program and which consists of entire syntactic tokens.  Enclose the
text in braces.

   Thus, you should use `@code' for an expression in a program, for the
name of a variable or function used in a program, or for a keyword.
Also, you should use `@code' for the name of a program, such as `diff',
that is a name used in the machine. (You should write the name of a
program in the ordinary text font if you regard it as a new English
word, such as `Emacs' or `Bison'.)

   Use `@code' for environment variables such as `TEXINPUTS', and other
variables.

   Use `@code' for command names in command languages that resemble
programming languages, such as Texinfo or the shell.  For example,
`@code' and `@samp' are produced by writing `@code{@@code}' and
`@code{@@samp}' in the Texinfo source, respectively.

   Note, however, that you should not use `@code' for shell options
such as `-c' when such options stand alone. (Use `@samp'.) Also, an
entire shell command often looks better if written using `@samp' rather
than `@code'.  In this case, the rule is to choose the more pleasing
format.

   It is incorrect to alter the case of a word inside an `@code'
command when it appears at the beginning of a sentence.  Most computer
languages are case sensitive.  In C, for example, `Printf' is different
from the identifier `printf', and most likely is a misspelling of it.
Even in languages which are not case sensitive, it is confusing to a
human reader to see identifiers spelled in different ways.  Pick one
spelling and always use that.  If you do not want to start a sentence
with a command written all in lower case, you should rearrange the
sentence.

   Do not use the `@code' command for a string of characters shorter
than a syntactic token.  If you are writing about `TEXINPU', which is
just a part of the name for the `TEXINPUTS' environment variable, you
should use `@samp'.

   In particular, you should not use the `@code' command when writing
about the characters used in a token; do not, for example, use `@code'
when you are explaining what letters or printable symbols can be used
in the names of functions.  (Use `@samp'.)  Also, you should not use
`@code' to mark text that is considered input to programs unless the
input is written in a language that is like a programming language.
For example, you should not use `@code' for the keystroke commands of
GNU Emacs (use `@kbd' instead) although you may use `@code' for the
names of the Emacs Lisp functions that the keystroke commands invoke.

   In the printed manual, `@code' causes TeX to typeset the argument in
a typewriter face.  In the Info file, it causes the Info formatting
commands to use single quotation marks around the text.

   For example,

     Use @code{diff} to compare two files.

produces this in the printed manual:

     Use `diff' to compare two files.