summaryrefslogtreecommitdiffstats
path: root/contrib/sboxes/sboxes.tmac
blob: 63c92636aa89151f890d82268ccca00c69caa4e7 (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
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
.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 \{\
.  tm sboxes.tmac: macros require groff extensions; not loading
.  nx
.\}
.
.if \n(.C \{\
.  tm sboxes.tmac: macros do not work in compatibility mode; not loading
.  nx
.\}
.
.\" Define a string for use in diagnostic messages.
.ds bx*name sboxes.tmac\"
.
.if !r GS \
.  ab \*[bx*name]: ms macros must be loaded first; aborting
.
.if (\n[.x]\n[.y] < 123) \{\
.  ds bx*msg \*[bx*name]: groff 1.23 or later is required,\"
.  as bx*msg " but found groff \n[.x].\n[.y]; not loading\"
.  tm \*[bx*msg]
.  nx
.\}
.
.\" See if already loaded.
.if r GSBOX .nx
.
.\" GSBOX is defined if the package is loaded, and true if it will work.
.nr GSBOX 0
.if '\*[.T]'pdf' \
.  nr GSBOX 1
.
.nr bx*stack 0
.
.de bx*error
.  tm \*[bx*name]:\\n[.F]:\\n[.c]: error: \\$*
..
.
.\" Define dummy macro if we're not formatting for the pdf device.
.if !\n[GSBOX] \{\
.  de pdfbackground
.  .
.\}
.
.\" 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 \{\
.           bx*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]
.  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: