Next: , Previous: Truncating the Stack, Up: Display Modes

7.7.9 Justification

Values on the stack are normally left-justified in the window. You can control this arrangement by typing d < (calc-left-justify), d > (calc-right-justify), or d = (calc-center-justify). For example, in Right-Justification mode, stack entries are displayed flush-right against the right edge of the window.

If you change the width of the Calculator window you may have to type d <SPC> (calc-refresh) to re-align right-justified or centered text.

Right-justification is especially useful together with fixed-point notation (see d f; calc-fix-notation). With these modes together, the decimal points on numbers will always line up.

With a numeric prefix argument, the justification commands give you a little extra control over the display. The argument specifies the horizontal “origin” of a display line. It is also possible to specify a maximum line width using the d b command (see Normal Language Modes). For reference, the precise rules for formatting and breaking lines are given below. Notice that the interaction between origin and line width is slightly different in each justification mode.

In Left-Justified mode, the line is indented by a number of spaces given by the origin (default zero). If the result is longer than the maximum line width, if given, or too wide to fit in the Calc window otherwise, then it is broken into lines which will fit; each broken line is indented to the origin.

In Right-Justified mode, lines are shifted right so that the rightmost character is just before the origin, or just before the current window width if no origin was specified. If the line is too long for this, then it is broken; the current line width is used, if specified, or else the origin is used as a width if that is specified, or else the line is broken to fit in the window.

In Centering mode, the origin is the column number of the center of each stack entry. If a line width is specified, lines will not be allowed to go past that width; Calc will either indent less or break the lines if necessary. If no origin is specified, half the line width or Calc window width is used.

Note that, in each case, if line numbering is enabled the display is indented an additional four spaces to make room for the line number. The width of the line number is taken into account when positioning according to the current Calc window width, but not when positioning by explicit origins and widths. In the latter case, the display is formatted as specified, and then uniformly shifted over four spaces to fit the line numbers.