Code font in text
Most developer documentation uses code font for computer-language elements in text. Whether to use code font in text for other documents is a matter of judgment.
Use code font for all text fragments that represent expressions in a programming language.
Use code font for names of files, volumes, directories, and libraries.
StandardCRuntime.o
libraryMainProg.c
fileDon’t use a function or method name as a verb.
Correct: Run
ls
on both directories.Incorrect: ls both directories.
Correct: Use
cd
to change to the root directory.Incorrect: cd to the root directory.
Don’t mix fonts within a single word. Rewrite to avoid forming the plural of a word in code font.
Correct: values of type
integer
Incorrect:
integer
sUse regular text font, not code font, for punctuation following a word or phrase in code font, unless the punctuation mark is part of the computer-language element represented.
NAN(004)
,nan(4)
, andNaN
are examples of acceptable input.