diff -ur groff-1.21/ChangeLog groff-1.21.1/ChangeLog --- groff-1.21/ChangeLog 2010-12-31 07:33:08.000000000 +0000 +++ groff-1.21.1/ChangeLog 2011-05-07 21:07:44.000000000 +0100 @@ -1,3 +1,17 @@ +2011-05-07 George HELFFRICH + + Implement full support for line numbering operations with -me macros. + + * tmac/e.tmac: Changes to macros. + * doc/meref.me: Document changes. + + Implement full support for line numbering in tables. + + * src/preproc/tbl/table.cpp: Change preprocessor to make it aware of + line numbering. + + * REVISION: Increment revision number to 1. + 2010-12-31 Werner LEMBERG Version 1.21 released diff -ur groff-1.21/REVISION groff-1.21.1/REVISION --- groff-1.21/REVISION 2010-12-31 07:33:08.000000000 +0000 +++ groff-1.21.1/REVISION 2011-05-07 21:07:44.000000000 +0100 @@ -1 +1 @@ -0 +1 diff -ur groff-1.21/doc/meref.me groff-1.21.1/doc/meref.me --- groff-1.21/doc/meref.me 2010-12-31 07:33:09.000000000 +0000 +++ groff-1.21.1/doc/meref.me 2011-05-07 21:07:48.000000000 +0100 @@ -1329,12 +1329,20 @@ .TL .b .n2 .i N +.i c .DE Number lines from .i N , stop if .i N -= 0. += 0 or missing; resume where stopped if +.i N +is +0. +If +.i c +is c, maintain compatibility with original +.b .n2 +by narrowing line width to accommodate numbers. .TL .b .sk .DE diff -ur groff-1.21/doc/webpage.ms groff-1.21.1/doc/webpage.ms --- groff-1.21/doc/webpage.ms 2010-12-31 07:33:09.000000000 +0000 +++ groff-1.21.1/doc/webpage.ms 2011-05-07 21:07:48.000000000 +0100 @@ -289,6 +289,31 @@ Each of these web pages also provides a link to a browseable archive of postings to the corresponding mailing list. + +. +. +.SH +NEWS VERSION 1.22 +.LP +.SH 2 +macro packages + +.ULS +.LI +Bugs in the support for the .n1 and .n2 requests in the me package were fixed +that caused extra line numbers to be added to text in floats and diversion +environments, as well as equations. +The .TH macro was changed for compatibility with line number support in tables. +.ULE +. +. +.SH 2 +tbl + +.ULS +.LI +Added numbered line support in tables. +.ULE . . .SH diff -ur groff-1.21/src/preproc/tbl/table.cpp groff-1.21.1/src/preproc/tbl/table.cpp --- groff-1.21/src/preproc/tbl/table.cpp 2010-12-31 07:33:08.000000000 +0000 +++ groff-1.21.1/src/preproc/tbl/table.cpp 2011-05-07 21:07:45.000000000 +0100 @@ -59,6 +59,11 @@ #define REPEATED_VPT_MACRO PREFIX "rvpt" #define SUPPRESS_BOTTOM_REG PREFIX "supbot" #define SAVED_DN_REG PREFIX "dn" +#define ROW_START_LINE_REG PREFIX "lnst" +#define ROW_SAVE_LINE_REG PREFIX "lnsv" +#define ROW_MAX_LINE_REG PREFIX "lnmx" +#define REPEATED_NM_SET_MACRO PREFIX "rlns" +#define REPEATED_NM_SUS_MACRO PREFIX "rlnx" // this must be one character #define COMPATIBLE_REG PREFIX "c" @@ -1780,7 +1785,33 @@ ".de " REPEATED_VPT_MACRO "\n" ".vpt \\$1\n" ".if !'\\n(.z'' \\!." REPEATED_VPT_MACRO " \"\\$1\"\n" - "..\n"); + "..\n" + ".de " REPEATED_NM_SET_MACRO "\n" + ".ie !'\\n(.z'' \\{.nm\n" + "\\!." REPEATED_NM_SET_MACRO " \"\\$1\"\n" + ".\\}\n" + ".el .if \\n[ln] \\{\\\n" + ".if '\\$1'd' .nr " ROW_START_LINE_REG " \\n[ln]\n" + ".if '\\$1's' .nm \\n[" ROW_START_LINE_REG "]\n" + ".if '\\$1'm' .nr " ROW_MAX_LINE_REG " \\n[ln]>?\\n[" ROW_MAX_LINE_REG "]\n" + ".\\}\n" + "..\n" + ".de " REPEATED_NM_SUS_MACRO "\n" + ".ie !'\\n(.z'' \\{.nm\n" + "\\!." REPEATED_NM_SUS_MACRO " \"\\$1\"\n" + ".\\}\n" + ".el .if \\n[ln] \\{\\\n" + ".ie '\\$1's' \\{\\\n" + ".nr " ROW_SAVE_LINE_REG " \\n(ln?\\n[.V]u\n" ".ls 1\n" + "." REPEATED_NM_SUS_MACRO " s\n" "\\v'" BODY_DEPTH "'" "\\s[\\n[" LINESIZE_REG "]]"); if (r > nrows - 1) @@ -2304,7 +2343,8 @@ } } prints("\\s0\n"); - prints(".ls\n" + prints("." REPEATED_NM_SUS_MACRO " r\n" + ".ls\n" ".vs\n"); } @@ -2313,6 +2353,7 @@ prints(".vs " LINE_SEP "+" DOUBLE_LINE_SEP ">?\\n[.V]u\n" ".ls 1\n" + "." REPEATED_NM_SUS_MACRO " s\n" "\\v'" BODY_DEPTH "'" "\\s[\\n[" LINESIZE_REG "]]"); if (r > nrows - 1) @@ -2371,6 +2412,7 @@ } } prints("\\s0\n" + "." REPEATED_NM_SUS_MACRO " r\n" ".ls\n" ".vs\n"); } @@ -2571,7 +2613,8 @@ print_single_hline(0); prints(".\\}\n"); } - prints(".ls 1\n"); + prints("." REPEATED_NM_SUS_MACRO " s\n" + ".ls 1\n"); for (vertical_rule *p = vrule_list; p; p = p->next) p->contribute_to_bottom_macro(this); if (flags & DOUBLEBOX) @@ -2588,7 +2631,8 @@ ".sp -1\n" "\\v'" BODY_DEPTH "'\\h'|\\n[TW]u'\\s[\\n[" LINESIZE_REG "]]" "\\D'l 0 |\\n[" TOP_REG "]u-1v'\\s0\n"); - prints(".ls\n"); + prints("." REPEATED_NM_SUS_MACRO " r\n" + ".ls\n"); prints(".nr " LAST_PASSED_ROW_REG " \\n[" CURRENT_ROW_REG "]\n" ".sp |\\n[" SAVED_VERTICAL_POS_REG "]u\n" "." REPEATED_VPT_MACRO " 1\n" @@ -2659,6 +2703,8 @@ // we might have had a .TH, for example, since we last tried if (!(flags & NOKEEP) && row_begins_section(r)) prints("." KEEP_MACRO_NAME "\n"); + prints("." REPEATED_NM_SET_MACRO " d\n" + ".nr " ROW_MAX_LINE_REG " \\n[ln]\n"); printfs(".mk %1\n", row_start_reg(r)); prints(".mk " BOTTOM_REG "\n" "." REPEATED_VPT_MACRO " 0\n"); @@ -2755,6 +2801,7 @@ table_entry *e = entry[r][c]; if (e) { if (e->end_row == r && e->to_simple_entry() == 0) { + prints("." REPEATED_NM_SET_MACRO " s\n"); e->position_vertically(); e->print(); prints(".nr " BOTTOM_REG " \\n[" BOTTOM_REG "]>?\\n[.d]\n"); @@ -2763,7 +2810,8 @@ c = e->end_col; } } - prints("." REPEATED_VPT_MACRO " 1\n" + prints("." REPEATED_NM_SET_MACRO " m\n" + "." REPEATED_VPT_MACRO " 1\n" ".sp |\\n[" BOTTOM_REG "]u\n" "\\*[" TRANSPARENT_STRING_NAME "].nr " NEED_BOTTOM_RULE_REG " 1\n"); if (r != nrows - 1 && (flags & ALLBOX)) { @@ -2791,6 +2839,7 @@ if (!(flags & NOKEEP) && row_ends_section(r)) prints("." RELEASE_MACRO_NAME "\n"); } + prints(".if \\n[ln] .nr ln \\n[" ROW_MAX_LINE_REG "]\n"); } void table::do_top() @@ -2799,7 +2848,8 @@ if (!(flags & NOKEEP) && (flags & (BOX | DOUBLEBOX | ALLBOX))) prints("." TABLE_KEEP_MACRO_NAME "\n"); if (flags & DOUBLEBOX) { - prints(".ls 1\n" + prints("." REPEATED_NM_SUS_MACRO " s\n" + ".ls 1\n" ".vs " LINE_SEP ">?\\n[.V]u\n" "\\v'" BODY_DEPTH "'\\s[\\n[" LINESIZE_REG "]]\\D'l \\n[TW]u 0'\\s0\n" ".vs\n" @@ -2813,8 +2863,9 @@ "\n", column_divide_reg(0), column_divide_reg(ncolumns)); - prints(".ls\n" - ".vs\n"); + printfs("." REPEATED_NM_SUS_MACRO " r\n" + ".ls\n" + ".vs\n"); } else if (flags & (ALLBOX | BOX)) { print_single_hline(0); @@ -2836,6 +2887,10 @@ ".T#\n"); if (!(flags & NOKEEP) && (flags & (BOX | DOUBLEBOX | ALLBOX))) prints("." TABLE_RELEASE_MACRO_NAME "\n"); + else + prints(".if \\n[ln] \\{.nm\n" + ".nr ln \\n[" ROW_MAX_LINE_REG "]\n" + ".\\}\n"); if (flags & DOUBLEBOX) prints(".sp " DOUBLE_LINE_SEP "\n"); prints("." RESET_MACRO_NAME "\n" diff -ur groff-1.21/tmac/e.tmac groff-1.21.1/tmac/e.tmac --- groff-1.21/tmac/e.tmac 2010-12-31 07:33:09.000000000 +0000 +++ groff-1.21.1/tmac/e.tmac 2011-05-07 21:07:47.000000000 +0100 @@ -253,7 +253,7 @@ . sp |\\n(tmu \" move to top of text .ev .mk _k \" for columned output -.if \\n(?n .nm 1 \" restore line numbering if n1 mode +.if \\n(?n=1 .nm 1 \" restore line numbering if n1 mode .nr $c 1 \" set first column .if \n@>4 .tm -- @h >> .ns nl=\\n(nl %=\\n% _k=\\n(_k tm=\\n(tm .ie \\n(?s \ @@ -297,9 +297,13 @@ .if \\n(?T \ \{\ . nr _i \\n(.i +. if \\n(?n \ +. nm \\n(ln . in 0 . |h\" \" output the table header . in \\n(_iu +. if \\n(?n \ +. nm . rr _i . mk #T \" for tbl commands . ns @@ -351,7 +355,11 @@ .in 0 .if \n@>2 .tm @o last printed text = \\n(nl placing @r trap at -\\n(_B .wh -\\n(_Bu @r +.if \\n(?n \ +.nm \\n(ln .|f +.if \\n(?n \ +.nm .fi .if \n@>2 .tm @o triggered @r (?o) = \\n(?o .if \\n(?o \ @@ -394,9 +402,13 @@ . sz \\n(tp\" \" set header/footer type fonts, etc. . @F \\n(tf . lt \\n(_Lu \" make title span entire page +. if \\n(?n \ +. nm \\n(ln . nf . \\$1 . br +. if \\n(?n \ +. nm .\} .. . @@ -506,16 +518,25 @@ . .de n1 \" *** line numbering 1 .nm 1 -.xl -\w'0000'u +.ll -\w'0000'u .nr ?n 1 .. . .de n2 \" *** line numbering 2 .nm \\$1 -.ie \\n(.$ \ -. xl -\w'0000'u -.el \ -. xl \\n($lu +.ie \\n(.$ \{\ +.ie !`\\$2`c` .po -\w'0000'u +.el .ll -\w'0000'u +.if `\\$1`+0` .nr ln \\n[_ln] +.nr ?n 2 +.\} +.el \{\ +.nr _ln \\n(ln +.po +\w'0000'u +.ll \\n($lu +.nr ?n 0 +.nr ln 0 +.\} .. . .de pa \" *** new page @@ -868,7 +889,7 @@ .rr _0 .if !\\n(?b \ . nr dn +(\\n(ppp*\\n($vu)/200u+\\n(zsu -.nr dl -\n(.H \" fudge factor necessary to make it work +.nr dl -\n(.H .ie ((\\n(dn+\n(.V)>=\\n(.t):(\\n(?a):((\\n(dl>\\n($l)&(\\n($c>1)) \ \{\ . nr ?a 1 @@ -914,7 +935,11 @@ .ls 1 .in 0 .sp \\n(zsu +.if \\n(?n \ +.nm \\n(ln .\\$1 +.if \\n(?n \ +.nm .ec .br .rm \\$1 @@ -942,15 +967,7 @@ .@) .if (\\n(bt=0):(\\n(.t<\\n(bt) \ . ne \\n(dnu \" make it all on one page -.ls 1 -.nf -.|k -.ec -.fi -.in 0 -.xl \\n($lu -.ev -.rm |k +.@k |k .sp \\n(bsu+\\n(.Lv-1v .. . @@ -997,18 +1014,22 @@ . .de )c \" *** end block centered text .if !"\\n(.z"|c" .tm Line \\n(c. -- Unmatched .)c -.br \" force out final line +.br .di .if \n@>4 .tm >> .)c .l=\\n(.l .i=\\n(.i $i=\\n($i dl=\\n(dl .ev 1 .ls 1 .in (\\n(.lu-\\n(.iu-\\n(dlu)/2u .if \n@>4 .tm -- .)c << .in .l=\\n(.l .i=\\n(.i dl=\\n(dl +.if \\n(?n \ +.nm \\n(ln .nf .|c .ec .in .ls +.if \\n(?n \ +.nm .ev .rm |c .. @@ -1025,10 +1046,14 @@ .in +\\n(qiu .xl -\\n(qiu .sz \\n(qp +.if \\n(?n \ +.nm \\n(ln .. . .de )q \" *** end block quote .br +.if \\n(?n \ +.nm .ev .sp \\n(qsu+\\n(.Lv-1v .nr ?k 0 @@ -1039,11 +1064,15 @@ .sp \\n(bsu .@D 3 \\$1 \\$2 .@M +.if \\n(?n \ +.nm \\n(ln .if '\*(.T'html' .sp \\n(bsu .. . .de )l \" *** end list .br +.if \\n(?n \ +.nm .ev .sp \\n(bsu+\\n(.Lv-1v .nr ?k 0 @@ -1123,7 +1152,11 @@ . tl """\\*(|p" . rt \\n(_qu .\} +.if \\n(?n \ +.nm \\n(ln .|e +.if \\n(?n \ +.nm .sp |\\n(_qu+\\n(_Qu .sp \\n(esu+\\n(.Lv-1v .rr _q @@ -1157,12 +1190,14 @@ .de TH \" *** end header part of table .nr T. 0 .T# 0 +.if \\n(?n \!.nm .di .nr _T \\n(?T .nr ?T 0 .ne \\n(dnu+1v .nr ?T \\n(_T .nr _i \\n(.i +.if \\n(?n .nm \\n(ln .in 0 .|h\" \" put in the initial header .in \\n(_iu @@ -1490,6 +1525,7 @@ . nr _D \\n(dn . nr _0 1v+\\n(nlu . ev 2 +. nm . da |f . in 0 . xl \\n($lu-\\n(fuu @@ -1530,6 +1566,7 @@ .el \ \{\ . ev 2 +. nm . in 0 . xl \\n($lu-\\n(fuu . @F \\n(ff