[ Bottom of Page | Previous Page | Next Page | Contents | Index | Library Home | Legal | Search ]

Commands Reference, Volume 1

cw or checkcw Command

Purpose

Prepares constant-width text for the troff command.

Syntax

cw+t | -t ] [  -d ] [  -f Font ] [  -l Delimiter ] [  -r Delimiter ] [  File ... ]

checkcw -l Delimiter ] [  -r Delimiter ] [  File ... ]

Description

The cw command preprocesses any specified troff files containing English-language text to be typeset in the constant-width (CW) font. The cw command reads standard input if you do not specify a file or if you specify a - (minus sign) as one of the input file names. The cw command writes to standard output.

Because output resulting from this command resembles the output of line printers and workstations, use this command to typeset examples of programs and computer output for user manuals and programming text. The cw command produces distinctive output when used with the Times Roman font.

The CW font contains a nonstandard set of characters. Any text typeset with this font requires different character and interword spacing from that used for standard fonts. Therefore, you must use the cw command to preprocess documents that use the CW font.

The CW font contains the following 94 ASCII printing characters:

abcdefghijklmnopqrstuvwxyz
ABCDEFGHIJKLMNOPQRSTUVWXYZ
0123456789
!$%&()`'*+@.,/:;=?[]|-_^~"<>{}#\

This font also contains 11 non-ASCII characters represented by 4-character troff strings (in some cases attaching these strings to nonstandard graphics).

The cw command recognizes five request lines as well as user-defined delimiters. The request lines look like troff macro requests. The cw command copies them in their entirety onto the output. Thus, you can define the requests as troff macros; in fact, the .CW and .CN macros should be so defined. The five requests are:

.CW Marks the start of text to be set in the CW font. This request causes a break. It can take the same flags (in the same format) as those available on the cw command line.
.CN Marks the end of text to be set in the CW font. This request causes a break. It can take the same flags (in the same format) as those available on the cw command line.
.CD Changes the delimiters and settings of other flags. It can take the same flags (in the same format) as those available on the cw command line. The purpose of this request is to allow the changing of flags other than at the beginning of a document.
.CP Option-list Concatenates all the options (delimited like troff macro options), with the odd-numbered options set in the CW font and the even-numbered options set in the prevailing font.
.PC Option-list Acts the same as the .CP macro, except the even-numbered options are set in CW font and the odd-numbered options are set in the prevailing font.

The .CW and .CN requests should bracket text that is to be typeset as is, using the CW font. Normally, the cw command operates in the transparent mode. In that mode, every character between .CW and .CN request lines represents itself, except for the .CD request and the special 4-character names listed previously. In particular, the cw command causes all . (periods) and ' (apostrophes) at the beginning of lines, and all \ (backslashes) and ligatures (such as fi and ff), to be hidden from the troff command. The transparent mode can be turned off by using the -t flag, in which case normal troff rules apply. In either case, the cw command hides from the user the effect of the font changes generated by the .CW and .CN requests.

You can also use the -l and -r flags to define delimiters with the same function as the .CW and .CN requests. These requests are meant to enclose words or phrases that are set in CW font in the running text. The cw command treats text between delimiters as it does text bracketed by .CW/.CN pairs, with one exception. Spaces within .CW/.CN pairs, have the same width as other CW characters, while spaces within delimited text are half as wide, so they have the same width as spaces in the prevailing text. Delimiters have no special meaning inside .CW/.CN pairs.

The checkcw command checks that left and right delimiters as well as the .CW/.CN pairs are properly balanced. It prints out all lines in the selection with the unmatched delimiters.

Notes:
  1. The . (period) or \ (backslash)delimiter characters should not be used.
  2. Certain CW characters do not combine well with certain Times Roman characters; for example, the spacing between a CW & (ampersand) followed by a Times Roman , (comma). In such cases, using troff half- and quarter-space requests can help.
  3. The troff code produced by the cw command is difficult to read.
  4. The mm macro package and mv macro package contain definitions of .CW and .CN macros that are adequate for most users. If you define your own macros, make sure that the .CW macro starts the troff no-fill (.nf) mode, and the .CN macro restores the fill mode (.fi), if appropriate.
  5. When set in running text, the CW font is meant to be set in the same point size as the rest of the text. In displayed matter, on the other hand, it can often be profitably set 1 point smaller than the prevailing point size. The CW font is sized so that, when it is set in 9-point, there are 12 characters per column inch.
  6. Documents that contain CW text can also contain tables and equations. In this case, the order of preprocessing must be the cw command, tbl command, and eqn command. Usually, the tables do not contain CW text, although it is possible to have elements in the table set in the CW font. Ensure that the cw command does not modify the tbl command format information. Attempts to set equations in the CW font are usually unsuccessful.
  7. In the CW font, overstriking is most easily accomplished with backspaces. Because spaces (and therefore backspaces) are half as wide between delimiters as inside .CW/.CN pairs, two backspaces are required for each overstrike between delimiters.
  8. Some devices such as the IBM 3816 Pageprinter do not have a CW font. You receive a troff can't open /usr/lib/font/devNAME/CW.out message for these devices. The troff command uses the font in font position 3 as the CW font.

Parameters

File Specifies troff English-language text files to be preprocessed by the cw command to produce constant-width characters in the output file.
File Specifies troff English-language text files to be preprocessed by the checkcw command to check right and left delimiters as well as .CW and .CN pair balance.

Flags

+t Turns the transparent mode on (this is the default).
-t Turns the transparent mode off.
-d Displays the current flag settings on the standard error output in the form of troff comment lines. This flag is meant for debugging.
-fFont Replaces the value of the Font variable with the cw command font (the default equals 3, which replaces the bold font). The -f5 flag is commonly used for formatters that allow more than four simultaneous fonts.

Note: This flag is useful only on the command line.
-lDelimiter Sets the left delimiter as the 1- or 2-character string specified by the Delimiter variable. The left delimiter is undefined by default.
-rDelimiter Sets the right delimiter to that specified by the Delimiter variable. The right delimiter is undefined by default. The left and right delimiters can (but need not) be different.

Related Information

The eqn command, mmt command, tbl command, troff command.

The mm macro package, mv macro package.

[ Top of Page | Previous Page | Next Page | Contents | Index | Library Home | Legal | Search ]