summaryrefslogtreecommitdiff
path: root/contrib/sboxes/sboxes.tmac
blob: 63e4c1e69cac6069551742a544e61948c85bbdca (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
.ig

sboxes.tmac

Copyright (C) 2021 Free Software Foundation, Inc.
     Written by Deri James (deri@chuzzlewit.myzen.co.uk)

This file is part of groff.

groff is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Software Foundation, either version 3 of the License, or (at your
option) any later version.

groff is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
for more details.

You should have received a copy of the GNU General Public License
along with this program.  If not, see <http://www.gnu.org/licenses/>.
..
.if !\n(.g \
.  ab groff sboxes macros require groff extensions; aborting
.
.if \n(.C \
.  ab groff sboxes macros do not work in compatibility mode; aborting
.
.\" See if already loaded.
.if r GSBOX .nx
.nr GSBOX 1
.nr bx@stack 0
.
.de sboxes*error
.  tm sboxes.tmac:\\n[.F]:\\n[.c]: error: \\$*
..
.
.de pdfbackground
.device pdf: background \\$*
..
.\" Link into ms macros to trap footnote growth
.am fn@print-sep
.nr bx@pb \\n[nl]u-2p
.nop \!x X pdf: background footnote \\n[bx@pb]z
.rr bx@pb
..
.\" Has PD been actioned?
.am par*start
.nr bx@PD \\n[PD]
..
.
.de BoxStart
.  fl
.  nr bx@stack \\n[bx@stack]+1u
.  nr bx@shad 0
.  nr bx@outl 0
.  nr bx@ind 1P
.  ds bx@wt 0
.  ds bx@type "\"
.  while \\n[.$] \{\
.    ie 'SHADED'\\$1' \{\
.       nop \\M[\\$2]\c
.       nr bx@shad 1
.       as bx@type "fill\"
.       shift 2
.    \}
.    el \{\
.     ie 'OUTLINED'\\$1' \{\
.       nop \\m[\\$2]\c
.       nr bx@outl 1
.       as bx@type "box\"
.       shift 2
.     \}
.     el \{\
.       ie 'WEIGHT'\\$1' \{\
.         ds bx@wt \\$2
.         shift 2
.       \}
.       el \{\
.         ie 'INDENT'\\$1' \{\
.           nr bx@ind \\$2
.           shift 2
.         \}
.         el \{\
.           sboxes*error ignoring unrecognized BoxStart parameter '\\$1'
.           shift
.         \}
.       \}
.     \}
.    \}
.  \}
.
.  if '\\*[bx@type]'' .ds bx@type "fill"
.  nr bx@l \\n[\\n[.ev]:li]s+\\n[.o]s-\\n[bx@ind]u
.  nr bx@r \\n[bx@l]u+\\n[.l]-\\n[\\n[.ev]:li]+(\\n[bx@ind]u*2u)
.  nr bx@gap \\n[.v]-\\n[.ps]+\\*[bx@wt]
.  nr bx@bot \\n[.p]u-\\n[FM]u+\\n[bx@ind]u+\\n[.ps]u
.  nr bx@top \\n[HM]-\\n[bx@ind]u+\\n[bx@gap]u
.  ne \\n[bx@ind]u+2v+\\*[bx@wt]
.  sp -(2v-(\\n[bx@PD]u*2u))u
.  pdfbackground \\*[bx@type] \\n[bx@l]z \\n[bx@top]z \\n[bx@r]z \\n[bx@bot]z \\*[bx@wt] \\n[nl]z
.  sp (\\n[bx@ind]u-1v)u
.  if (\\n[bx@shad]=1) .nop \\M[]\c
.  if (\\n[bx@outl]=1) .nop \\m[]\c
.  ds bx@ind\\n[bx@stack] \\n[bx@ind]
.  rr bx@shad bx@outl bx@ind bx@bot bx@top bx@l bx@r
.  rm wt type
.  sp -(\\n[bx@gap]u)
.  nr bx@PD 0
..
.de BoxStop
.  sp \\*[bx@ind\\n[bx@stack]]u-\\n[.psr]u
.  pdfbackground off
.  nr bx@stack \\n[bx@stack]-1u
..
.\" Local Variables:
.\" mode: nroff
.\" fill-column: 72
.\" End:
.\" vim: set expandtab filetype=groff textwidth=72: