On 07-Mar-10 11:17:34, Anton Shepelev wrote: > Ted Harding: > >> If you are using ms macros, then there are two number registers >> to watch out for: \n[PD] "paragraph drop" and \n[DD] "display >> drop". \n[PD] defines how much vertical space will be inserted >> before starting a new paragraph. \n[DD] defines how much vertical >> space will be inserted before *and after* a display. >> >> So your .DE followed by .LP will insert \n[DD]+\n[PD] between >> the bottom of the display and the top of the new paragraph. > > Hello, Ted, and thank you for your reply. According to what you > have said, it is impossible to have the same vertical space before > and after a display unless the PD register be set to zero. It > doesn't seem quite right to me. Why the asymmetry?
It is not an asymmetry. Rather, it is a symmetry (same space above and below the display, due to \n[DD]). The extra space is coming from the \n[PD] associated with .LP So if you inserted a display within a paragraph, on the lines of .LP This is a line of text .DS L Here is a display. .br Second line of display. .DE And a new line of text you would get the display within the paragraph offset by vertical space \n[DD] above and \n]DD] below which, in the context of your comments, is what you would want. However, if you do want to follow the display immediately with a new paragraph, you can undo the \n[PD] by means of an upward movement, as in .LP This is a line of text .DS L Here is a display. .br Second line of display. .DE .sp -\n[PD]u .LP And a new line of text (compare with what you get by omitting the line ".sp -\n[PD]u"). Note the use of "u" (device units): By the time \n[PD] is set, it is converted within groff to device units which, for the PS device (devps) is 1u = 1p/1000 so 1000u is 1 point. Hence, with the default (ms) setting of \n[PD] as 0.3 of the vertical line spacing (which, in turn, is by default the current point-size plus two points). So in 10-point text, the line spacing is 12 points, and \n[PD] is 3.6 points. Similarly, \n[DD] is 0.5 of the line spacing so would be 6 points in this case. So in devps the numerical value of \n[PD] would be 3600. However, the default scaling indicator for the .sp request is v (the line spaing), so without the "u" the request .sp -\n[PD] would attempt to move 3600 lines up the page! > Secondly, I couldn't find where the DD register is documented. > It's present neither in the MS man page nor in the groff online > manual... > > Anton Agreed; there needs to be an entry in the "Document control registers" section of 'man groff_ms' (which does have an entry for PD, etc.). What happens can be found (though this is the hard way ... ) by looking at the code in s.tmac in the section .\" *************************** .\" ******** module ds ******** .\" *************************** .\" Displays and non-floating keeps. where the macros .DS, .DE etc. are defined. One can find that the end of a display is finally rounded off by .de ds*common-end ....@reset .sp \\n[DD]u .. showing that the spacing \n[DD]u is added after the display ends. The default values of \n[PD] and \n[DD] are defined in the section .\" happens when the first page begins .de p...@init [...] .if !rPD .nr PD .3v>?\n(.V .if !rDD .nr DD .5v>?\n(.V "DD" has been documented (long ago) for traditional Unix troff. For instance, the Barron & Rees book "Text Processing and Typesetting with UNIX" (1987) states (page 363): DS Display Start .DS alignment indent Start unfilled text with keep. An amount of vertical space is output defined by the DD register followed by a switch to unfilled text. [...] DE Display End .DE Terminate the current display (as-is) text and the keep instigated by a previous DS request. Output an amount of vertical space defined by the DD register [...] Our Larry Kollar and collaborators have embarked on a project to update the O'Reilly book "Unix Text Processing" (also 1987) by Dale Dougherty and Tim O'Reilly (O'Reilly used to typeset all their books using troff). This can be found at http://home.windstream.net/kollar/utp If you look at the PDF version at http://home.windstream.net/kollar/utp/utp-1.0.pdf and go to page 478 of the book (page 489 of the PDF) you will see that DD does not get a mention here either! (In the section "Number Registers Containing Page Layout Defaults"), though PD does ... Hoping this helps, Ted. -------------------------------------------------------------------- E-Mail: (Ted Harding) <ted.hard...@manchester.ac.uk> Fax-to-email: +44 (0)870 094 0861 Date: 07-Mar-10 Time: 13:02:46 ------------------------------ XFMail ------------------------------