groff
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Groff] Leader character question in gtbl in T{ T} construct


From: Werner LEMBERG
Subject: Re: [Groff] Leader character question in gtbl in T{ T} construct
Date: Thu, 26 Feb 2004 15:31:14 +0100 (CET)

> 3      This is a long text entry. I would like the leader 
>        character to  continue  on to  the  next tab stop.  
>        However I just noticed that the line number on the
>        top, so the  pattern of  dots  may not be correct.
>        They want this ...................................     20

This is not possible with tbl, except probably by hacking the tbl
macros which is non-trivial.  Please try the attached toc.tmac file;
below is your sample as the input.


    Werner


======================================================================

.LP
.fp 1 TR
.
.so toc.tmac
.
.toc-lengths 1c 12c 1c
.toc-aligns l b r
.
.toc 1. 2 This is a short line
.
.sp
.
.toc 2. 10
This is a long text entry.
I would like the leader character to continue on to the next tab stop.
However I just noticed that the line number on the top line, so the pattern
of dots may not be appropriated.
I really need this to meet approved dissertation formatting.
.toc*
.
.sp
.
.toc 3. 20
This is a long text entry.
I would like the leader character to continue on to the next tab stop.
However I just noticed that the line number on the top line, so the pattern
of dots may not be appropriated.
I really need this to meet approved dissertation formatting.
.toc*
.\" toc.tmac
.
.if d toc-lengths \
.  nx
.
.eo
.
.de \"
..
.
.\" .toc-lengths left sep middle sep right
.\"
.\" .toc-lengths left sep middle sep
.\"
.\" .toc-lengths left middle right
.\"
.\"   Set up the horizontal dimensions of a table of contents entry.
.\"   The arguments are the width of the left part (normally the
.\"   sectioning number), the separation between the left and middle
.\"   part, the middle part (normally the sectioning title), the
.\"   separation between the middle and right part, and the width
.\"   of the right part (normally the page number).  All arguments
.\"   must evaluate to a number; there is no default scaling indicator.
.\"
.\"   If there are only four arguments, the width of the right part
.\"   is the remaining width with respect to the current line length.
.\"   If there are only three arguments, both separation values are
.\"   equal, filling the line up to the current line width.
.\"
.\"   There is no warning if the (computed) separation values are
.\"   negative.
.
.de toc-lengths
.  ie (\n[.$] == 3) \{\
.    nr toc-width-left \$1
.    nr toc-width-middle \$2
.    nr toc-width-right \$3
.    nr toc-sep-left-middle ((\n[.l] - \$1 - \$2 - \$3) / 2)
.    nr toc-sep-middle-right \n[toc-sep-left-middle]
.  \}
.  el \{\
.    ie (\n[.$] == 4) \{\
.      nr toc-width-left \$1
.      nr toc-sep-left-middle \$2
.      nr toc-width-middle \$3
.      nr toc-sep-middle-right \$4
.      nr toc-width-right (\n[.l] - \$1 - \$2 - \$3 - \$4)
.    \}
.    el \{\
.      ie (\n[.$] == 5) \{\
.        nr toc-width-left \$1
.        nr toc-width-middle \$2
.        nr toc-width-right \$3
.        nr toc-sep-left-middle \$4
.        nr toc-sep-middle-right \$5
.      \}
.      el \
.        ab toc: Wrong number of arguments to `.toc-lengths' (must be 3, 4, or 
5).
.    \}
.  \}
..
.
.
.\" .toc-aligns left middle right
.\"
.\"   Set the alignment for the left, middle, and right part of table of
.\"   contents entries.  The arguments are the same as for calls to the
.\"   `.ad' request: `l' for left-aligned text, `b' for left and right
.\"   justified text, and `r' for right-aligned text.
.\"
.\"   The default is `.toc-aligns l b r'.
.
.de toc-aligns
.  if !(\n[.$] == 3) \
.    ab toc: Wrong number of arguments to `.toc-aligns' (must be 3).
.
.  ds toc-align-left \$1
.  ds toc-align-middle \$2
.  ds toc-align-right \$3
..
.
.
.\" .toc section page body ...
.\"
.\" .toc section page
.\" body
.\" .toc*
.\"
.\"   Produce a table of contents entry.  The first argument is the section
.\"   number, the second the page number (these arguments are strings).
.\"   Remaining arguments are taken as the table of contents body,
.\"   separated by spaces.  If there are no remaining arguments, the body
.\"   consists of the text starting with the next line until the next
.\"   invocation of the `toc*' macro.
.\"
.\"   The (last) line of the body is filled with leaders up to
.\"   `toc-width-middle'.
.
.de toc
.  if !r toc-width-left \
.    ab toc: `.toc' called before `.toc-lengths'.
.
.  if (\n[.$] < 2) \
.    ab toc: Wrong number of arguments to `.toc' (must be 2 or more).
.  ds toc-section \$1\"
.  ds toc-page \$2\"
.
.  ie (\n[.$] > 2) \{\
.    shift 2
.    de toc-body toc*
\$*
.    toc*
.  \}
.  el \
.    de toc-body toc*
..
.
.de toc*
.  nr toc-.i \n[.i]
.  nr toc-.l \n[.l]
.  nr toc-.j \n[.j]
.  ds toc-.tabs \n[.tabs]
.  nr toc-.linetabs \n[.linetabs]
.
.  ll (\n[.i]u + \n[toc-width-left]u)
.  in +0
.  ad \*[toc-align-left]
.  nop \*[toc-section]
.
.  vpt 0
.  ll +(\n[toc-sep-left-middle]u + \n[toc-width-middle]u)
.  in +(\n[toc-width-left]u + \n[toc-sep-left-middle]u)
.  sp -1
.  vpt
.  ad \*[toc-align-middle]
.  linetabs 1
.  ta (\n[.l]u - \n[.i]u)
.  toc-body
.  nop \*[toc-leader]
.
.  vpt 0
.  ll +(\n[toc-sep-middle-right]u + \n[toc-width-right]u)
.  in +(\n[toc-width-middle]u + \n[toc-sep-middle-right]u)
.  sp -1
.  vpt
.  ad \*[toc-align-right]
.  nop \*[toc-page]
.
.  in \n[toc-.i]u
.  ll \n[toc-.l]u
.  ad \n[toc-.j]
.  ta \*[toc-.tabs]
.  linetabs \n[toc-.linetabs]
..
.
.ec
.
.ds toc-leader \a
.toc-aligns l b r
.
.\" EOF

reply via email to

[Prev in Thread] Current Thread [Next in Thread]