IEEE Computer Society Style Guide

pdf icon  Download the IEEE Computer Society 2014 Style Guide


Program Code

Most Computer Society publications use a special font called "Program" to set program code—a sequence of coded instructions—whether in text or broken out. (The Transactions Department uses the Courier font for program code.) This monospace type allows consistent vertical alignment of characters. It also makes program code stand out from text (saying "this is not real English, so you're not supposed to understand it as natural language"), and it is easily recognizable as program code by most of our readers.

In text, set program code in a standard column width, using an indent to further set it off from narrative text. The width of the indent should be specified in your publication's style. The justification should always be ragged right.

If the lines of code are longer than a column width, box the code and put it across two or more columns. Magazines with 13-pica columns (three columns per page) often require boxed code. Code presented in this manner should be identified as a figure, and numbered as such, with a caption.

If a program line doesn't fit on a single printed line, break and indent it to indicate the continuation. Never add extra punctuation. Authors will often request continuation lines to be right-justified or will otherwise express strong preferences on this issue.

In general, try to duplicate the spacing, indentation, punctuation, and capitalization in the author's manuscript. Programming languages do not normally recognize boldface or italics, but these may be used by the author simply for emphasis.

Spacing is very important because omitting a space will often prevent a computer from recognizing a command or variable.

Indentations often indicate subsets of the program; although they are not necessary to the computer, indentations make a program easier to understand.


  • Do not substitute two single typesetting quotation marks (‘ ') or normal double typesetting quotation marks (" ") for typewriter quotation marks (").
  • Do not substitute a hyphen (-) for a minus sign (-).
  • Do not substitute a raised asterisk (*) for a multiplication asterisk (*).
  • Do not substitute an em dash (—) for two hyphens (--), which is a comment symbol in some languages.


Words or letters in programming languages generally represent commands (tokens) or variables. In Fortran and Basic, the general convention is to capitalize commands (such as IF, PRINT, FORMAT, GOTO) and variables (often I, N, X(N)). In C, Algol, and PostScript, these words and letters are lowercase.

Tokens in text

Set program commands or tokens in Program font type to distinguish them in text. Resist using boldface, italics, underlines, or super- and subscripting. If the language is case-sensitive (where a compiler does not see "do," "Do," "dO," and "DO" as equivalent), follow the language's rules. Most popular languages are not case-sensitive.


Ada, Algol, Anna, APL, assembly, Basic, Clu, Cobol, Fortran, job-control languages, Lisp (including Common Lisp), Logo, MS-DOS and other operating-system-level command interpreters (micro and mainframe), Occam, Pascal, PL/I, Prolog, SISAL, Snobol, and SQL.


ABC, C, C++, Eiffel, Interlisp, Loops (including the Common Loops and Concurrent Loops dialects), Modula-2, Prolog, and Smalltalk. Most case-sensitive languages are object oriented, although some are not (ABC, for example, is not object oriented). Some newer dialects of these languages may not be case-sensitive; check with the author.