Justify Command [J]
With Justify, you can do text formatting: center lines, right-justify lines, left-justify lines, and fill text into margins.
JUSTIFY [option] [keyword ...] [rangelist]
(Q=no display)
(Default option: Null or Set Justify)
When the Justify command is processing the range of lines you specified, if you decide not to continue, press Control-Y to stop the formatting.
Options Specify Which Function
Justify Right | right-justify each line |
Justify Center | center each line |
Justify Centre | Canadian spelling! |
Justify Left | remove leading spaces |
Justify Format | fill lines, ragged right margin |
Justify Both | fill lines, straight right margin |
Justify Null | default - no changes - safety |
Keyword Parameters of Justify
MARGIN column | right edge, relative to left |
TWO [ ON|OFF ] | maintain 2 spaces after . ? and ! |
INDENT spaces | indentation for list of points |
WITHINDENT | activate configured indentation |
STOP "chars" | break justification when found |
START "chars" | start new paragraph |
You may shorten options and keywords to the leading letters.
Rangelist Specifies Which Lines
For the Format and Both options, the rangelist specifies some lines to format. Warning: if you type a single line number (e.g., just both 5
), Qedit begins formatting lines from that line number to the end of the paragraph. Qedit sees blank lines as end-of-paragraph markers, so if you justify format all
you end up with smooth and even chunks of text, set off by blank lines. This is one of the few places in Qedit where a single line number implies a range of lines.
For the Left, Right and Center options, a single line rangelist means a single line. But, you can specify a "string" rangelist to center or justify only lines containing a string. Specifying a "string" rangelist with the Format or Both options is equivalent to specifying a single line number i.e. formatting starts with the line which has the string and continues to the end of the paragraph.
Verification Before Formatting
If Set Check Justify is ON, Justify Format and Both require user verification before formatting more than 5 lines. This should eliminate inadvertent formatting of entire source programs!
You can also use the Undo command to undo the effects of the Justify command.
Left and Right Edges for Justify
Justify works within borders called the left and right edge. The left edge is usually column 1, or column seven 7 in standard COBOL. The right edge is usually the highest column number allowed in the file (e.g., 80 for JOB files). However, if you use Set Left and Set Right to create margins for your file, Justify operates within those limits. Set Left will be the left edge and Set Right will be the right edge. You can also use the Margin keyword to establish the right edge for Justify, but remember that this edge is relative to any Set Left value.
Examples
/justify center 5/6 {center lines 5 through 6}
/j right 5/6 {right-justify lines 5 through 6}
/j left 5/6 {left-justify lines 5 through 6}
/j format 5/50 {format lines 5/50 into margins}
/j f 5/6 {splice lines 5 and 6 into one line}
/j both 5 {format a paragraph, even right edge,}
{ from line 5 to the next blank line}
Right Justifying Lines
Justify Right shifts each line of rangelist to the right until the last nonblank character is at the right edge. For example:
/justify right margin 50 rangelist
Input lines:
Robelle Solutions Technology Inc.
Tools for HP3000
Output lines:
Robelle Solutions Technology Inc.
Tools for HP3000
Centering Lines
Justify Center adjusts each rangelist line so that it is centered between the left edge and the right edge. For example:
/justify center margin 50 rangelist
Input lines:
Robelle Solutions Technology Inc.
Tools for HP3000
Output lines:
Robelle Solutions Technology Inc.
Tools for HP3000
Left Justifying Lines
Justify Left removes leading spaces from each rangelist line, until the left-most nonblank character is at the left edge. This will left-justify the lines. Use for this option to recover from an inadvertent Center or Right option. For example:
/justify left rangelist
Input lines:
Robelle Solutions Technology Inc.
Tools for HP3000
Output lines:
Robelle Solutions Technology Inc.
Tools for HP3000
Filling Words into Tidy Paragraphs
Justify Format adjusts the processed lines so that the words fill the space between the left edge and the right edge, but allows the right edge to be ragged:
/justify format margin 50 rangelist
Input lines:
The Format keyword performs a
function which is equivalent to .ad l
(left-justify) in nroff and troff.
Uneven lines are converted into lines
of about the same length.
Output lines:
The Format keyword performs a function which
is equivalent to .ad l (left-justify) in
nroff and troff. Uneven lines are converted
into lines of about the same length.
Making Both Edges Even
Justify Both is similar to Justify Format, except that both the left and right edges of the text are even. This is accomplished by inserting blanks between words. For example:
/justify both margin 50 rangelist
Input lines:
The Both keyword performs a
function which is equivalent to .ad b
(adjust both) in nroff and troff. Uneven
lines are converted into lines
of exactly the same length.
Output lines:
The Both keyword performs a function which is
equivalent to .ad b (adjust both) in nroff and
troff. Uneven lines are converted into lines of
exactly the same length.
Null Option
Justify Null is included as an option to serve as a default. If Both were the default option, most of your file would be quickly formatted if you accidentally typed "J 5" instead of "LJ 5".
Configuring the Justify Command
The five options (Right, Center, Left, Format, and Both) and the four keywords (Margin, Two, Indent, and Withindent), configure the Justify command. The hierarchy of configuration values is as follows:
Startup default (the "default default")
overridden by
SET Justify (the configured default)
overridden by
Keywords in Justify command
You set your own defaults for the Justify option and keyword values using Set Justify. Once you find the setting you like, you may want to put them in your Qeditmgr configuration file so you won't have to do the Set Justify command every time you run Qedit. For example:
/set justify null margin 50 two on
causes
/justify both 5
to be interpreted as
/justify both margin 50 two on 5
but you can override your own defaults, as in
/justify both margin 60 10/20
which merges with your Set Justify values to produce
/justify both margin 60 two on 10/20
Configuring the Right Edge
The Margin keyword specifies the right-most column for processed lines. This column is needed for the Right, Center, Format and Both options. The value you specify is relative to any Set Left margin that is effective at the time of the Justify command.
Determining the Left Edge
For the Both and Format options, the left margin is determined by looking at the first and second lines of each "paragraph". If the first and second line are indented, the entire paragraph will be indented. Of course, this indentation is relative to any Set Left.
/justify both margin 50 linenum
Input lines:
The Both keyword performs a
function which is equivalent to
.ad b (adjust both) in nroff and troff.
Uneven lines are converted into lines
of exactly the same length.
Output lines:
The Both keyword performs a function which is
equivalent to .ad b (adjust both) in nroff
and troff. Uneven lines are converted into
lines of exactly the same length.
Two Spaces at End of Sentence
Normally, when Qedit adjusts text with Format and Both, it inserts one space between each symbol, regardless of the number of spaces between symbols in the input text. If the Two keyword is ON, Justify maintains two blanks after the end of a sentence (i.e., after a . ? or !, or one of those three followed by a quote mark or a right parenthesis and a space). The default for this keyword is OFF.
Justify does not insert two spaces if the input only contains one; it merely maintains two spaces if they are there already (this means you don't have to worry about getting two spaces in a name like Calvin C. Cook).
/justify format two on margin 70 99.5/
Formatting a List of Points
The Indent keyword is a special capability for handling lists of numbered points (1., 2., 3., ...). It assumes that your text is indented and that the numbers for each point appear to the left of that indentation. The Indent parameter specifies the number of spaces at the start of each line that will not contain text to format. Justify leaves anything to the left of this border "as is". In fact, the existence of text to the left of the border acts as an "end-of-point" indicator, eliminating the need for a blank line between points to stop the justification. Indent is relative to any Set Left.
The end of each point in a list is effectively an end of paragraph. Here is a sample of what happens when you attempt to format a list of points without the Indent keyword:
/justify both margin 50 rangelist
Input lines:
1. Text which occurs in
a list of points should also
be formatted into even lines.
2. Any text to the left of column 5
causes a
"justification break".
Output lines:
1. Text which occurs in a list of points should
also be formatted into even lines. 2. Any
text to the left of column 5 causes a
"justification break".
All of the points have been run together into a single point. You can avoid this result by inserting a blank line at each point, or by doing Justify on each point individually, or by using the Indent keyword:
/justify both margin 50 indent 4 rangelist
Input lines:
1. Text which occurs in
a list of points should also
be formatted into even lines.
2. Any text to the left of column 5
causes a
"justification break".
Output lines:
1. Text which occurs in a list of points should
also be formatted into even lines.
2. Any text to the left of column 5 causes a
"justification break".
Activating Indentation
Withindent activates an Indent value that you have previously configured with Set Justify Indent. Withindent allows you to settle on a single indentation for all "lists of points" without having to respecify that value on every Justify command. You merely specify Withindent when you format a list of points:
/set justify indent 4 {configure potential indentation}
/justify format 5 {this is not a list of points}
/just f with 9 {this is a list of points}
Justification Breaks and Formatting Commands
Justify has options to define characters that start and/or stop justification when found in column one. These options make it much easier to justify text in files which contain embedded commands and special characters for a format program (e.g., Prose, TDP, etc.). The specific characters are defined using the Start and Stop options:
/set justify stop ".+" start "` "
This command says that any line with "." or "+" in column one stops text justification and that line is not changed. Any line with "`" or " " (space) in column one ends justification of the previous paragraph and signals a new paragraph (i.e., that line is formatted as part of the next paragraph).
It's important to note that a "string" rangelist has precedence over Start and Stop characters. In other words, the latter options are ignored.
Here is an example which justifies some text from a Robelle document that consists of both text and embedded Prose formatting directives. Note that lines beginning with "." and "+" are not altered, and the line beginning with "`" properly appears as a new paragraph.
/justify start "` " stop ".+" margin 50 format all
Input lines:
.for([ T S:40 // l55 / "-" pn:1 "-" /]
+ [ S T:40 // l55 / "-" pn:1 "-" /])
.par(f` p5 s1 u3).com Define ` as Start of Paragraph
.ent `|1Welcome to Compare|
.beginkey compare
Welcome to version 2.2 of Compare -- a
file comparison program for text files.
`Compare answers the question,
"How different are these two text files?"
Compare will tell you whether lines
have been added, or whether a block of
lines is now different.
Output lines:
.for([ T S:40 // l55 / "-" pn:1 "-" /]
+ [ S T:40 // l55 / "-" pn:1 "-" /])
.par(f` p5 s1 u3).com Define ` as Start of Paragraph
.ent `|1Welcome to Compare|
.beginkey compare
Welcome to version 2.2 of Compare -- a file
comparison program for text files.
`Compare answers the question, "How different are
these two text files?" Compare will tell you
whether lines have been added, or whether a block
of lines is now different.