.TH ADJUST 1 "HP EXPERIMENTAL" .ad b .SH NAME adjust \- simple text formatter .SH SYNOPSIS .B adjust [ .B \-bcjr ] [ .B \-m .I column ] [ .B \-t .I tabsize ] [ .I files... ] .SH HP-UX COMPATIBILITY .IP "Level:" 10 HP-UX/STANDARD .IP "Origin:" UCB/HP .SH DESCRIPTION This command is a simple text formatter for filling, centering, left and right justifying, or right-justifying text paragraphs, designed for interactive use. It reads the concatenation of input files (or standard input if none are given) and produces on standard output a formatted version of its input, with each paragraph formatted separately. If "\fB\-\fR" is given as an input filename, .B adjust reads standard input at that point. (You can use "\fB--\fR" as an argument to separate "\fB-\fR" from options.) .PP .B Adjust reads text from input lines as a series of words separated by blanks or tabs. Text lines are grouped into paragraphs separated by blank lines. By default, text is carried over to the output subject only to simple filling (see below), with a right margin of 72, and leading blanks converted to tabs where possible. .PP Options are: .TP .B \-b Do not convert leading blanks to tabs on output. Thus there are no tabs in the output. .TP .B \-c Center text on each line. Lines are pre- and post-processed, but no filling is done. .TP .B \-j Justify text. After filling, insert blanks in each line, except the last line of each paragraph, as needed to right-justify it, while keeping the justified left margin. .TP .B \-r After filling text, adjust each line for a smooth right margin (ragged left margin). .TP \fB\-m \fIcolumn\fR Set the right fill margin to the given column number, instead of 72. Text is filled, and optionally right justified, so that no output line extends beyond this column (if possible). If .B \-m0 is given, the current right margin of the first line of each paragraph is used for that and all subsequent lines in the paragraph. .IP "" By default, text is centered on column 40. With .BR \-c , the .B \-m option sets the middle column of the centering "window", but .B \-m0 auto-sets the right side as before (which then determines the center of the "window"). .TP \fB\-t \fItabsize\fR Set the tab size to other than the default (eight columns). .PP Only one of the .BR \-c , .BR \-j , and .B \-r options is allowed at once. .SS Details Before doing anything else to a line of input text, .B adjust first handles backspaces, rubbing out preceding characters in the usual way. Next it ignores all non-printable characters except tab. Then it expands all tabs to blanks. .PP For simple text filling, the first word of the first line of each paragraph is indented the same amount as in the input line. Each word is then carried to the output followed by one blank. "Words" ending in [][] are followed by two blanks, where is any of ".:?!", is a single or double quote, and is any of ")]}", e.g.: .nf .RS end. of? sentence.' sorts!" of.) words?"] .fi .RE .PP The program starts a new output line whenever adding a word (other than the first one) to the current line would pass the right margin. .PP .B Adjust understands indented first lines of paragraphs. The second and subsequent lines of each paragraph are indented the same amount as the second line of the paragraph in the input, if there is a second line, else the same as the first line. .PP .B Adjust has a rudimentary understanding of tagged paragraphs when filling. If the second line of a paragraph is indented more than the first, and the first line has a word beginning at the same indentation as the second line, the column positions of the tag words (prior to that one) are "frozen" (not altered). Tag words are passed through without change of column position, even if they extend beyond the right margin. The rest of the line is filled or right-justified from the position of the first non-tag word. .PP When .B \-j is given, .B adjust uses an intelligent algorithm to insert blanks in output lines where they are most needed, until the lines extend to the right margin. First, all one-blank word separators are examined. One blank is added first to those separators with the most total letters in the words on both sides. If all one-blank separators are increased to two blanks, and more blanks must be inserted, it repeats the algorithm, this time with two-blank separators, and so on. .PP Output line indentation is held to one less than the right margin. If a single word is larger than the line size (right margin minus indentation), that word appears on a line by itself, properly indented, and extends beyond the right margin. However, if .B \-r is used, such words are still right-justified, if possible. .SH EXAMPLES This command is useful for filtering text while in .IR vi (1). For example, .nf .RS !}adjust .RE .fi .PP reformats the rest of the current paragraph (from the current line down), evening the lines. .PP You can give the .B vi command: .nf .RS :map ^X {!}adjust -j^V^M .RE .fi .PP (where "\fB^\fR" denotes control characters) to set up a useful "finger macro". Then typing ^X will reformat the entire current paragraph. .PP Note that .B adjust -m1 is a simple way to break text into separate words, without white space, except for tagged paragraphs tags. .SH "SEE ALSO" nroff(1) .SH DIAGNOSTICS .B Adjust complains to standard error and later returns a non-zero value if any input file cannot be opened (it skips the file). It does the same (but quits immediately) if the argument of .B \-m or .B \-t is out of range, or if the program is improperly invoked. .PP Input lines longer than BUFSIZ are silently split (before tab expansion) or truncated (afterwards). Lines too wide to center begin in column 1 (no leading blanks). .SH BUGS This program is designed to be simple and fast. It does not recognize backslash to escape white space or anything else. It does not recognize tagged paragraphs where the tag is on a line by itself. It knows that lines end in newline or null, and how to deal with tabs and backspaces, but it does not do anything special with other characters like form feed (they are just ignored). For complex operations, the standard text processors are likely to be more appropriate. .PP This program could (should?) be implemented instead as a set of programs, fill, center, and justify (with -r option). However, this would be much less efficient in actual use, especially given the program's special knowledge of tagged paragraphs and last lines of paragraphs. .PP These options were considered but not added, because the creeping featurism had to stop somewhere, before this program became another nroff(1): .TP .B \-h Hyphenate. Allows the program to break and join words at existing hyphens (only). Words are broken across lines, at single hyphens surrounded by non-whitespace characters. Likewise, a word ending in a single hyphen, followed by whitespace, followed by a non-hyphen character, is joined to the next word without whitespace if needed. .TP .B \-n Nofill. Only allowed with .B \-j or .BR \-r , it inhibits filling, i.e. words are not moved from one line to another. Thus existing text can be left/right or right justified without being otherwise modified. (Note that .B \-n is always in effect for .BR \-c , centering.)