PPTools/Guiguts/Rewrapping

From DPWiki
Jump to navigation Jump to search

Rewrapping and Margins

To rewrap means to adjust text so that all lines fit within specified margins. Guiguts does this by moving whole words from line to line. You control the rewrapping operation by setting margins and by marking up the text with markers such as /*..*/, which tell Guiguts how to handle blocks of text.

Default Margins

You set the default margins for rewrapping normal and block-quote text using "Preferences>Processing>Set Rewrap Margins...".

In the dialog you set the margins that apply anywhere in the document.

Guiguts rewrap preferences.png

You can override these default margins for particular blocks, as discussed below.

Hanging Hyphens

By default, when the rewrap operation finds a hyphen at the end of a line, it joins it to the first word in the next line. This is (usually) correct for English, but not for languages like German, where "hanging hyphens" are common and accepted. Under the Prefs menu look for an option, Leave Space After End-Of-Line Hyphens, which causes rewrap to leave hanging hyphens alone.

Rewrap Markers

The PGDP guidelines specify two type of rewrap markers: /#..#/ for block quotes, and /*..*/ for all other types of text that should not be rewrapped: poetry, tables, and lists. Guiguts supports several additional block markers which have varying effects on the rewrap rules, the indention, and the generated HTML:

Marker Rewrap Indent HTML
/*...*/ No rewrap Fixed, see text Preserves alignment; see here
/$...$/ No rewrap No indent Preserves alignment; see here
/#...#/ To Block Rewrap margins, see below As block quote; see here
/P...P/ No rewrap. 4 spaces As poetry; see here
/f...f/ No rewrap No indent Centered para; see here
/L...L/ No rewrap Fixed, see text Unsigned list; see here
/X...X/ No rewrap No indent Only <pre>, see here

Note:The opening and closing markers (/*, etc.) should stand alone on a line, but these markups must be preceded and followed by blank lines. If the blank lines are missing, Guiguts will fail to recognize either the beginning or the end of the markup and mis-wrapping will result.

Rewrap Commands

You command rewrapping by selecting text and applying the command Tools>Rewrap Selection.

Guiguts rewraps the selected text, adjusting unmarked text to the default margins and adjusting marked blocks according to the type of markup. Be patient as it can take a little while but you watch it work so know something is going on.

Rewrap operations are not compatible with Undo/Redo. If you rewrap to a wrong margin, select the text and rewrap it again to the correct margin.

Table Indent

By default, a table is indented the amount specified in the margins dialog. But you can set a specific indent for any table (/*..*/ markup) by placing an indent value, 0 or a positive integer, in brackets immediately after the opening /*. For example, this text:

/*[6]
  Some
Tabular
  Text
*/

will be changed as follows by the rewrapping operation:

/*[6]
        Some
      Tabular
        Text
*/

Block Quote Indent and Margins

By default, a block quote is rewrapped according to the margins specified in the margins dialog. But you can set a specific left margin, hanging indent, and right margin for any individual block quote (/#..#/ markup) by putting up to three numbers in brackets after the opening /#. In computerese, the syntax is: left[.first][,right] but for non-geeks, can be spelled out so:

/#[left] Wrap to left margin left, default right margin
/#[left,right] Wrap within margins left and right
/#[left.first] Wrap first line of each paragraph to margin first, remaining lines to left margin left, default right margin
/#[left.first,right] Wrap first line of each paragraph in margins first to right, other lines in margins left and right

For example, this quote:

/#[4.8,24]
I hope to find you well and expect to arrive Wednesday <i>inst</i>

Eugenie asks to be remembered to all with love.
#/

will rewrap as follows:

/#[4.8,24]
        I hope to find
    you well and expect
    to arrive Wednesday
    <i>inst</i> 

        Eugenie asks to
    be remembered to all
    with love. 
#/

A hanging indent may be done the same way if the first line is indented less than the others. For example this quote:

/#[8.4,24]
I hope to find you well and expect to arrive Wednesday <i>inst</i>

Eugenie asks to be remembered to all with love.
#/

will rewrap as follows:

/#[8.4,24]
    I hope to find you
        well and expect
        to arrive
        Wednesday
        <i>inst</i>

    Eugenie asks to be
        remembered to
        all with love. 
#/

You can change the margins midway through a block quote simply by closing it and starting a new block quote with different margin numbers.

Clearing Rewrap Markers

After the book has been rewrapped and you have inspected it to make sure that nothing is indented incorrectly, use Tools>Clean Up Rewrap Markers.

This deletes all the lines containing rewrap markers. From that point on, it is possible to rewrap blocks of plain text, but the only way to rewrap blocks of indented text is to add rewrap markers back in, rewrap, and remove the markers.