30.12.7 Justification in Formatted Text
When editing formatted text, you can specify various styles of
justification for a paragraph. The style you specify automatically
affects the Emacs fill commands.
The Justification submenu provides a convenient interface for specifying
the style. The submenu contains five items:
Left
- This is the most common style of justification (at least for English).
Lines are aligned at the left margin but left uneven at the right.
Right
- This aligns each line with the right margin. Spaces and tabs are added
on the left, if necessary, to make lines line up on the right.
Full
- This justifies the text, aligning both edges of each line. Justified
text looks very nice in a printed book, where the spaces can all be
adjusted equally, but it does not look as nice with a fixed-width font
on the screen. Perhaps a future version of Emacs will be able to adjust
the width of spaces in a line to achieve elegant justification.
Center
- This centers every line between the current margins.
Unfilled
- This turns off filling entirely. Each line will remain as you wrote it;
the fill and auto-fill functions will have no effect on text which has
this setting. You can, however, still indent the left margin. In
unfilled regions, all newlines are treated as hard newlines (see Hard and Soft Newlines) .
In Enriched mode, you can also specify justification from the keyboard
using the M-j prefix character:
- M-j l
- Make the region left-filled (
set-justification-left
).
- M-j r
- Make the region right-filled (
set-justification-right
).
- M-j b
- Make the region fully justified (
set-justification-full
).
- M-j c
- M-S
- Make the region centered (
set-justification-center
).
- M-j u
- Make the region unfilled (
set-justification-none
).
Justification styles apply to entire paragraphs. All the
justification-changing commands operate on the paragraph containing
point, or, if the region is active, on all paragraphs which overlap the
region.
The default justification style is specified by the variable
default-justification
. Its value should be one of the symbols
left
, right
, full
, center
, or none
.
This is a per-buffer variable. Setting the variable directly affects
only the current buffer. However, customizing it in a Custom buffer
sets (as always) the default value for buffers that do not override it.
See Locals, and Easy Customization.