-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathgrbbridge.sty
418 lines (375 loc) · 16.7 KB
/
grbbridge.sty
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
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
% grbbridge: a package of LaTeX macros for typesetting bridge
%
% Experiment added 10 December 2013: ``general auction'', ``bidprob'', support for ``all pass''
% Version 2.1.1, released 05 September 2013
% Version 2.1, in development 20 August 2013
% Version 2.0, released 23 November 2011
% Version history:
% Version 1 was an experiment from several years ago never released to the public.
% Version 2.0 was released 23 November 2011, providing vhand, hhand, auction, the handdiagram environment, and the deal float.
% Version 2.1 was released xx xxxx, enhancing vhand, and providing the ability to display several vhands with referenceable headers.
% Version 2.1.1 improved alignment of North, table marker, and South in hand diagrams.
% Version 2.2 added support for auctions that don't end in ``pass pass pass''; displaying single suit combinations; different spacing options in inline and hand diagrams; reimplemented the show/hide compass routine in \handdiagram.
\RequirePackage{xstring}
\RequirePackage{ifthen}
\ProvidesPackage{grbbridge}
% Bids: the logical implementation is \bid{level,denomination}, but we are lazy.
% WTF was \sp before I did this?!
\usepackage{ascii}
\usepackage[dvipsnames]{xcolor}
\newcommand{\Cl}[1]{\mbox{#1{\large\textcolor{black}{\ENQ}}}}%
\newcommand{\Di}[1]{\mbox{#1{\large\textcolor{red}{\EOT}}}}%
\newcommand{\He}[1]{\mbox{#1{\large\textcolor{red}{\ETX}}}}%
\newcommand{\Sp}[1]{\mbox{#1{\large\textcolor{black}{\ACK}}}}%
\newcommand{\Nt}[1]{\mbox{#1\textsc{nt}}}%
% Holdings: display a set of cards - probably not very useful since we want to expand different ways later
\newcommand{\clubs}[1]{\mbox{{\large\textcolor{black}{\ENQ}}#1}}%
\newcommand{\diamonds}[1]{\mbox{{\large\textcolor{red}{\EOT}}#1}}%
\newcommand{\hearts}[1]{\mbox{{\large\textcolor{red}{\ETX}}#1}}%
\newcommand{\spades}[1]{\mbox{{\large\textcolor{black}{\ACK}}#1}}%
%parsesuit splits up a string into 4 suits, which we can now do as we please with
\newcommand{\parsesuit}[1]{%
\StrBefore{#1}{,}[\raws]%
\StrBetween[1,2]{#1}{,}{,}[\rawh]%
\StrBetween[2,3]{#1}{,}{,}[\rawd]%
\StrBehind[3]{#1}{,}[\rawc]%
}
%These boolean flags can customize how hands are displayed
\newboolean{spellten}
\newboolean{leadingspace}
\newboolean{betweencards}
\newboolean{nolinebreak}
\setboolean{spellten}{false}
\setboolean{leadingspace}{false}
\setboolean{betweencards}{false}
\setboolean{nolinebreak}{false}
\newcommand{\voidsymbol}{---}
%New in v2.2: we keep track of handdiagram vs. inline boolean choices.
\newboolean{hdsettings}
\newboolean{hdspellten}
\newboolean{hdleadingspace}
\newboolean{hdbetweencards}
\newboolean{oldspellten}
\newboolean{oldleadingspace}
\newboolean{oldbetweencards}
\setboolean{hdsettings}{false}
\setboolean{hdspellten}{true}
\setboolean{hdleadingspace}{true}
\setboolean{hdbetweencards}{true}
%Temporarily we provide just ``spread a suit'', with no capacity to handle odd characters
%i.e., betweencards=true only works on the obvious symbols
%mostly used internally, but I didn't hide it in case for some odd reason one wanted to use it directly.
\newcommand{\spreadasuit}[1]{%
\StrSubstitute{#1}{A}{ A}[\tstring]%
\StrSubstitute{\tstring}{K}{ K}[\tstring]%
\StrSubstitute{\tstring}{Q}{ Q}[\tstring]%
\StrSubstitute{\tstring}{J}{ J}[\tstring]%
\StrSubstitute{\tstring}{T}{ T}[\tstring]%
\StrSubstitute{\tstring}{10}{ 10}[\tstring]%
\StrSubstitute{\tstring}{9}{ 9}[\tstring]%
\StrSubstitute{\tstring}{8}{ 8}[\tstring]%
\StrSubstitute{\tstring}{7}{ 7}[\tstring]%
\StrSubstitute{\tstring}{6}{ 6}[\tstring]%
\StrSubstitute{\tstring}{5}{ 5}[\tstring]%
\StrSubstitute{\tstring}{4}{ 4}[\tstring]%
\StrSubstitute{\tstring}{3}{ 3}[\tstring]%
\StrSubstitute{\tstring}{2}{ 2}[\tstring]%
\StrSubstitute{\tstring}{x}{ x}[\tstring]%
\StrGobbleLeft{\tstring}{1}[\tstring]%
}
%formatonesuit applies betweencards, leadingspace, and spellten to one suit at a time.
%mostly used internally
\newcommand{\formatonesuit}[1]{%
%\def\one@suit{#1}
\ifthenelse{\boolean{betweencards}}{\gdef\tstring{}%
\spreadasuit{#1}%
\def\one@suit{\tstring}}{\def\one@suit{#1}}%
%\ifthenelse{\boolean}{betweencards} not implemented yet
\ifthenelse{\boolean{leadingspace}}{ }{}%
\ifthenelse{\boolean{spellten}}{\IfEq{\one@suit}{}{\voidsymbol}{\StrSubstitute{\one@suit}{T}{10}}} {\IfEq{\one@suit}{}{\voidsymbol}{\one@suit}}%
}
%hhand: intended for routine use in inline text. Allows line breaks only between suits.
\newcommand{\hhand}[1]{\parsesuit{#1}%
\ifthenelse{\boolean{nolinebreak}}{\mbox{\spades{\formatonesuit{\raws}} \hearts{\formatonesuit{\rawh}}
\diamonds{\formatonesuit{\rawd}} \clubs{\formatonesuit{\rawc}}}}
{\spades{\formatonesuit{\raws}} \hearts{\formatonesuit{\rawh}}
\diamonds{\formatonesuit{\rawd}} \clubs{\formatonesuit{\rawc}}}%
}
%vhand: intended for routine use to display a small number of single hands, with no fancy formatting around them.
%This will become an ELEMENT of a whole-hand or two-hands environment.
%In version 2.1, an optional argument was added to vhand to enable placing a label above a single hand.
\newcommand{\vhand}[2][NoShow]{\parsesuit{#2}%
\begin{tabular}{l}%
\IfEq{#1}{NoShow}{}{\textbf{#1}\\}%
\spades{\formatonesuit{\raws}}\\%
\hearts{\formatonesuit{\rawh}}\\%
\diamonds{\formatonesuit{\rawd}}\\%
\clubs{\formatonesuit{\rawc}}%
\end{tabular}}
%New in V2.2: a simple way to display a single card combination
\newcommand{\cardcomb}[1]{%
\parsesuit{#1}%
\begin{tabular}{ccc}%
& \raws & \\
\rawc & & \rawh \\
& \rawd & \\ \end{tabular}}
%The handdiagram environment will display any or all of 4 hands, a compass, and a vul/dealer/board# indicator.
%Syntax:
%\begin{environment}
%\north{cards,,,} \west{cards,,,} \east{cards,,,} \west{cards...}
%\vul{o|n|e|b} \dealer{n|e|s|w} \boardnum{number}
%\end{environment}
%
%To suppress the compass, use \hidecompass. To restore it use \showcompass.
%In v2.2, \hidecompass and \showcompass are still supported, but so is \setboolean{\compasshide}{true|false}.
%Boardnum will automatically fill in vul and dealer if given an integer 1-32 as its argument. This can be overridden by
%executing \vul or \dealer AFTER \boardnum.
\newcommand{\north}[1]{\def \northcards {#1}}
\newcommand{\south}[1]{\def \southcards {#1}}
%\newcommand{\east}[1](\def \eastcards {#1}}
%\newcommand{\west}[1]{\def \westcards {#1}}
\newcommand{\east}[2][NoShow]{\def \eastcards {#2} \def \eastcardlabel {#1} }
\newcommand{\west}[2][NoShow]{\def \westcards {#2} \def \westcardlabel {#1} }
\newcommand{\vul}[1]{\IfEqCase{#1}{%
{o}{\def \vulstring {None vul}}
{n}{\def \vulstring {NS vul}}
{e}{\def \vulstring {EW vul}}
{b}{\def \vulstring {Both vul}}}}
\newcommand{\dealer}[1]{\IfEqCase{#1}{%
{n}{\def \dealerstring {North dealer}}
{e}{\def \dealerstring {East dealer}}
{s}{\def \dealerstring {South dealer}}
{w}{\def \dealerstring {West dealer}}}}
\newcommand{\boardnum}[1]{\IfInteger{#1}{
\def \boardnumstring {Board #1}%
\IfEqCase{#1}{%
{1}{\vul{o}\dealer{n}}
{2}{\vul{n}\dealer{e}}
{3}{\vul{e}\dealer{s}}
{4}{\vul{b}\dealer{w}}
{5}{\vul{n}\dealer{n}}
{6}{\vul{e}\dealer{e}}
{7}{\vul{b}\dealer{s}}
{8}{\vul{o}\dealer{w}}
{9}{\vul{e}\dealer{n}}
{10}{\vul{b}\dealer{e}}
{11}{\vul{o}\dealer{s}}
{12}{\vul{n}\dealer{w}}
{13}{\vul{b}\dealer{n}}
{14}{\vul{o}\dealer{e}}
{15}{\vul{n}\dealer{s}}
{16}{\vul{e}\dealer{w}}
{17}{\vul{o}\dealer{n}}
{18}{\vul{n}\dealer{e}}
{19}{\vul{e}\dealer{s}}
{20}{\vul{b}\dealer{w}}
{21}{\vul{n}\dealer{n}}
{22}{\vul{e}\dealer{e}}
{23}{\vul{b}\dealer{s}}
{24}{\vul{o}\dealer{w}}
{25}{\vul{e}\dealer{n}}
{26}{\vul{b}\dealer{e}}
{27}{\vul{o}\dealer{s}}
{28}{\vul{n}\dealer{w}}
{29}{\vul{b}\dealer{n}}
{30}{\vul{o}\dealer{e}}
{31}{\vul{n}\dealer{s}}
{32}{\vul{e}\dealer{w}}}}{\def \boardnumstring {#1}}}
%\newcommand{\hidecompass}{\def \compasshide {yes}}
%\newcommand{\showcompass}{\def \compasshide {no}}
\newboolean{compasshide}
\newcommand{\hidecompass}{\setboolean{compasshide}{true}}
\newcommand{\showcompass}{\setboolean{compasshide}{false}}
\showcompass
\newenvironment{handdiagram}%[Right now it takes no arguments]%
{\def \northcards {NoShow}%
\def \westcards {NoShow}%
\def \eastcards {NoShow}%
\def \southcards {NoShow}%
\def \dealerstring {NoShow}%
\def \vulstring {NoShow}%
\def \boardnumstring {NoShow}%
%New in v2.2, it checks when opening the environment to see if it needs to change the display settings:
\ifthenelse{\boolean{hdsettings}}{%
\ifthenelse{\boolean{spellten}}{\setboolean{oldspellten}{true}}{\setboolean{oldspellten}{false}}
\ifthenelse{\boolean{betweencards}}{\setboolean{oldbetweencards}{true}}{\setboolean{oldbetweencards}{false}}
\ifthenelse{\boolean{leadingspace}}{\setboolean{oldleadingspace}{true}}{\setboolean{oldleadingspace}{false}}
\ifthenelse{\boolean{hdspellten}}{\setboolean{spellten}{true}}{\setboolean{spellten}{false}}
\ifthenelse{\boolean{hdbetweencards}}{\setboolean{betweencards}{true}}{\setboolean{betweencards}{false}}
\ifthenelse{\boolean{hdspellten}}{\setboolean{leadingspace}{true}}{\setboolean{leadingspace}{false}}}{}%
}%Right now it doesn't do anything fancy at the start, but at the END of the environment, it processes all the commands it has received:
{%
%Changed 01 Sep 13: {clc} not {ccc}, so North and South align if only one has a long suit.
\begin{tabular}{clc}
%Upper left: info box
\IfEq{\boardnumstring\dealerstring\vulstring}{NoShowNoShowNoShow}{}{%
\begin{tabular}{l}
\IfEq{\boardnumstring}{NoShow}{}{\boardnumstring\\}%
\IfEq{\dealerstring}{NoShow}{}{\dealerstring\\}%
\IfEq{\vulstring}{NoShow}{}{\vulstring\\}%
\end{tabular}}%
&
%Top center: North
\IfEq{\northcards}{NoShow}{}{\vhand{\northcards}}%
&
\\
%Middle left: West
\IfEq{\westcards}{NoShow}{}{\vhand{\westcards}}%
&
%Center: Hand diagram\
%\IfEq{\compasshide}{yes}{}{
\ifthenelse{\boolean{compasshide}}{}{
\IfEq{\northcards\westcards\eastcards\southcards}{NoShowNoShowNoShowNoShow}{}{%
\enspace\fbox{%enspace added 05 Sep 13 to look better after ccc->clc change.
\begin{tabular}{@{}c@{ }c@{ }c@{}}
&\IfEq{\northcards}{NoShow}{ }{N}&\\
\IfEq{\westcards}{NoShow}{ }{W}& &\IfEq{\eastcards}{NoShow}{ }{E}\\
&\IfEq{\southcards}{NoShow}{ }{S}&\\
\end{tabular}
}}}
%\end{center}%
&
%Middle right: East
\IfEq{\eastcards}{NoShow}{}{\vhand{\eastcards}}%
\\
%Bottom left blank
&
%Bottom center: South
\IfEq{\southcards}{NoShow}{}{\vhand{\southcards}}%
&
%Bottom right blank
\\
\end{tabular}%
%New in v2.2, if the display settings were changed, they need to be changed back:
\ifthenelse{\boolean{hdsettings}}{%
\ifthenelse{\boolean{oldspellten}}{\setboolean{spellten}{true}}{\setboolean{spellten}{false}}
\ifthenelse{\boolean{oldbetweencards}}{\setboolean{betweencards}{true}}{\setboolean{betweencards}{false}}
\ifthenelse{\boolean{oldleadingspace}}{\setboolean{leadingspace}{true}}{\setboolean{leadingspace}{false}}}{}%
}
%The twohands environment is a simplified way to display just two hands side by side wrapped in a neat little box.
%Not yet implemented
%The below works, if you use the ``new'' versions of \east and \west, but I dont like it.
%I want to generalize to adding labels above n hands, and deciding how much space to leave between labels and the hands.
\newenvironment{twohands}{}{%
\begin{tabular}{cc}
\IfEq{\westcardlabel\eastcardlabel}{NoShowNoShow}{}{%
\IfEq{\westcardlabel}{NoShow}{}{\westcardlabel} & \IfEq{\eastcardlabel}{NoShow}{}{\eastcardlabel} \\}
\vhand{\westcards} & \vhand{\eastcards} \\
\end{tabular}
}
%Normally we will want to wrap a hand diagram inside a float with a caption and a figure number:
%Whether you want the rules above and below, and want captions above or below, is up to you.
\RequirePackage{float}
\floatstyle{ruled}
\newfloat{deal}{htb}{lod}
\floatname{deal}{Deal}
%AUCTION: a command to automatically format an auction into a nice table
\newcommand{\dblstring}{Double}
\newcommand{\rdblstring}{Rdbl}
% Up to version 2.1.1, \auction hard-coded ``,p,p,p'' at the end of every auction
%
%\newcommand{\auction}[2][NoShow]{%
%\gdef \seat@counter {0} %GDEF not DEF is important, otherwise it can't see the counter inside-vs-outside the for loop
%\begin{tabular}{llll}
%West&North&East&South\\%
%\IfEq{#1}{NoShow}{}{%
%\@for \thislabel:=#1 \do {\textit{\thislabel} \incrementcounter}%
%\IfEq{\seat@counter}{0}{}{\gdef seat@counter {0} \\}%
%}%
%\@for \thisbid:=#2,p,p,p \do {\printable{\thisbid} \incrementcounter }
%\end{tabular}
%}
\newcommand{\genauction}[3][NoShow]{%
\gdef \seat@counter {0} %GDEF not DEF is important, otherwise it can't see the counter inside-vs-outside the for loop
\begin{tabular}{llll}
West&North&East&South\\%
\IfEq{#1}{NoShow}{}{%
\@for \thislabel:=#1 \do {\textit{\thislabel} \incrementcounter}%
\IfEq{\seat@counter}{0}{}{\gdef seat@counter {0} \\}%
}%
\edef\long@auction{#2#3}%
\@for \thisbid:=\long@auction \do {\printable{\thisbid} \incrementcounter }
\end{tabular}
}
\newcommand{\auctionending}{,p,p,p}
\newcommand{\auction}[2][NoShow]{%
\genauction[#1]{#2}{\auctionending}}
\newcommand{\bidprob}[2][NoShow]{%
\genauction[#1]{#2}{,?}}
\newcommand{\auctionpart}[2][NoShow]{%
\genauction[#1]{#2}{}}
\newcommand{\incrementcounter}{%
\IfStrEqCase{\seat@counter}{{0}{%
\gdef \seat@counter {1} &}{1}{%
\gdef \seat@counter {2} &}{2}{%
\gdef \seat@counter {3} &}{3}{%
\gdef \seat@counter {0} \\}}%
}
%New in v.2.2: two-person auctions, NS or EW:
\newcommand{\nsauction}[2][NoShow]{%
\gdef \seat@counter {0} %GDEF not DEF is important, otherwise it can't see the counter inside-vs-outside the for loop
\begin{tabular}{ll}
North&South\\%
\IfEq{#1}{NoShow}{}{%
\@for \thislabel:=#1 \do {\textit{\thislabel} \twopersoncounter}%
\IfEq{\seat@counter}{0}{}{\gdef seat@counter {0} \\}%
}%
\@for \thisbid:=#2 \do {\printable{\thisbid} \twopersoncounter }
\end{tabular}
}
\newcommand{\ewauction}[2][NoShow]{%
\gdef \seat@counter {0} %GDEF not DEF is important, otherwise it can't see the counter inside-vs-outside the for loop
\begin{tabular}{ll}
West&East\\%
\IfEq{#1}{NoShow}{}{%
\@for \thislabel:=#1 \do {\textit{\thislabel} \twopersoncounter}%
\IfEq{\seat@counter}{0}{}{\gdef seat@counter {0} \\}%
}%
\@for \thisbid:=#2 \do {\printable{\thisbid} \twopersoncounter }
\end{tabular}
}
\newcommand{\twopersoncounter}{%
\IfStrEqCase{\seat@counter}{{0}{%
\gdef \seat@counter {1} &}{1}{%
\gdef \seat@counter {0} \\}}%
}
%Support for ap=''All Pass'' added in v2.2
\newcommand{\printable}[1]{%
\StrLeft{#1}{1}[\first@char]%
\StrMid{#1}{2}{2}[\second@char]%
\StrGobbleLeft{#1}{2}[\minus@two]%
\IfStrEqCase{\first@char}{%
{p}{Pass\second@char\minus@two}
{a}{\IfStrEq{\second@char}{p}{All Pass\minus@two}{a\second@char\minsu@two}}
{x}{\IfStrEq{\second@char}{x}{\rdblstring\minus@two}{\dblstring\second@char\minus@two}}
{1}{\IfStrEqCase{\second@char}{{c}{\Cl{1}\minus@two}{d}{\Di{1}\minus@two}{h}{\He{1}\minus@two}{s}{\Sp{1}\minus@two}{n}{1NT\minus@two}}[#1]}
{2}{\IfStrEqCase{\second@char}{{c}{\Cl{2}\minus@two}{d}{\Di{2}\minus@two}{h}{\He{2}\minus@two}{s}{\Sp{2}\minus@two}{n}{2NT\minus@two}}[#1]}
{3}{\IfStrEqCase{\second@char}{{c}{\Cl{3}\minus@two}{d}{\Di{3}\minus@two}{h}{\He{3}\minus@two}{s}{\Sp{3}\minus@two}{n}{3NT\minus@two}}[#1]}
{4}{\IfStrEqCase{\second@char}{{c}{\Cl{4}\minus@two}{d}{\Di{4}\minus@two}{h}{\He{4}\minus@two}{s}{\Sp{4}\minus@two}{n}{4NT\minus@two}}[#1]}
{5}{\IfStrEqCase{\second@char}{{c}{\Cl{5}\minus@two}{d}{\Di{5}\minus@two}{h}{\He{5}\minus@two}{s}{\Sp{5}\minus@two}{n}{5NT\minus@two}}[#1]}
{6}{\IfStrEqCase{\second@char}{{c}{\Cl{6}\minus@two}{d}{\Di{6}\minus@two}{h}{\He{6}\minus@two}{s}{\Sp{6}\minus@two}{n}{6NT\minus@two}}[#1]}
{7}{\IfStrEqCase{\second@char}{{c}{\Cl{7}\minus@two}{d}{\Di{7}\minus@two}{h}{\He{7}\minus@two}{s}{\Sp{7}\minus@two}{n}{7NT\minus@two}}[#1]}}[#1]}
%newhandtype: the ability to define new hand types with references, rather than using \vhand repeatedly
%syntax: \newhandtype{commandname,display text,label format,reset criterion}
%example \newhandtype{opener}{Opener}{arabic}{section} provides \opener[optional label]{s,h,d,c}, as for \vhand{s,h,d,c}
\newcommand{\newhandtype}[4]{%
\IfEq{#4}{never}{\newcounter{#1}}{\newcounter{#1}[#4]}%
\setcounter{#1}{0}%
\expandafter\newcommand\csname format#1\endcsname {#3}% Stores the kind of formatting in a variable
\expandafter\renewcommand\csname the#1\endcsname{\expandafter\csname\csname format#1\endcsname\endcsname {#1}}%Formats the references.
\expandafter\newcommand\csname #1\endcsname [2][GenericLabel]{%
\expandafter\parsesuit{##2}% --- the doubled # is the key to making this work.
\begin{tabular}{l}%
\refstepcounter{#1}%
%Apply a label if the user requests one.
%Generating automatic labels causes collisions if the counter gets reset in the next section, so we only provide these if
%you set the reset criterion to ``never''.
\IfEq{##1}{GenericLabel}{\IfEq{#4}{never}{\label{#1\expandafter\csname\csname format#1\endcsname\endcsname {#1}}}{}}{\label{##1}}%
%\IfEq{##1}{GenericLabel}{\label{#1\expandafter\csname\csname format#1\endcsname\endcsname {#1}}}{}%
\underline{\textbf{#2 \expandafter\csname\csname format#1\endcsname\endcsname {#1}}}\\
\spades{\formatonesuit{\raws}}\\%
\hearts{\formatonesuit{\rawh}}\\%
\diamonds{\formatonesuit{\rawd}}\\%
\clubs{\formatonesuit{\rawc}}%
\end{tabular}}%
}