Debian Codegraph @

texmf-dist/source/latex/onedown/onedown.dtx

raw
1 % \iffalse meta-comment
2 %
3 % Copyright (C) 2018 by Jacob Wiersma <[email protected]>
4 % ---------------------------------------------------------------------------
5 % This work may be distributed and/or modified under the
6 % conditions of the LaTeX Project Public License, either version 1.3
7 % of this license or (at your option) any later version.
8 % The latest version of this license is in
9 % http://www.latex-project.org/lppl.txt
10 % and version 1.3 or later is part of all distributions of LaTeX
11 % version 2005/12/01 or later.
12 %
13 % This work has the LPPL maintenance status `maintained'.
14 %
15 % The Current Maintainer of this work is Jacob Wiersma.
16 %
17 % This work consists of the files onedown.dtx and onedown.ins
18 % and the derived filebase onedown.sty.
19 %
20 % \fi
21 %
22 % \iffalse
23 %<*driver>
24 \ProvidesFile{onedown.dtx}
25 %</driver>
26 %<package>\NeedsTeXFormat{LaTeX2e}[2014/05/01]
27 %<package>\def\ODwstyleversion{1.7}\def\ODwstyledate{2023/12/07}
28 %<package>\ProvidesPackage{onedown}
29 %<package> [\ODwstyledate\space v\ODwstyleversion\space
30 %<package> Typeset Bridge Diagrams - Jacob Wiersma (C) 2016-2023]
31 %
32 %<*driver>
33 \PassOptionsToPackage{shorthands=off}{babel}
34 %
35 % with draft no hyperrefs
36 \documentclass[a4paper,12pt,%
37 german,dutch,french,swedish,english]{ltxdoc}
38 % Of all available languages, we use only thes few in some examples
39 % the package |shortvrb| is auto-loaded, providing |...| as shorthand
40 \usepackage[utf8]{inputenc}
41 %
42 \usepackage[T1]{fontenc}
43 \usepackage{babel}
44 \usepackage{onedown}[2023/12/07]
45 \usepackage[normalem]{ulem}% for strikeout todos that are done
46 \usepackage{needspace}% keep contiguous lines on one page
47 \usepackage[inline]{enumitem}% Control various parameters of lists
48 \usepackage{titlesec}
49 \usepackage{verbatimbox}% For env. verbnobox (set font)
50 %\usepackage[hyphens]{url}% for typesetting URLs
51 \setcounter{secnumdepth}{4}
52 \titleformat{\paragraph}{\normalfont\normalsize\bfseries}{\theparagraph}{1em}{}
53 \titlespacing*{\paragraph}{0pt}{3.25ex plus 1ex minus .2ex}{1.5ex plus .2ex}
54 \usepackage[numbered]{hypdoc}
55 %
56 % add '-' and '/' to the list of URL break characters
57 % '/' won't work!
58 %
59 \expandafter\def\expandafter\UrlBreaks\expandafter{\UrlBreaks\do\-\do/\do\/}
60 %
61 % Set a nice color for \MacroDef and \EnvDef.
62 % But not if we want a printout on a monochrome printer
63 %
64
65 \newboolean{NoColor}% to suppress all colors
66
67 \AtBeginDocument{%
68 \ifNoColor
69 \setdefaults{colors=b+w}
70 \hypersetup{linkcolor=black,urlcolor=black}
71 \def\ODwcolor{black}
72 \definecolor{defbackgr}{rgb}{1,1,1}
73 \definecolor{optbackgr}{named}{lightgray}
74 \else
75 \def\ODwcolor{red}
76 \definecolor{defbackgr}{rgb}{1,1,0.75}
77 \definecolor{optbackgr}{named}{lime}
78 \fi
79 }%
80 %
81 \newlength\defwidth
82 %
83 % We need to typeset optional args without \meta too!
84 %\newcommand\Oarg[1]{{\ttfamily[}#1{\ttfamily]}}
85 \newcommand\Oarg[1]{\colorbox{optbackgr}{\textbf{#1}}}
86 %
87 \NewDocumentCommand\MacroDef{st+mO{}}{%
88 % \MacroDef* + {macroname}[args]
89 % 1 2 3 4
90 % #1 flags if macroname is multi-lingual
91 % #2 flags if macroname is put in the list of user commands
92 % #3 is the macroname that we describe
93 % #4 are the possible args of macroname
94 %
95 \bgroup
96 \IfBooleanTF#2{\usercom{#3}}{}%
97 \setlength{\fboxsep}{4pt}\setlength{\fboxrule}{1.25pt}%
98 \setlength\defwidth\linewidth%
99 \addtolength\defwidth{-2\fboxrule}%
100 \addtolength\defwidth{-2\fboxsep}%
101 \fcolorbox{black}{defbackgr}{%
102 \makebox[\defwidth][l]{%
103 \IfBooleanTF#1{\ML}{}%
104 \texttt{\footnotesize\bs#3#4}%
105 }%
106 }%
107 \par\vspace{0.5\baselineskip}\noindent%
108 \egroup
109 }% MacroDef
110 %
111 \NewDocumentCommand\EnvDef{st+mO{}}{%
112 % \EnvDef* + {env-name}[args]
113 % #1 #2 #3 #4
114 % #1 flags if env-name is multi-lingual
115 % #2 flags if env-name is put in the list of user commands
116 % #3 is the env-name that we describe
117 % #4 are the possible args of env-name
118 %
119 \bgroup
120 \IfBooleanTF#2{\usercom[]{#3 (env)}}{}%
121 \setlength{\fboxsep}{4pt}\setlength{\fboxrule}{1.25pt}%
122 \setlength\defwidth\linewidth%
123 \addtolength\defwidth{-2\fboxrule}%
124 \addtolength\defwidth{-2\fboxsep}%
125 \fcolorbox{black}{defbackgr}{%
126 \makebox[\defwidth][l]{%
127 \IfBooleanTF#1{\ML}{}%
128 \texttt{\footnotesize\bs begin\string{#3\string}#4\ldots\bs end\string{#3\string}}
129 }%
130 }%
131 \par\vspace{0.5\baselineskip}\noindent%
132 \egroup
133 }% EnvDEf
134 %
135 %
136 % Special processing of user commands
137 %
138 % We supply command NAMES, so we must add the \ afterwards, to make it look
139 % like a real command in the index
140 %
141 \newcommand\bs{%
142 \texttt{%
143 \upshape% the itshape of meta screws the backslash
144 \textbackslash%
145 }%
146 }% bs
147 %
148 % \usercom gets the NAME of a command (without \), labels the actual
149 % position and inserts the appropriate hyperref index entry in the UCFile,
150 % whilst adding the \ before the command name.
151 %
152 \newcommand\usercom[2][\noexpand\bs]{%
153 \ifnumequal{\pdfshellescape}{1}{%
154 % restricted shell enabled
155 \label{#2}%
156 \immediate\write\UCFile{%
157 \noexpand\hyperref[#2]{%
158 #1#2, \thepage\noexpand\newline%
159 }%
160 }%
161 }{}%
162 }% usercom
163 %
164 % We write the user commands (on the fly sorted) in file onedown.odw.
165 % We must disable | first and enable it again afterwards
166 %
167 \ifnumequal{\pdfshellescape}{1}{%
168 \newwrite\UCFile
169 \DeleteShortVerb{\|}
170 \immediate\openout\UCFile="| sort -d > \jobname.odw
171 \MakeShortVerb{\|}
172 }{}
173 %
174 % Used to mark MultiLingual macros
175 %
176 \newcommand\ML{\textcolor{\ODwcolor}{\textsc{\tiny ML}}\xspace}
177 %
178 % Typeset package names
179 %
180 \newcommand\packname[1]{\texttt{#1}\xspace}
181 %
182 % Write our own package name a bit special
183 %
184 \newcommand\OneDown{\textcolor{\ODwcolor}{\smaller\bfseries\textsc{OneDown}}\xspace}
185 %
186 % We translate our multilingual examples
187 %
188 \NewDocumentCommand\Translate{smO{german}}{%
189 \let\xspaceODwold=\xspace%
190 \def\xspace{}%
191 \foreignlanguage{#3}{%
192 \IfBooleanTF#1{\translate{#2-(ODw)}}{#2}%
193 }%
194 \let\xspace=\xspaceODwold%
195 }% Translate
196 %
197 % Put a frame surrounding examples
198 %
199 \newcommand\example[1]{\fbox{#1}}
200 %
201 % End of user-command
202 %
203 \setdefaults*{game=\sffamily\bfseries\footnotesize,%
204 other=\sffamily\bfseries\footnotesize}
205
206 \AtBeginDocument{\CodelineIndex
207 \EnableCrossrefs}
208 \AtBeginDocument{\RecordChanges}
209 \extrafloats{100}
210 \begin{document}
211 \DocInput{onedown.dtx}
212 \end{document}
213 %</driver>
214 % \fi
215 %
216 % \CheckSum{3814}
217 %
218 % \CharacterTable
219 % {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
220 % Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
221 % Digits \0\1\2\3\4\5\6\7\8\9
222 % Exclamation \! Double quote \" Hash (number) \#
223 % Dollar \$ Percent \% Ampersand \&
224 % Acute accent \' Left paren \( Right paren \)
225 % Asterisk \* Plus \+ Comma \,
226 % Minus \- Point \. Solidus \/
227 % Colon \: Semicolon \; Less than \<
228 % Equals \= Greater than \> Question mark \?
229 % Commercial at \@ Left bracket \[ Backslash \\
230 % Right bracket \] Circumflex \^ Underscore \_
231 % Grave accent \` Left brace \{ Vertical bar \|
232 % Right brace \} Tilde \~}
233 %
234 % ^^A Commands to be used for the documentations only
235 %
236 % \makeatletter
237 % \def\CP{\ODw@Compass}
238 % \def\Xfer#1{\ODw@Xfer{#1}}
239 % \makeatother
240
241 %
242 % ^^A We are onedown now with new versioning!
243 %
244 % \changes{v0.1}{2018/01/28}{\\
245 % - Reorganized the bzr versioning. bzr will contain only onedown, the
246 % former bidnplay stuff is archived. The ToDo and Known-Bugs lists are
247 % cleaned. \\
248 % - We are version 0.1 now, trying to keep the bzr version number equal to
249 % the changes minor number.}
250 %
251 % \changes{v0.2}{2018/02/12}{\\
252 % - We finally have a List of User Commands. \\
253 % - In the compass we can print vulner in red and mark the dealer. We have
254 % a hook \cmd{\CompassMid} to write something in the middle of the
255 % compass.\\
256 % - Added several macros to auto-translate common stuff like 'lead' etc.\\
257 % - Added the danish language. \\
258 % - Corrected a bug in \cmd{\dealer} and \cmd{\vulner}.\\
259 % - Removed pgf-key 'lang': we now load the needed languages on the fly.\\
260 % - Finally we revised the documentation.}
261 %
262 % \changes{v0.4}{2018/03/09}{\\
263 % - Major change in playtricks: the winner is now determined by the cards
264 % played, and code is added to check consistency.\\
265 % - Dirty coded macros like \cmd{\ODw@symbol} and \cmd{\ODw@(@)Card(s)} are
266 % replaced by neat expl3 code.\\
267 % - We load necesary dictionaries automatically on the fly and enhanced the
268 % colors options.\\
269 % - Corrected some minor bugs and reorganized the documentation. \\
270 % - One can now also generate the documentation without the list of user
271 % commands}
272 %
273 % \changes{v0.5}{2018/03/14}{\\
274 % - Associated the names and bidders in a fixed way.\\
275 % - Added checks to onesuitNS/EW.\\
276 % - Made ODw@OtherFont local where necessary.\\
277 % - Redefined columntypes.\\
278 % - Made 'T' a code for '10'.\\
279 % - Adapted the 'translate' macro to enable both 1H and 1\cmd{\He} etc. \\
280 % - Enhanced the documentation.}
281 %
282 % \changes{v0.6}{2018/03/14}{\\
283 % - Made all internal names hidden by adding 'ODw@' to it.\\
284 % - Changed \cmd{\ODw@AccTricksN} in \cmd{\ODw@AccTricks}.\\
285 % - Some minor adaptions of the documentation}
286 %
287 % \changes{v0.7}{2018/03/20}{\\
288 % - Final(?) edits of the documentation: Consequent use of 'card diagram',
289 % 'bidding' diagram and 'play diagram'. \\
290 % - Corrected some minor bugs. \\
291 % - Changed the name of the 'playtricks' environment into 'play'.\\
292 % - Can now disable all colors in the manual for monochrome printing.\\
293 % - Changed signature of \cmd{\expertquiz} and \cmd{\boardtext}.}
294 %
295 % \changes{v0.7a}{2018/03/24}{\\
296 % - Major change: Removed all \cmd{\bidXX} and \cmd{\bidXXpair} commands.\\
297 % - The biddings can now be shown with \cmd{\showXX+} (with token '\texttt{+}').\\
298 % - The macros \cmd{\hand-} and the bidding environments suppress their
299 % output with token '\texttt{-}'}
300 %
301 % \changes{v0.8}{2018/04/11}{\\
302 % - Added package \packname{verbatimbox} to adjust verbatim font easily.\\
303 % - Added \cmd{\setdefaults} with keys for fonts, compass and bidding
304 % diagrams.\\
305 % - Made \cmd{\FirstBidCol} internally hidden.\\
306 % - Removed \cmd{\longcalls}, \cmd{\CompassMid}, added \cmd{\compassfont}.\\
307 % - Changed the order of the hands in \cmd{\onesuitAll}.\\
308 % - Renewed the implementation of the compass and added extra features.}
309 %
310 % \changes{v0.9}{2018/04/15}{\\
311 % - Adapted \cmd{\ODwset} and \cmd{\setdefaults}.\\
312 % - Separated key \emph{messages} into keys \emph{warn} and \emph{err}.\\
313 % - Adapted \cmd{\ODw@Compass}. \\
314 % - Removed legends from \cmd{\showNS}.\\
315 % - Added \cmd{\sbox1} to all \cmd{\showXX} macros with a N-hand.\\
316 % - Changed ODw@[No]Warnings and ODw@[No]Errors.\\
317 % - Corrected some minor bugs and adapted the documentation accordingly.}
318 %
319 % \changes{v1.0}{2018/05/23}{\\
320 % - Adapted the urls, the directories and some filenames to conform to the
321 % CTAN-standard and made the bundle ready for upload. \\
322 % - Corrected a small bug in \cmd{\ODw@Compass} that was introduced in
323 % v0.9.\\
324 % - Made all relevant text-writing macros in 4 versions with/without tokens
325 % '*' and '^^21'.\\
326 % - Corrected a sizing/font bug.\\
327 % - Added 4 variants of many other text-writing macros, onesuit-NE/NW/.\\
328 % - Adapted \cmd{\handskip}. \\
329 % - Added code to work-around a \packname{babel}-\packname{translations}
330 % inconsistency w.r.t. norsk/norwegian.}
331 %
332 % \changes{v1.1}{2018/09/22}{\\
333 % - Corrected onedown-ref.tex\\
334 % . Added the missing rows in lines 419-422.\\
335 % . and the explanational text on line 457.\\
336 % - Changed in all ODw*.trsl files: The translation of 'pass!' into 'p' and
337 % 'Pass!' into 'P'.\\
338 % - Corrected some typos in ShowAll.tex:\\
339 % . \cmd{\contract*} into \cmd{\contract},\\
340 % . \cmd{\declarer*} into \cmd{\declarer} and\\
341 % . \cmd{\lead*} into \cmd{\lead}.\\
342 % - Removed some illegal chars from changes entries.}
343 % \changes{v1.2a}{2018/10/10}{\\
344 % - Enhanced the documention (both onedown.dtx and onedown-ref.tex: The
345 % command tokens are no longer shown as '[*^^21]', but as '*^^21' with a
346 % different background color.\\
347 % - Added a thinspace ('\cmd{\,}') before all points counts (HCP, LP, DP
348 % and TP)\\
349 % - Improved \cmd{\alert} by using \cmd{\textasteriskcentered} rather than
350 % just a '*'\\
351 % - The changes history has a better layout now \\
352 % - \cmd{\showNS} and \cmd{\showEW} now can selectively display only the N-
353 % or S-hand, resp the E- or W-hand.}
354 % \changes{v1.2b}{2018/10/31}{\\
355 % - Corrected a bug: Added \cmd{\ODw@monochromefalse} in all
356 % initializations of multi colors in \cmd{\ODw@set}\\
357 % - Made all relevant setdefaults settings (like bidfirst) non-global\\
358 % - Made all \cmd{\ODw@BidderX} and \cmd{\ODw@NameX} non-global\\
359 % - Removed '\cmd{\global}' from \cmd{\ODw@CompShow} (false and true),
360 % \cmd{\ODw@CompTurn}, \cmd{\ODw@Bidders}, \cmd{\ODw@BidLine} and
361 % \cmd{\ODw@LongCalls}\\
362 % - In command \cmd{\suit} changed 'JW \cmd{\ODw@GameSize}' into
363 % '\cmd{\ODw@GameSize}'}
364 % \changes{v1.3a}{2019/02/21}{\\
365 % - Added \cmd{\HLP} \\
366 % - Changed/Added in all relevant ODw-lang.trsl: \\
367 % - 'V0.4' into 'V0.4-2018/12/01' \\
368 % - 'FP' into 'F' , 'fp' into 'f' (entry HCP/hcp) \\
369 % - 'Figuren-Punkte' into 'Figurenpunkte' , 'figuren-punkte' into 'figurenpunkte' \\
370 % - 'FL' into 'L' , 'f{}l' into 'l' \\
371 % - \cmd{\NewDictTranslation\\ \{HLP-(ODw)\}\{FL\}} (german)
372 % }
373 % \changes{v1.3b}{2019/03/16}{\\
374 % - Added setdefaults to the list of User Commands \\
375 % - Corrected \cmd{\setdefaults} in onedown-examples: \\
376 % - changed [~] into \{\} \\
377 % - Adapted/corrected onedown-ref and onedown-examples \\
378 % - Added color 'gray' for special effects
379 % }
380 % \changes{v1.4}{2019/10/12}{\\
381 % - Made \emph{onedown-ref} independent of \emph{onedown-examples} and \emph{subfiles} \\
382 % - Corrected some mistakes ODw-*.trsl files, all \texttt{V0.51-2019/10/15} \\
383 % - Added macro \cmd{\Ten} to get rid of the extra enlargment by 'scalefnt' in \cmd{\gamefont}
384 % - Added support for the spanish language \\
385 % - Made onedown-ref.tex and onedown-examples.tex multilangual. We can output the onedown
386 % commands in all supported languages. \\
387 % - \cmd{\DeclareSymbolFont \\ \{symbols\}\{OMS\} \{txsy\}\{m\}\{n\}} interferes with package \packname{newtxmath}.
388 % I renamed \emph{symbols} into \textbf{ODw@symbols} and \emph{symbolsC} into \textbf{ODw@symbolsC}
389 % to solve this.
390 % }
391 % \changes{v1.5}{2020/02/02}{\\
392 % - Added a check if the etoolbox package is recent enough.\\
393 % - Added code to load onedown.symbols (card symbols) and explained in onedown-examples
394 % (CardSymbols) how to use it.
395 % }
396 % \changes{v1.6}{2021/04/25}{\\
397 % - Switched to \packname{translator} due to incompatibilities with
398 % \packname{translations}\\
399 % - We now use \cmd{\translate} rather than \cmd{\GetTranslation}\\
400 % - Translation files are named like: ODw-German.dict\\
401 % - Adapted the code to read them on the fly
402 % }
403 % \changes{v1.7}{2023/12/07}{\\
404 % - Added support for the italian language \\
405 % - Added an example showing how to define own colors for card symbols
406 % }
407 % ^^A Note: ^^21 denotes the exclamation mark (!)
408 % ^^A Note: Char ' is not allowed within changes
409 %
410 % \DoNotIndex{\newcommand,\newenvironment,\BODY,\boolean,\IfEqCase,\IfInteger,
411 % \DeclareFontSubstitution,\dimexpr,\ifcat,\ifmmode,\IfValueT,
412 % \fontencoding,\fontfamily,\fontseries,\fontshape,\makebox,\StrChar,\StrLen,
413 % \mathord,\mdseries,\NewEnviron,\newif,\mskip,\edef,\rotatebox,\width,
414 % \newsavebox,\noexpand,\rmfamily,\rule,\sbox,\scshape,\put,\real,
415 % \selectfont,\SetSymbolFont,\slshape,\tabcolsep,\color,\cs,\do,\docsvlist,
416 % \thinspace,\usebox,\AtBeginDocument,\begingroup,\endgroup,\unitlength,
417 % \bgroup,\egroup,\IfValueTF,\newcolumntype,\renewrobustcmd}
418 % \DoNotIndex{\@ifstar,\\,\,}
419 % \DoNotIndex{\addtolength,\advance,\alph,\baselineskip,\begin,\bfseries,\macro,
420 % \group,\center,\centering,\clubsuit,\collectcell,\count,\def,\ ,\let,
421 % \diamondsuit,\dimen,\divide,\dpts,\egroup,\else,\empty,\end,\expandafter,
422 % \endcenter,\endcollectcell,\endinput,\ensuremath,\equal,\everypar,
423 % \extracolsep,\fbox,\fboxrule,\fboxsep,\fi,\gdef,\global,\ExplSyntaxOff,
424 % \hangafter,\hangindent,\hbadness,\hbox,\heartsuit,\hfill,\ExplSyntaxOn,
425 % \hline,\hsize,\hskip,\hspace,\hss,\ht,\HUGE,\if,\IfBooleanTF,\moveto,
426 % \ifthenelse,\ifx,\itemsep,\kern,\labelsep,\labelwidth,\large,
427 % \leftmargin,\leftskip,\lengthtest,\uselanguage,\lower,
428 % \mathbf,\medskip,\multicolumn,\NeedsTeXFormat,\newboolean,\numexpr,
429 % \newcounter,\newdimen,\NewDocumentCommand,\strokepath,\closepath,
430 % \NewDocumentEnvironment,\newlength,\noindent,\p@,\par,\whiledo,
431 % \parbox,\parfillskip,\parindent,\parsep,\parskip,\partopsep,\lineto,
432 % \phantom,\ProvidesPackage,\quad,\raggedright,\raisebox,\linethickness,
433 % \relax,\renewcommand,\RequirePackage,\rightmargin,\PackageWarning,
434 % \rightskip,\rlap,\setboolean,\setbox,\setcounter,\setlength,
435 % \settowidth,\sffamily,\smaller,\larger,\space,\spadesuit,\skip@,
436 % \ssmall,\stackbox,\stepcounter,\styledate,\styleversion,\textbf,
437 % \textrm,\textsc,\textsf,\textsl,\textwidth,\thefootnote,\ifnumequal,
438 % \thinspace,\topsep,\typeout,\vspace,\vtop,\wd,\widthof,\IfFileExists,
439 % \xspace,\xspaceaddexceptions,\z@,\PackageWarning,\ForEachTrackedLanguage,
440 % \newtoks,\PackageInfo,\provideenvironment,\str,\textit,\Hoffset,\Voffset,
441 % \the,\thinmuskip,\thislang,\tl,\tmp,\xdef,\PicSize,\MidSize,
442 % }
443 % \DoNotIndex{%
444 % \\,\arrayrulewidth,\addtocounter,\cci,\DeclareMathSymbol,\skip@,
445 % \DeclareSymbolFont,\footnotemark,\footnotesize,\footnotetext,\isodd,
446 % \mathalpha,\pgfkeys,\pgfqkeys,\ProcessPgfOptions,\scriptsize,
447 % \shortstack,\superscript,\textcolor,\thinspace,\tiny,\underline,\value}
448 % \DoNotIndex{\translate,\translation,\ifpdf,\iflanguage,\iffalse,\AfterPackage,
449 % \ifbool,\setbool,\newbool,\StrSubstitute,\StrCount,\StrDel,\ifcase,
450 % \ifboolexpr,\ifnumcomp,\or,\overline,\mbox,\@ODw}
451 % \setcounter{IndexColumns}{2}
452 % ^^A \providecommand*{\url}{\texttt}
453 % ^^A\newcommand{\tasc}{\textbf{\raisebox{-0.7ex}[1ex][0pt]{*}}}
454 % \newcommand{\tasc}{\textbf{\textasteriskcentered}}
455 % ^^A \newcommand{\plus}{\texttt{\larger{\raisebox{-0.25ex}[1ex][0pt]{+}}}}
456 % \newcommand{\plus}{\texttt{\larger{\raisebox{-0.25ex}[1ex][0pt]{+}}}}
457 %^^A set the font for the macros in the margin
458 % \renewcommand{\MacroFont}{\ttfamily\scriptsize}
459 %
460 %
461 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
462 %
463 % ^^A We must redefine \verb (from doc.sty),
464 % ^^A because there is no font-changing hook to add \footnotesize
465 % ^^A This is only for the document, not the style file
466 %
467 % \makeatletter
468 % \def\verb{\relax\ifmmode\hbox\else\leavevmode\null\fi
469 % \bgroup \let\do\do@noligs \verbatim@nolig@list
470 % \ttfamily\footnotesize \verb@eol@error \let\do\@makeother \dospecials
471 % \@ifstar{\@sverb}{\@vobeyspaces \frenchspacing \@sverb}}
472 %
473 % \newcommand\ODwBox{\ODw@Box\xspace}
474 %
475 % \makeatother
476 %
477 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
478 % \GetFileInfo{onedown.sty}
479 % \title{The \OneDown package\\[0.5em]
480 % \normalsize\url{www.ctan.org/pkg/onedown}
481 % ^^A The frustrating ltxdoc also obfuscates this simple thing!
482 % \thispagestyle{empty}
483 % }
484 % \author{Jacob Wiersma \\ \url{[email protected]}}
485 % \date{v\ODwstyleversion~from \ODwstyledate}
486 %
487 % \maketitle
488 % {
489 % \gamefont{\sffamily\bfseries\large}
490 % \otherfont{\rmfamily\bfseries\normalsize}
491 % \setdefaults{bidfirst=S,bidlong=on,err=on,warn=on}
492 % \hfill
493 % \frame{
494 % \setdefaults{bidlong=off}
495 % \parbox{22em}{
496 % \northhand{A32}{QJT}{KQJT9}{QJ}
497 % \southhand{KQJT}{9876}{A8}{AK2}
498 % \westhand{8765}{AK}{732}{T987}
499 % \easthand{94}{5432}{654}{6543}
500 % \dealer[\South*!]\vulner[\NorthSouth*!]
501 % \leftupper{\dealertext}{\vulnertext}{}
502 % \showAll*
503 %
504 % \begin{bidding}*(\explainit{15--17}\\\explainit{quantitative})
505 % 1N\markit & p & 4N\markit & p \\
506 % 6N & X & {\Allpass*} \\
507 % \end{bidding}
508 %
509 % \setdefaults{warn=off}
510 %
511 % \begin{play}*{W}
512 % HK & T & 2 & 6 \\
513 % HA & J & 3 & 7 \\
514 % \end{play}
515 % }
516 % }
517 % \hfill
518 % }
519 % \setdefaults*{}
520 % \newpage
521 % \begin{abstract}\noindent
522 % This package implements commands and environments to typeset various bridge
523 % diagrams, with or without a |bidding| sequence. It offers following
524 % features:
525 % \begin{itemize}
526 % \item It is possible to use an own font and/or a font-size with which the
527 % diagrams will be typeset independently from the main font used in the
528 % document. This also allows an easy production of overhead slides and for
529 % digital projection. Different fonts can be used for e.g.\ the bidding
530 % diagram, its header, the compass, the hands etc. Most diagrams can be
531 % centered both horizontally and vertically.
532 %
533 % \item A special feature is the automated check on consistency of suits
534 % and hands. If a hand holds more than 13 cards an error is printed, if there
535 % are less then 13 cards a warning. If a suit over the 4 hands has more
536 % than 13 cards or if a card appears more than once an error like
537 % \example{\textcolor{\ODwcolor}{Error: Card \Sp\,8 occurs 2 times}} is printed.
538 % These warnings and error messages are controlled by the |err| and |warn|
539 % options, e.g.\ when loading the package.
540 %
541 % \item The output of the implemented bridge terms like \example{\double}
542 % (which you get by calling the command |\double|) are multilingual
543 % and get translated automatically. When the language |german| is
544 % active the command |\double| would produce
545 % \example{\Translate{\double}}. Also the basic symbols like A(ce),
546 % K(ing), Q(ueen) and J(ack) are multilingual. So
547 % \example{\suit[\Di]{AKQJ}} would automatically become
548 % \example{\Translate{\suit[\Di\,]{AKQJ}}} in a German text.
549 %
550 % \item It is possible to add annotations to a card diagram, like the
551 % board number, the dealer or the vulnerability etc.\ on several positions
552 % in the diagram (if a board number is given, the dealer and vulnerability
553 % are computed automatically). One can also add explanations to the
554 % |bidding| diagram, as well as the real world names of the bidders.
555 %
556 % \item There are two specials: a command to typeset a quiz with answers,
557 % and an environment to typeset the sequence of playing tricks, where also
558 % the total number of tricks won by each side is calculated and displayed.
559 % \end{itemize}
560 % \end{abstract}
561 %
562 % \tableofcontents
563 %
564 % \section{Preface}
565 %
566 % I am neither a good bridge player nor a good package writer. But I like
567 % to read about bridge and when I write about bridge (sometimes a funny
568 % short story, sometimes some training exercises for beginners) I do feel
569 % the need for an appropriate tool to support that. Surprisingly enough,
570 % there exists no comprehensive package on |CTAN| for typesetting bridge
571 % diagrams. For all those people who feel more or less the same as I do,
572 % there is this package called \OneDown. As some say: \emph{one down is
573 % good bridge}\footnote{please, don't discuss the truth-value of this
574 % statement with me}, I hope that \OneDown is a good bridge package.
575 %
576 % You can generate this documentation by running
577 %
578 % \iffalse
579 %<*verb>
580 % \fi
581 \begin{verbnobox}[\small]
582 pdflatex --shell-escape onedown.dtx
583 makeindex -s gind.ist onedown.idx
584 makeindex -s gglo.ist -o onedown.gls onedown.glo
585 pdflatex --shell-escape onedown.dtx
586 pdflatex --shell-escape onedown.dtx
587 \end{verbnobox}
588 % \iffalse
589 %</verb>
590 % \fi
591 % Use:\\
592 % |pdflatex --shell-escape '\AtBeginDocument{\NoColortrue}\input{onedown.dtx}'|
593 % as last run to get a |PDF| for printing on a monochrome printer.
594 % The |--shell-escape| flag is necesary to generate the list of user
595 % commands. If you think this is too dangerous, then run pdflatex without
596 % this flag and you will get the docmentation without the list of user
597 % command (of about 1 page). In any case you'll find a multi-page reference
598 % overview of all commands in |onedown-ref.pdf|.
599 %
600 % \section{Introduction}
601 %
602 % There must be a lot of bridge players who also use \LaTeX{} to typeset
603 % their documents. And it is almost incredible that on |CTAN| there exist
604 % no modern package with a decent documentation that supports
605 % this.
606
607 % In 1990 Kees van der Laan \cite{Laan} published an article in
608 % TUGBoat\footnote{\url{http://tug.org/TUGboat/Articles/tb11-2/tb28laan.pdf}}
609 % in which he describes how well the \TeX-machinery is able to produce
610 % beautiful bridge diagrams. Based on this article and examples,
611 % Johannes
612 % Braams put these commands together in a style file\footnote{%
613 % \packname{bridge.sty}, last version v1.7c, 1994/12/20} and added more.
614 % Some time later René Steiner and Thomas Hof produced the
615 % \packname{bridge-i} and the \packname{kibitzer}\footnote{both v1.0,
616 % 1995/04/06} style files, in which they made a lot of
617 % enhancements.
618 % Also others made some efforts in this direction.\footnote{Antony Lee
619 % released his package \packname{bridge} in 2012 and Gordon Bower his
620 % package \packname{grbbridge} in 2013. Both are very interesting but offer
621 % only limited features and are not on CTAN at the time of writing. See
622 % \url{http://www.bridgebase.com/forums/topic/51967-latex-package-for-typesetting-bridge-related-stuff/}}
623
624 % Around 2005 I used these style files for
625 % some tiny projects. The quality of the output was splendid. Putting the
626 % text and diagrams together was not always easy and the documentation was
627 % poor. In 2015, after a long pause, I had to produce bridge texts again. I
628 % enhanced some of the existing stuff and made ad hoc changes in the code,
629 % which led to smaller and greater catastrophes. Summer 2016 I decided to
630 % write a new package, based on the work of the previously mentioned
631 % persons. I called it \OneDown. The central goal was to offer a user
632 % friendly package with detailed documentation. For example you don't need
633 % to say |\setlength{\handskip}{5mm}| or |\def\handskip{5mm}| but rather
634 % call the command |\handskip{1em}|. Not only the call is somewhat
635 % friendlier, but more important, by setting the width in terms of the
636 % font used, it will automatically adapt its size accordingly to font and
637 % font-size changes. \OneDown features:
638 % \begin{itemize}
639 % \item Sizing of diagrams relative to font and font-size.
640 % \item The font-sizes of the diagrams and text are independent.
641 % \item Automated translation of all important bridge terms.
642 % \item Diagrams can optionally contain information about the dealer, who
643 % is vulnerable etc.
644 % \end{itemize}
645 %
646 % The \OneDown package is designed to be used for typesetting texts that have to
647 % do with the game of bridge. It provides not only simple commands like
648 % |\Sp| which produces the spade symbol \example{\Sp}. Also complete
649 % card diagrams with the hands of the \north, \east, etc.\ player can
650 % be defined in several ways. One can select which hands are to be shown.
651 % Bidding diagrams can be shown stand-alone or in connection with one or
652 % more hands. One can add annotations to any bid in a bidding diagrams.
653 %
654 % \section{Usage}
655 %
656 % \subsection{Initialization}
657 %
658 % \subsubsection{Requirements}
659 %
660 % The package \OneDown depends on several other packages, such as
661 % \packname{ifthen}, \packname{translator} or \packname{xspace}. All
662 % these packages get loaded automatically if not already used in your
663 % document. For a complete overview of all required packages, refer to page
664 % \pageref{RequirePackage}. All the packages are loaded without any option,
665 % so the risk of an option clash should be low: Just load your package with
666 % options \emph{before} \OneDown.
667 %
668 % Furthermore, for the several languages that \OneDown supports, there are
669 % the dictionary files with translations of the specific bridge terms.
670 % These dictionaries follow the naming convention:
671 % |ODw-<Language>.dict| and are included in the bundle. The
672 % name of the |<Language>| is generally the same as the name that you
673 % use as option for \packname{babel}, but starting with a capital.
674 % \iffalse
675 % There is one exception: the
676 % Norwegian language uses |norsk| for \packname{babel} and |norwegian| for
677 % \packname{translator}. But all the same, the |norwegian| dictionary is
678 % automatically loaded when |norsk| is used.
679 % \fi
680 %
681 % Should you make a dictionary for a language that is not provided yet, or
682 % have corrections for an existing one, please send it to the maintainer,
683 % so it can be added to the bundle.
684 %
685 % \subsubsection{Loading the package}
686 %
687 % Simply say |\usepackage{onedown}| in the preamble of
688 % your document if you want to load \OneDown with its default settings.
689 %
690 % \textbf{Warning:} \OneDown loads all necessary |ODw|-dictionaries
691 % automatically. In order to know which
692 % languages must be loaded, these must be specified \emph{before} package
693 % \packname{onedown} is loaded. In general this means that if you use
694 % \packname{babel} (or \packname{polyglossia}) you must
695 % load it before package \OneDown. If for some reason you cannot
696 % or do not want to do that, you can load any |ODw|-dictionary if you put
697 % the command: |\uselanguage{<ODw-Language>}| in your
698 % preamble, provided that the dictionary is in the \TeX-path. For a
699 % discussion about the caveats of using e.g.\ babel, refer to section%
700 % \ref{Languages}.
701 %
702 % \subsubsection{Options}\label{Options}
703 %
704 % To change the behaviour of \OneDown one can load the package with certain
705 % options: |\usepackage[<options>]{onedown}|. Of course this 'option
706 % loading' takes place in the preamble. But it is also possible to set (or
707 % change) options within the document by calling the macro |\setdefaults|.
708 % This macro uses the same |key=val| syntax as is used for the
709 % options and offers some more keys that cannot be used when loading the
710 % package. Refer to page~\pageref{Defaults} for details.
711 %
712 % As said before, the package loads its options using the
713 % |key=val| syntax. These options deal with:
714 % \begin{itemize}
715 % \item[colors] \verb:colors=0|1|2|3|4A|4B:\\
716 % The color in which the card symbols will
717 % be printed. The color options are \textbf{0} (black only), \textbf{1}
718 % (black and white) \textbf{2} (black and red), \textbf{3} (grey (for special effects)),
719 % \textbf{4A} (green, orange,
720 % red and blue), \textbf{4B} (black, orange, red and green). We also
721 % defined some synonyms, as shown in the table below.
722 % \par
723 % Thus loading the package with |\usepackage[colors=X]{onedown}| will print
724 % \begin{itemize}
725 % \item[x=0:] {\setdefaults{colors=0} \Cl, \Di, \He and \Sp}
726 % (synonyms: |mono|, |black|)
727 % \item[x=1:] {\setdefaults{colors=1} \Cl, \Di, \He and \Sp}
728 % (synonyms: |b+w|)
729 % \item[x=2:] {\setdefaults{colors=2} \Cl, \Di, \He and \Sp}
730 % (synonyms: |b+r|)
731 % \item[x=3:] {\setdefaults{colors=3} \Cl, \Di, \He and \Sp}
732 % (synonyms: |gray|, |grey|)
733 % \item[x=4A:] {\setdefaults{colors=4A} \Cl, \Di, \He and \Sp}
734 % (synonyms: |4a|, |fourA|)
735 % \item[x=4B:] {\setdefaults{colors=4B} \Cl, \Di, \He and \Sp}
736 % (synonyms: |4b|, |fourB|)
737 % \end{itemize}
738 % The default is |colors=2| for printing in black and red. Please note, that |colors=3| is not
739 % meant to typeset the whole document. You can use it if you want e.g. to repeat something and want
740 % it to be less apparent.
741 % \item[err, warn] \verb:err=on|off:\qquad\verb:warn=|on|off:\\
742 % These options regulate which messages are to be output. These
743 % messages have to do with the consistency of cards in
744 % a suit, in a hand or combined hands. It is an error when a hand has more
745 % that 13 cards, or when the same card occurs twice or more in a hand or a
746 % deal. With the option |err=on| (which is the default) these error
747 % messages appear as output. With |err=off| you can suppress that.
748 % On the other hand when a suit has less than 13 cards, this must not
749 % necessarily be wrong. Maybe only some cards are to be shown, e.g.\ in an
750 % example concerning a finesse. Or when only e.g.\ |E-W| hands are
751 % concerned, not all cards of the deck will be specified. These situations
752 % will be caught by setting |warn=on|. To suppress these spurious warnings
753 % use |warn=off|, which is the default.
754 % Synonyms for |on| are |1| and |true|. Synonyms for |off| are |0| and
755 % |false|. This also applies for other keys that do not control a package
756 % option.
757 % \end{itemize}
758 %
759 % \subsubsection{Languages \& Dictionaries}\label{Languages}
760 %
761 % \OneDown uses the \packname{tranlator} package to automatically
762 % translate often appearing brigde terms like e.g.\ \emph{declarer}. It does
763 % so by looking up these terms in the special |ODw|-dictionary for the
764 % active language. The current \OneDown version supports English, German,
765 % Dutch, French, Italian, Spanish, most Scandinavian languages and Turkish. Some
766 % dictionaries may not be complete or may contain errors, please send
767 % corrections/additions to the maintainer.
768 %
769 % In order to make \packname{translator} do its job (automatically select the
770 % right translation when the current language switches to another),
771 % \textbf{\larger it is
772 % necessary to specify the languages with the \texttt{documentclass}, and not with
773 % \texttt{babel}! }
774 %
775 % \needspace{5\baselineskip}
776 %
777 % \paragraph*{\textcolor{red}{\centering Warning for people using active
778 % characters.}}
779 %
780 % Some language packages fiddle around making characters active.
781 % This can have unexpected influence on \OneDown.
782 % The |=|~sign is used when loading the package \packname{onedown} to
783 % specify options.
784 % It appears also in calls like |\setdefaults{warn=on}|.
785 % We also use the following characters as tokens for optional arguments
786 % with the meaning as shown in this list:
787 % \begin{itemize}[itemsep=-1mm,topsep=-0em]
788 % \item[|*|] to center diagrams or print a long or capitalized text
789 % \item[|!|] special action like short names of vertical layout
790 % \item[|-|] to hide what would normally been shown
791 % \item[|+|] to show what would normally be hidden
792 % \end{itemize}
793 % \par\noindent
794 % To give you an idea what e.g.\ babel can cause we cite from
795 % \emph{The Turkish style for babel}:\par
796 % \begin{quote}
797 % Turkish typographic rules specify that a little 'white space' should be
798 % added before the characters ':', '!' and '='. In order to insert this
799 % white space automatically these characters are made |\active|, so they
800 % have to be treated in a special way.
801 % \end{quote}
802 % So babel-Turkish makes the equal sign and exlamation mark active. This
803 % leads to errors when you call e.g.\ |\setdefaults{warn=on}| or |\hand!|.
804 % If you do not need any character to be active, then load this language
805 % with |\usepackage[turkish,shorthands=]{babel}|.
806 %
807 % You can also put |\PassOptionsToPackage{shorthands=off}{babel}|
808 % above your |documentclass| line. Here is a complete example:
809 % % \iffalse
810 %<*verb>
811 % \fi
812 \begin{verbnobox}[\small]
813 \PassOptionsToPackage{shorthands=off}{babel}
814 \documentclass[a4paper,fontsize=11pt,%
815 dutch,%
816 german,%
817 english,% this is the default language
818 ]{scrartcl}
819 \usepackage{babel}
820 \end{verbnobox}
821 % \iffalse
822 %</verb>
823 % \fi
824 %
825 % If you do need the
826 % shorthand then you must disable it every time you have to use e.g.\ the
827 % |=|~character as a normal character by:
828 %
829 % \iffalse
830 %<*verb>
831 % \fi
832 \begin{verbnobox}[\small]
833 \shorthandoff{=}% Make '=' not active any more
834 \setdefaults{warn=on}
835 \shorthandon{=}% Restore '=' to active again
836 \end{verbnobox}
837 % \iffalse
838 %</verb>
839 % \fi
840 %
841 % \section{User Commands}
842 %
843 % \subsection{Overview}
844 %
845 % In the next sections we give a short description of all the user commands
846 % and environments that are defined in \OneDown. The commands marked with
847 % \ML are multilingual. I.e.\ the text they typeset gets
848 % translated automatically into the active language.
849 %
850 % In order to make sure that the example diagrams do not disturb the
851 % page layout of this document too much, we scaled them down to
852 % |footnotesize|.
853 % \gamefont{\bfseries\sffamily\footnotesize}
854 %
855 % Sometimes the output of a command is shown as an example. This output is
856 % framed in this document like \example{this}, just to recognize it easily
857 % as an output example. In an accompanying
858 % file\footnote{onedown-examples.pdf} with examples one can find in more
859 % detail how these commands are used and what they produce.
860 %
861 % We have loaded the package \OneDown with the default option for colors,
862 % giving us \textcolor{black}{black} and \textcolor{red}{red}. Furthermore,
863 % when we descibe macros, we use a colored frame that also shows the output
864 % of the commend. Some commands have optional tokens that produce an output
865 % that differs from the naked version. These optional tokens appear in a
866 % different background color like \Oarg{*!}. If an output of a macro is
867 % shown, then the output of tokenized calls is shown in parenthesis to
868 % demonstrate the difference.
869 %
870 % \subsubsection{The Compass}
871 %
872 % \boardnr{0}
873 % The compass \CP is not available as a user command itself, but it is used
874 % in all user commands that draw a card diagram. It has some special
875 % features.
876 % \begin{itemize}[itemsep=0em]
877 % \item It can mark the dealer (\north) \boardnr{1} \CP
878 % \item It can write the vulnerable side (\northsouth) in red \boardnr{5} \CP
879 % \item it can put something (a board number) in the middle
880 % \boardnr{3} \setdefaults{compmid=3} \CP
881 % \end{itemize}
882 % The machinery is intelligent enough to calculate the dealer and
883 % vulnerability from the board number. When only |black| or
884 % |b+w| is selected as option for colors, then the
885 % vulnerable side is written in italics rather colorized. Because
886 % underlining the \South*-hand would interfere with the compass frame, we
887 % overline it. With the command |\setdefaults| one can customize the look
888 % of the compass. In particular, if you want to print the actual board
889 % number, specified by calling |\boardnr{Nr}|, you can achieve that by
890 % calling |\setdefaults{compmid=\boardtext}|. In the accompanying file with
891 % examples you'll find more examples about |\setdefaults|.
892 %
893 % \subsubsection{Hooks}
894 %
895 % We use kind of hooks to
896 % \begin{enumerate}
897 % \item change the font or the font-size. These are discussed in chapter
898 % \emph{Sizing and Fonts} on page \pageref{Fonts}.
899 % \item add commentary information to card diagrams. These are discussed in
900 % chapter \emph{Conditions in Diagrams} on page \pageref{Conditions}
901 % \item There is one other hook to enable the user to add something to the
902 % compass. This is done by calling |\setdefaults{compmid=<Text>}|.
903 % \end{enumerate}
904 %
905 % \subsection{Basic Symbols}\label{BasicSym}
906 %
907 % In this section we show the predefined commands that produce terms that
908 % occur often in bridge text. On page \pageref{ReDefine} an easy way is
909 % shown to redefine them as to use a different variant of the term in
910 % question.
911 % \par\vspace{0.3\baselineskip}\noindent
912 % The next 5 macros are shorthands for the suit symbols and \NT:
913 % \par\vspace{0.5\baselineskip}\noindent
914 % \needspace{5\baselineskip}\noindent
915 % \DescribeMacro{\Cl}\MacroDef+{Cl}[\hfill \Cl]
916 % \par\noindent
917 % \DescribeMacro{\Di}\MacroDef+{Di}[\hfill \Di]
918 % \par\noindent
919 % \DescribeMacro{\He}\MacroDef+{He}[\hfill \He]
920 % \par\noindent
921 % \DescribeMacro{\Sp}\MacroDef+{Sp}[\hfill \Sp]
922 % \par\noindent
923 % \DescribeMacro{\NT}\MacroDef*+{NT}[\hfill \NT]
924 % \par\vspace{0.3\baselineskip}\noindent
925 % The next 4 macros typeset the non-bid calls
926 % \par\vspace{0.5\baselineskip}\noindent
927 % \needspace{4\baselineskip}\noindent
928 % \DescribeMacro{\pass}\MacroDef*+{pass}[\hfill \pass]
929 % \par\noindent
930 % \DescribeMacro{\allpass}\MacroDef*+{allpass}[\hfill \allpass]
931 % \par\noindent
932 % \DescribeMacro{\double}\MacroDef*+{double}[\hfill \double]
933 % \par\noindent
934 % \DescribeMacro{\redouble}\MacroDef*+{redouble}[\hfill \redouble]
935 % The next 6 macros typeset the directions that identify dealer (or player)
936 % and the axis that is vulnerable.
937 % \par\vspace{0.5\baselineskip}\noindent
938 % \needspace{4\baselineskip}\noindent
939 % \DescribeMacro{\north}\MacroDef*+{north}[\hfill \north]
940 % \par\noindent
941 % \DescribeMacro{\east}\MacroDef*+{east}[\hfill \east]
942 % \par\noindent
943 % \DescribeMacro{\south}\MacroDef*+{south}[\hfill \south]
944 % \par\noindent
945 % \DescribeMacro{\west}\MacroDef*+{west}[\hfill \west]
946 % \par\vspace{0.5\baselineskip}\noindent
947 % \DescribeMacro{\northsouth}\MacroDef*+{northsouth}[\hfill \northsouth]
948 % \par\noindent
949 % \DescribeMacro{\eastwest}\MacroDef*+{eastwest}[\hfill \eastwest]
950 % The next 4 macros typeset the \emph{unit} of the points when valuing a
951 % bridge hand. If one or more of these items do not appear in your bridge
952 % world, don't argue them, Just don't use them! They are meant to specify
953 % \emph{High Card Points}, \emph{High Card + Length Points}, \emph{Length Points},
954 % \emph{Distribution Points} and \emph{Total Points} respectively.
955 % \par\vspace{0.5\baselineskip}\noindent
956 % \DescribeMacro{\HCP}\MacroDef*+{HCP}[\hfill \HCP]
957 % \par\noindent
958 % \DescribeMacro{\HLP}\MacroDef*+{HLP}[\hfill \HLP]
959 % \par\noindent
960 % \DescribeMacro{\LP}\MacroDef*+{LP}[\hfill \LP]
961 % \par\noindent
962 % \DescribeMacro{\DP}\MacroDef*+{DP}[\hfill \DP]
963 % \par\noindent
964 % \DescribeMacro{\TP}\MacroDef*+{TP}[\hfill \TP]
965 % \par\noindent
966 % The next 5 commands produce the abbreviations for several forcing
967 % expressions.
968 % \par\vspace{0.5\baselineskip}\noindent
969 % \DescribeMacro{\GF}\MacroDef*+{GF}[\hfill \GF]
970 % \par\noindent
971 % \DescribeMacro{\SF}\MacroDef*+{SF}[\hfill \SF]
972 % \par\noindent
973 % \DescribeMacro{\NMF}\MacroDef*+{NMF}[\hfill \NMF]
974 % \par\noindent
975 % \DescribeMacro{\TSF}\MacroDef*+{TSF}[\hfill \TSF]
976 % \par\noindent
977 % \DescribeMacro{\FSF}\MacroDef*+{FSF}[\hfill \FSF]
978 %
979 % \subsubsection{Header of the Bidding Table}
980 %
981 % \par\vspace{0.5\baselineskip}\noindent
982 % \DescribeMacro{\namesNS}\MacroDef+{namesNS}[\marg{N-name}\marg{S-name}]
983 % Defines the real world names for the \north and the \south player. If
984 % they are defined, they appear in the \North*!- and the \South*!-column
985 % of the |bidding| diagram.
986 % \par\vspace{0.5\baselineskip}\noindent
987 % \DescribeMacro{\namesEW}\MacroDef+{namesEW}[\marg{E-name}\marg{W-name}]
988 % Same as |\namesNS| but now for the \east and the \west player.
989 %
990 % \subsection{The Card Diagrams}
991 %
992 % \subsubsection{The hands of the players}
993 % Before a card diagram can be shown, one must specify the cards that
994 % each player holds. With the various |<player>hand|-commands one can
995 % do this. The suits they define are only shown when a |show|-command is
996 % issued after they have been defined. The |show|-commands are discussed on
997 % page \pageref{ShowCommands}.
998 % \par\vspace{0.5\baselineskip}\noindent
999 % \needspace{4\baselineskip}\noindent
1000 % \DescribeMacro{\northhand}\MacroDef+{northhand}[\oarg{v-offset}\marg{Sp}\marg{He}\marg{Di}\marg{Cl}]
1001 % \par\noindent
1002 % \DescribeMacro{\easthand}\MacroDef+{easthand}[\oarg{h-offset}\marg{Sp}\marg{He}\marg{Di}\marg{Cl}]
1003 % \par\noindent
1004 % \DescribeMacro{\southhand}\MacroDef+{southhand}[\oarg{v-offset}\marg{Sp}\marg{He}\marg{Di}\marg{Cl}]
1005 % \par\noindent
1006 % \DescribeMacro{\westhand}\MacroDef+{westhand}[\oarg{h-offset}\marg{Sp}\marg{He}\marg{Di}\marg{Cl}]
1007 % The command |\northhand| defines the cards (all 4 suits) for the
1008 % \North*!-player. |\easthand|, |\southhand| and |\westhand| do that for
1009 % the \East*!-, \South*!- or \West*!-player. These commands have 4
1010 % mandatory arguments in
1011 % which the cards of the 4 suits are specified. In all suit commands where
1012 % card ranks are issued, one must use \textbf{T} to denote the value
1013 % \textbf{10}. On output, some kerning takes care that the output looks
1014 % like \suit{T} and not like a \textbf{1} followed by a \textbf{0}. So
1015 % |\suit{AKJT8}| produces \example{\suit{AKJT8}}.
1016 % It is also possible to use a small 'x' as symbol for a spot card: |\suit{AKxxx}|
1017 % produces \example{\suit{AKxxx}}.
1018 %
1019 % These commands also have an optional argument, an offset which by default
1020 % is 0pt. This offset is meant to finetune the layout of the hands in the
1021 % card diagrams. They change the distance between a hand and the compass.
1022 % |\northhand| and |\southhand| have a \emph{vertical} offset, whereas
1023 % |\easthand| and |\westhand| have a \emph{horizontal} one. A positive
1024 % value moves away from the compass.
1025 %
1026 % \subsubsection{The single hand}
1027 %
1028 % \noindent
1029 % \DescribeMacro{\hand}\MacroDef+{hand}[\Oarg{*!-}\oarg{pos}\marg{Sp}\marg{He}\marg{Di}\marg{Cl}]
1030 % This macro typesets the cards of one single hand, either vertically or
1031 % horizontally. There are 4 mandatory arguments defining the 4 suits. With
1032 % 2 optional tokens '|*|' resp.\ '|!|' one can typeset the hand with
1033 % some special features:
1034 % \begin{itemize}[itemsep=0em]
1035 % \item |\hand*| typesets a hand horizontally, centered
1036 % \item |\hand!| typesets a hand vertically, left aligned
1037 % \item |\hand*!| typesets a hand vertically, centered
1038 %\end{itemize}
1039 % For vertical hands the optional argument |pos| (default= \textbf{c})
1040 % controls the horizontal alignment. Without a token, the hand is typeset
1041 % horizontally, left aligned: The call |\hand{AK2}{T85}{AQT6}{A42}|
1042 % typesets the hand horizontally like:
1043 % \par\vspace{0.3\baselineskip}\noindent
1044 % \example{\hand{AK2}{T85}{AQT6}{A42}},
1045 % \par\vspace{0.3\baselineskip}\noindent
1046 % whereas the |\hand!| version produces
1047 % \shorthandoff{!}
1048 % \example{\hand!{AK2}{T85}{AQT6}{A42}}.
1049 % \shorthandon{!}
1050 % \par\vspace{0.3\baselineskip}\noindent
1051 % The third optional token, a '|-|' suppresses all output and saves the
1052 % stuff for later use. This is used e.g.\ in |\expertquiz|.
1053 %
1054 % \subsubsection{Only one suit}
1055 %
1056 % \noindent
1057 % \DescribeMacro{\onesuitAll}\MacroDef+{onesuitAll}[\Oarg{*!}\marg{N}\marg{S}\marg{E}\marg{W}]
1058 % Typesets the cards of 1 suit for all players. This command has 4
1059 % mandatory arguments defining the cards of the 4 players. There are 2
1060 % optional tokens. With |\onesuitAll*| the output is centered, with
1061 % |onesuitAll!| the cards are placed around a |NESW| compass.
1062 % Without the '|!|'-token a small box (\ODwBox) is used instead. Thus
1063 % the macro call |\onesuitAll{AQ6}{J3}{T54}{K2}| produces
1064 % \example{\onesuitAll{AQ6}{J3}{T54}{K2}}.
1065 % \par\noindent
1066 % Please note the order of the
1067 % players in the arguments: the first two denote the \north and \south hand.
1068 % The last 2 denote the \east and \west hand. We choose it this way so you
1069 % can easily cut and paste one pair from the |\onesuitAll|, or extend
1070 % |\onesuitNS| to showing all hands.
1071 % \par\vspace{0.5\baselineskip}\noindent
1072 % \DescribeMacro{\onesuitNS}\MacroDef+{onesuitNS}[\Oarg{*!}\marg{N}\marg{S}]
1073 % \par\noindent
1074 % \DescribeMacro{\onesuitEW}\MacroDef+{onesuitEW}[\Oarg{*!}\marg{E}\marg{W}]
1075 % \par\noindent
1076 % \DescribeMacro{\onesuitNE}\MacroDef+{onesuitNE}[\Oarg{*!}\marg{N}\marg{E}]
1077 % \par\noindent
1078 % \DescribeMacro{\onesuitNW}\MacroDef+{onesuitNW}[\Oarg{*!}\marg{N}\marg{W}]
1079 % These commands are similar to |\onesuitAll| but have only 2 mandatory
1080 % arguments. The command |\onesuitNS{AQ3}{JT9}| typesets
1081 % \example{\onesuitNS{AQ3}{JT9}} and |\onesuitEW{8764}{K2}| will
1082 % produce \example{\onesuitEW{8764}{K2}}. Please note that at the latter the
1083 % cards for the \east hand appear in the first argument. Finally
1084 % |\onesuitNE{AQ3}{8764}| produces \example{\onesuitNE{AQ3}{8764}} and
1085 % |\onesuitNW{AQ3}{K2}| \example{\onesuitNW{AQ3}{K2}}.
1086 % \par\vspace{0.5\baselineskip}\noindent
1087 % \DescribeMacro{\suit}\MacroDef+{suit}[\oarg{suit symbol}\marg{cards}]
1088 % This command has 1 optional argument denoting a suit symbol and 1
1089 % mandatory argument, defining the cards of the suit.
1090 % |\suit{AQJ7}| by default produces \example{\suit{AQJ7}}. When the German
1091 % language is active it would produce \example{\Translate{\suit{AQJ7}}}.
1092 % Using the optional argument like in |\suit[\Di]{AQJ7}| will produce:
1093 % \example{\suit[\Di]{AQJ7}}.
1094 %
1095 % \subsubsection{Showing Card Diagrams}\label{ShowCommands}
1096 %
1097 % \noindent
1098 % \DescribeMacro{\showAll}\MacroDef+{showAll}[\Oarg{*+}\oarg{pos}]
1099 % \par\noindent
1100 % \DeleteShortVerb{\|}
1101 % \DescribeMacro{\showNS}\MacroDef+{showNS}[\Oarg{*+}\oarg{pos}\parg{N|S}]
1102 % \par\noindent
1103 % \DescribeMacro{\showEW}\MacroDef+{showEW}[\Oarg{*+}\oarg{pos}\parg{E|W}]
1104 % \MakeShortVerb{\|}
1105 % \par\noindent
1106 % \DescribeMacro{\showNE}\MacroDef+{showNE}[\Oarg{*+}\oarg{pos}]
1107 % \par\noindent
1108 % \DescribeMacro{\showNW}\MacroDef+{showNW}[\Oarg{*+}\oarg{pos}]
1109 % All |show|-commands have two optional tokens, a '|*|' which centers the
1110 % output and a '|+|' which also displays a |bidding| diagram next to the
1111 % card diagram. This |bidding| diagram must have been defined before, see
1112 % page~\pageref{Bidding}.
1113 % They also have one optional argument that defines the aligning. Its
1114 % default is~\textbf{c}.
1115 % |\showAll| typesets a card diagram with the |NESW| compass with \North*! in
1116 % top and the hands of the 4 players surrounding it. These hands must have
1117 % been defined before by calling |\northhand| etc. Hands that are not
1118 % defined are left empty. Optionally some conditions (like the dealer or
1119 % who is vulnerable etc.) can be added to the diagram by using the commands
1120 % described in section \emph{Diagram Conditions}. Please note that when the
1121 % \north or \south hand contains a long suit that extends beyond the
1122 % |NESW| compass, this might collide with these extra texts. You can
1123 % correct that with the optional offset parameter of the condition commands
1124 % (see page \pageref{Legend}).
1125 %
1126 % The other commands are similar to |\showAll| but typeset only the hands
1127 % of the players that are represented in the name of the command:
1128 % \NorthSouth*!, \EastWest*!, \North*!--\East*! and \North*!--\West*!.
1129 %
1130 % The commands |\showNS| and |\showEW| have an extra optional argument with
1131 % which selectively only one of the two hands can be displayed. E.g.\
1132 % |\showNS(S)| will display only the \South*-hand.
1133 % \needspace{6\baselineskip}\noindent
1134 %
1135 % \subsubsection{Showing Card Diagrams with Bidding}\label{PlayCommands}
1136 %
1137 % \subsubsection{Diagram Conditions}
1138 %
1139 % \noindent
1140 % \DescribeMacro{\headlinetext}\MacroDef+{headlinetext}[\marg{text}]
1141 % \par\noindent
1142 % \DescribeMacro{\footlinetext}\MacroDef+{footlinetext}[\marg{text}]
1143 % These commands have 1 mandatory argument: the text that defines the
1144 % annotation that is to be added to a card diagram. The text can be on more
1145 % than one line, just separate them with a |\par| or
1146 % |\newline|\footnote{Using '\bs\bs' instead produces a misleading error:
1147 % \textbf{! Missing \} inserted\ldots}}.
1148 % |\headlinetext| places the annotation above the diagram, |\footlinetext|
1149 % below it.
1150 % \par\vspace{0.5\baselineskip}
1151 % \needspace{4\baselineskip}\noindent
1152 % \DescribeMacro{\leftupper}\MacroDef+{leftupper}[\oarg{h-offset}\marg{line1}\marg{line2}\marg{line3}]\label{Legend}
1153 % \par\noindent
1154 % \DescribeMacro{\leftlower}\MacroDef+{leftlower}[\oarg{h-offset}\marg{line1}\marg{line2}\marg{line3}]
1155 % \par\noindent
1156 % \DescribeMacro{\rightupper}\MacroDef+{rightupper}[\oarg{h-offset}\marg{line1}\marg{line2}\marg{line3}]
1157 % \par\noindent
1158 % \DescribeMacro{\rightlower}\MacroDef+{rightlower}[\oarg{h-offset}\marg{line1}\marg{line2}\marg{line3}]
1159 % These commands have 1 optional argument (default 0pt) with which you can
1160 % add some extra horizontal space if hand and legend collide, and 3
1161 % mandatory arguments: the lines of text that are added as conditions
1162 % to the card diagram. Both |\leftupper| (|\rightupper|) place their
1163 % text in the left- (right-) upper corner of the diagram. The top line
1164 % will be aligned with the (inner) top of the diagram. |\leftlower|
1165 % (|\rightlower|) are similar, but place their text at the lower corner of
1166 % the diagram. The last line is aligned with the (inner) bottom of the
1167 % diagram. For an empty line you must issue an empty argument.
1168 % With a positive offset, |\leftupper| and |\leftlower| shift to the left
1169 % whereas |\rightupper| and |\rightlower| shift to the right. I.e.\ they
1170 % shift away from their neighbouring hand.
1171 % \par\vspace{0.5\baselineskip}\noindent
1172 % \DescribeMacro{\dealer}\MacroDef+{dealer}[\oarg{text}]\label{dealerX}
1173 % \par\noindent
1174 % \DescribeMacro{\vulner}\MacroDef+{vulner}[\oarg{text}]
1175 % Both commands have 1 optional argument. If present it sets (and prints)
1176 % the internal corresponding variable to this value, otherwise it only
1177 % outputs the value of this internal variable.
1178 % \par\vspace{0.5\baselineskip}\noindent
1179 % \DescribeMacro{\dealertext}\MacroDef+{dealertext}[\oarg{text}]
1180 % \par\noindent
1181 % \DescribeMacro{\vulnertext}\MacroDef+{vulnertext}[\oarg{text}]
1182 % These commands have also 1 optional argument. If present e.g.\
1183 % |\dealertext[\North*]| this text is output in the form
1184 % \example{\dealertext[\North*]}. If the German language is active then the
1185 % call |\dealertext[\South*]| produces the text
1186 % \foreignlanguage{german}{\example{\dealertext[\South*]}}. Calling
1187 % |\dealertext| without an argument outputs the predefined text, which can
1188 % be set with |\dealer|.\\
1189 % Example:
1190 % |\dealer[Jacob]\dealertext| produces \example{\dealer[Jacob]\dealertext}.
1191 %
1192 % \par\vspace{0.5\baselineskip}\noindent
1193 % \DescribeMacro{\boardnr}\MacroDef+{boardnr}[\marg{Nr}]
1194 % The macro |\boardnr| has 1 mandatory argument. If it is a number, it is
1195 % considered to be the board number. The dealer and which side is
1196 % vulnerable is then calculated from it and stored in the appropriate
1197 % variables. If it is not a positive integer, it is considered user-defined
1198 % text and will be stored and used \emph{as is}.
1199 % \par\vspace{0.5\baselineskip}\noindent
1200 % \DescribeMacro{\boardtext}\MacroDef*+{boardtext}[\Oarg{*}]
1201 % The macro |\boardtext| has 1 token and no arguments. |\boardtext|
1202 % retrieves only the board number (stored by calling |\boardnr|).
1203 % |\boardtext*| outputs the board number with some additional (multilingual)
1204 % text. |\boardnr{23}\boardtext| produces \example{\boardnr{23}\boardtext}
1205 % whereas |\boardtext*| would produce \example{\boardtext*}.
1206 % Note that |\boardnr| can have a non-integer argument.
1207 % |\boardnr{Fun}\boardtext| produces \example{\boardnr{Fun}\boardtext} and
1208 % with |\boardtext*| it would produce \example{\boardtext*}.
1209 %
1210 % \subsubsection{Sizing and Fonts}\label{Fonts}
1211 %
1212 % \noindent
1213 % \DescribeMacro{\handskip}\MacroDef+{handskip}[\marg{length description}]
1214 % This command has 1 mandatory argument: a \textbf{text} describing a
1215 % length. |\handskip| enlarges the distance (default |1em|) between the
1216 % rightmost hand and the |bidding| diagram. A negative value diminishes the
1217 % distance.
1218 % \par\vspace{0.5\baselineskip}
1219 % \needspace{4\baselineskip}\noindent
1220 % \DescribeMacro{\bidderfont}\MacroDef+{bidderfont}[\marg{font description}]
1221 % \par\noindent
1222 % \DescribeMacro{\compassfont}\MacroDef+{compassfont}[\marg{font description}]
1223 % \par\noindent
1224 % \DescribeMacro{\gamefont}\MacroDef+{gamefont}[\marg{font description}]
1225 % \par\noindent
1226 % \DescribeMacro{\legendfont}\MacroDef+{legendfont}[\marg{font description}]
1227 % \par\noindent
1228 % \DescribeMacro{\namefont}\MacroDef+{namefont}[\marg{font description}]
1229 % \par\noindent
1230 % \DescribeMacro{\otherfont}\MacroDef+{otherfont}[\marg{font description}]
1231 % These commands all have 1 mandatory argument: a \textbf{description} of
1232 % the font to be used. In the list below the command names are typeset in
1233 % their default font.
1234 % \begin{itemize}[itemsep=-2mm]
1235 % \item {\mdseries\sffamily bidderfont}: Used for the player-names in the
1236 % |bidding| diagram.\\ The default is |\mdseries\sffamily|.
1237 % \item {\mdseries\sffamily compassfont}: Used for the directions and the
1238 % ''midvalue'' in the compass. The default is |\mdseries\sffamily|.
1239 % \item {\bfseries\sffamily gamefont}: Used for card diagrams, hands and
1240 % suits.\\ The default is |\bfseries\sffamily|.
1241 % \item {\mdseries\rmfamily legendfont}: Used for the conditions in
1242 % card diagrams.\\ The default is |\mdseries\rmfamily|.
1243 % \item {\mdseries\slshape namefont}: Used for the real world names in
1244 % |bidding| diagrams.\\ The default is |\mdseries\slshape|.
1245 % \item {\bfseries\sffamily otherfont}: Used for the other bridge
1246 % expressions, also outside diagrams. The default is |\bfseries\sffamily|.
1247 % \end{itemize}
1248 % If a new font is
1249 % defined, all relevant dimensions of the card diagrams (including the
1250 % |NESW| compass, the |bidding| diagram etc.) will be recalculated.
1251 % Some examples for setting the gamefont to a new value are:
1252 % \begin{itemize}[itemsep=-2mm]
1253 % \item |\gamefont{\sffamily\bfseries\HUGE}| to get \emph{HUGE} diagrams.
1254 % Refer to the documentation of package \packname{moresize} for details.
1255 % \item |\legendfont{\smaller}| to diminish the text in the card diagram
1256 % conditions a little. Refer to the
1257 % documentation of package \packname{relsize} for details.
1258 % \item |\gamefont{\sffamily\scalefont{3}}|\footnote{needs package
1259 % scalefnt} to typeset real big diagrams for overhead sheets
1260 % \end{itemize}
1261 % \needspace{4\baselineskip}\noindent
1262 %
1263 % \subsection{Misc}
1264 %
1265 % Many of the text producing macros have in common that they can produce 4
1266 % different versions of the text they represent. Normally, without any
1267 % token, they produce the
1268 % lowercase text. With the token~|*| they produce the capitalised text.
1269 % With the token |!| they produce some abbreviation of the text (if
1270 % available). Finally with both tokens~|*!| the produce the capitalised
1271 % abbreviation of the text. What exactly is produced, is shown in the
1272 % macro descriptions. In some cases it seems rather strange to have the
1273 % code for an abbreviated form, i.e.\ |\Lead[*!]|, because it produces only
1274 % the variants \Lead and \Lead*. But remember that we also support automatic
1275 % translations into other languages and that in another language an
1276 % abreviation might be feasible: With the german language active |\Lead*|
1277 % and |\Lead*!| produce \foreignlanguage{german}{\example{\Lead*}} and
1278 % \foreignlanguage{german}{\example{\Lead*!}} respectively.
1279
1280 % At the other
1281 % hand it seems peculiar to let |\Ace!| produce \example{\Ace!} for an
1282 % Ace. But we do not foresee which modern novelist might want to produce
1283 % this. That's why they are defined, but 'normal' writers probably will
1284 % never used it.
1285 %
1286 % The short versions are primarily meant to be used within diagrams,
1287 % allthough it is possible to get the long forms there too. Refer to page
1288 % \pageref{Defaults} for details. We show the output of such a macro
1289 % |\Macro| (note the capital~|M|!) in the form:
1290 % \par\vspace{0.3\baselineskip}\noindent
1291 % \MacroDef{Macro}[\Oarg{*!}\hfill \cmd{\Macro} (\cmd{\Macro*}, \cmd{\Macro!}, \cmd{\Macro*!})]
1292 % In addition to each macro |\Macro| with its 4 variants, we also create a
1293 % macro |\macro| which is defined to output the most used variant of
1294 % |\Macro|:
1295 % \par\vspace{0.3\baselineskip}\noindent
1296 % \MacroDef{macro}[\hfill most used variant of \cmd{\Macro}]
1297 % \par\vspace{0.3\baselineskip}\noindent
1298 % It is very easy to redefine |\macro|.\label{ReDefine}
1299 % As an example we take the macro |\ace|. Its definition is:
1300 % \par
1301 % |\def\ace{\Ace*!}|\\
1302 % so calling |\ace| will produce \example{\ace}. If somewhere in your
1303 % document you redefine |\ace| to be
1304 % \par
1305 % |\def\ace{\Ace*}|\\
1306 % {\def\ace{\Ace*} then |\ace| will produce \example{\ace}} rather than \example{\ace}.
1307 %
1308 % \subsubsection{Honor Cards}
1309 %
1310 % \noindent
1311 % \DescribeMacro{\Ace}\MacroDef*+{Ace}[\Oarg{*!}\hfill \Ace (\Ace*, \Ace!, \Ace*!)]
1312 % \par\noindent
1313 % \DescribeMacro{\ace}\MacroDef*+{ace}[\hfill \ace]
1314 % \par\noindent
1315 % \DescribeMacro{\King}\MacroDef*+{King}[\Oarg{*!}\hfill \King (\King*, \King!, \King*!)]
1316 % \par\noindent
1317 % \DescribeMacro{\king}\MacroDef*+{king}[\hfill \king]
1318 % \par\noindent
1319 % \DescribeMacro{\Queen}\MacroDef*+{Queen}[\Oarg{*!}\hfill \Queen (\Queen*, \Queen!, \Queen*!)]
1320 % \par\noindent
1321 % \DescribeMacro{\queen}\MacroDef*+{queen}[\hfill \queen]
1322 % \par\noindent
1323 % \DescribeMacro{\Jack}\MacroDef*+{Jack}[\Oarg{*!}\hfill \Jack (\Jack*, \Jack!, \Jack*!)]
1324 % \par\noindent
1325 % \DescribeMacro{\jack}\MacroDef*+{jack}[\hfill \jack]
1326 % These commands produce the language dependent names for the honor
1327 % cards. To be used primarily when adding a lead to a card diagram.
1328 %
1329 % \subsubsection{Variants of Basic Symbols}
1330 %
1331 % In section \ref{BasicSym} we already described the macros for the main
1332 % variant. Here we introduce the macros that handle 4 variants with a
1333 % combination of the tokens |*| and |!|.
1334 % \par\noindent
1335 % We start with the variants for |\NT|
1336 % \par\vspace{0.3\baselineskip}\noindent
1337 % \DescribeMacro{\nt}\MacroDef*+{nt}[\Oarg{*!}\hfill \nt (\nt*, \nt!, \nt*!)]
1338 % \par\noindent
1339 % Next we show the 4 macros for the non-bid calls:
1340 % \par\vspace{0.3\baselineskip}\noindent
1341 % \DescribeMacro{\Pass}\MacroDef*+{Pass}[\Oarg{*!}\hfill \Pass (\Pass*, \Pass!, \Pass*!)]
1342 % \par\noindent
1343 % \DescribeMacro{\Allpass}\MacroDef*+{Allpass}[\Oarg{*!}\hfill \Allpass
1344 % (\Allpass*, \Allpass!, \Allpass*!)]
1345 % \par\noindent
1346 % \DescribeMacro{\Double}\MacroDef*+{Double}[\Oarg{*!}\hfill \Double (\Double*,
1347 % \Double!, \Double*!)]
1348 % \par\noindent
1349 % \DescribeMacro{\Redouble}\MacroDef*+{Redouble}[\Oarg{*!}\hfill \Redouble
1350 % (\Redouble*, \Redouble!, \Redouble*!)]
1351 % \par\noindent
1352 % Next come the 6 macros for the symbolic names of players and axes.
1353 % \par\vspace{0.5\baselineskip}\noindent
1354 % \needspace{4\baselineskip}\noindent
1355 % \DescribeMacro{\North}\MacroDef*+{North}[\Oarg{*!}\hfill \North (\North*, \North!, \North*!)]
1356 % \par\noindent
1357 % \DescribeMacro{\East}\MacroDef*+{East}[\Oarg{*!}\hfill \East (\East*, \East!, \East*!)]
1358 % \par\noindent
1359 % \DescribeMacro{\South}\MacroDef*+{South}[\Oarg{*!}\hfill \South (\South*, \South!, \South*!)]
1360 % \par\noindent
1361 % \DescribeMacro{\West}\MacroDef*+{West}[\Oarg{*!}\hfill \West (\West*, \West!, \West*!)]
1362 % \par\vspace{0.5\baselineskip}\noindent
1363 % \DescribeMacro{\NorthSouth}\MacroDef*+{NorthSouth}[\Oarg{*!}\hfill \NorthSouth (\NorthSouth*, \NorthSouth!, \NorthSouth*!)]
1364 % \par\noindent
1365 % \DescribeMacro{\EastWest}\MacroDef*+{EastWest}[\Oarg{*!}\hfill \EastWest (\EastWest*, \EastWest!, \EastWest*!)]
1366 % \par\noindent
1367 % The 4 commands that typeset the \emph{point-unit}
1368 % \par\vspace{0.5\baselineskip}\noindent
1369 % \DescribeMacro{\hpts}\MacroDef*+{hpts}[\Oarg{*!}\hfill \hpts (\hpts*, \hpts!, \hpts*!)]
1370 % \par\noindent
1371 % \DescribeMacro{\tpts}\MacroDef*+{tpts}[\Oarg{*!}\hfill \tpts (\tpts*, \tpts!, \tpts*!)]
1372 % \par\noindent
1373 % \DescribeMacro{\lpts}\MacroDef*+{lpts}[\Oarg{*!}\hfill \lpts (\lpts*, \lpts!, \lpts*!)]
1374 % \par\noindent
1375 % \DescribeMacro{\dpts}\MacroDef*+{dpts}[\Oarg{*!}\hfill \dpts (\dpts*, \dpts!, \dpts*!)]
1376 % \par\noindent
1377 % The forcing terms
1378 % \par\vspace{0.5\baselineskip}\noindent
1379 % \DescribeMacro{\gforce}\MacroDef*+{gforce}[\Oarg{*!}\hfill \gforce (\gforce*, \gforce!, \gforce*!)]
1380 % \par\noindent
1381 % \DescribeMacro{\sforce}\MacroDef*+{sforce}[\Oarg{*!}\hfill \sforce (\sforce*, \sforce!, \sforce*!)]
1382 % \par\noindent
1383 % \DescribeMacro{\nmforce}\MacroDef*+{nmforce}[\Oarg{*!}\hfill \nmforce (\nmforce*, \nmforce!, \nmforce*!)]
1384 % \par\noindent
1385 % \DescribeMacro{\tsforce}\MacroDef*+{tsforce}[\Oarg{*!}\hfill \tsforce (\tsforce*, \tsforce!, \tsforce*!)]
1386 % \par\noindent
1387 % \DescribeMacro{\fsforce}\MacroDef*+{fsforce}[\Oarg{*!}\hfill \fsforce (\fsforce*, \fsforce!, \fsforce*!)]
1388 %
1389 % \subsubsection{Conditions in Diagrams}\label{Conditions}
1390 %
1391 % These commands produce the langugage dependent expressions for
1392 % \emph{\all, \none, \by, \board} etc. To be used primarily in card
1393 % diagrams.
1394 % \par\vspace{0.5\baselineskip}\noindent
1395 % \DescribeMacro{\All}\MacroDef*+{All}[\Oarg{*!}\hfill \All (\All*, \All!, \All*!)]
1396 % \par\noindent
1397 % \DescribeMacro{\all}\MacroDef*+{all}[\hfill \all]
1398 % \par\noindent
1399 % \DescribeMacro{\None}\MacroDef*+{None}[\Oarg{*!}\hfill \None (\None*, \None!, \None*!)]
1400 % \par\noindent
1401 % \DescribeMacro{\none}\MacroDef*+{none}[\hfill \none]
1402 % \par\noindent
1403 % \DescribeMacro{\by}\MacroDef*+{by}[\hfill \by]
1404 % \par\noindent
1405 % \DescribeMacro{\Board}\MacroDef*+{Board}[\Oarg{*!}\hfill \Board (\Board*, \Board!, \Board*!)]
1406 % \par\noindent
1407 % \DescribeMacro{\board}\MacroDef*+{board}[\hfill \board]
1408 % \par\noindent
1409 % \DescribeMacro{\Contract}\MacroDef*+{Contract}[\Oarg{*!}\hfill \Contract (\Contract*, \Contract!, \Contract*!)]
1410 % \par\noindent
1411 % \DescribeMacro{\contract}\MacroDef*+{contract}[\hfill \contract]
1412 % \par\noindent
1413 % \DescribeMacro{\Declarer}\MacroDef*+{Declarer}[\Oarg{*!}\hfill \Declarer (\Declarer*, \Declarer!, \Declarer*!)]
1414 % \par\noindent
1415 % \DescribeMacro{\declarer}\MacroDef*+{declarer}[\hfill \declarer]
1416 % \par\noindent
1417 % \DescribeMacro{\Deal}\MacroDef*+{Deal}[\Oarg{*!}\hfill \Deal (\Deal*, \Deal!, \Deal*!)]
1418 % \par\noindent
1419 % \DescribeMacro{\deal}\MacroDef*+{deal}[\hfill \deal]
1420 % \par\noindent
1421 % \DescribeMacro{\Lead}\MacroDef*+{Lead}[\Oarg{*!}\hfill \Lead (\Lead*, \Lead!, \Lead*!)]
1422 % \par\noindent
1423 % \DescribeMacro{\lead}\MacroDef*+{lead}[\hfill \lead]
1424 %
1425 % \subsubsection{Annotations in Bidding Diagrams}
1426 %
1427 % \noindent
1428 % \DescribeMacro{\alert}\MacroDef+{alert}[\hfill \alert]
1429 % \par\noindent
1430 % \DescribeMacro{\announce}\MacroDef+{announce}[\hfill \announce]
1431 % \par\noindent
1432 % These macros have no argument. With |\alert| one can mark a call that
1433 % must be alerted with an asterisk (\alert) e.g.\ a weak 2\NT{} opening
1434 % with |2\NT\alert|. It produces \example{2\NT\alert}. With |\announce| one
1435 % can mark a bid with an 'A' (\announce) where an announcement is
1436 % obligatory, e.g |2\He\announce| produces \example{2\He\announce}.
1437 % \par\vspace{0.5\baselineskip}
1438 % \needspace{4\baselineskip}\noindent
1439 % \DescribeMacro{\markit}\MacroDef+{markit}
1440 % \par\noindent
1441 % \DescribeMacro{\explainit}\MacroDef+{explainit}[\marg{explanation}]
1442 % These commands are to be used to mark a call in the |bidding| diagram and
1443 % explain it with a kind of footnote-like mechanism, directly below the
1444 % |bidding| diagram. Both |\markit| and |\explainit| step a counter for
1445 % associating the explanation with the mark. |\markit| has no arguments;
1446 % |\explainit| has one mandatory argument: the text to be displayed as
1447 % explanation. |\explainit| should be called in the description part of
1448 % |bidding| diagrams (or expertquiz). The text of the explanation is then
1449 % typeset under the |bidding| diagram and has the same width.
1450 % You can use newline (|\\|, or |\newline|) in your text to force an new
1451 % line in the explanation\footnote{Using \bs par produces the error:
1452 % \textbf{Runaway argument?\ldots}}.
1453 % \needspace{6\baselineskip}%
1454
1455 % \subsubsection{Specials}
1456 %
1457 % \par\vspace{0.5\baselineskip}\noindent
1458 % \DescribeMacro{\expertquiz}\MacroDef+{expertquiz}[\Oarg{*!}\oarg{comment}\marg{award}]
1459 % This command displays a hand, a |bidding| sequence and some additional
1460 % stuff. It is designed after the \emph{Expert Quiz} column in the
1461 % \emph{Bridge Magazin} of the \textsf{DBV}\footnote{Deutsche Bridge
1462 % Verband}, the German Bridge Union.
1463 % \\
1464 % It has 2 optional tokens: a '|*|' for centering and a
1465 % '|!|' which 1) forces the |bidding| diagram to appear on a new line, and
1466 % 2) shifts the hand a bit to the right.
1467 % Next there is one optional argument with wich some commentary information
1468 % can be added. And finally there is 1 mandatory argument that describes the
1469 % awards for certain solutions. Both the hand and the bidding must be
1470 % defined before calling |\expertquiz|. One can do that by calling e.g.
1471 % |\hand-| which suppresses the output of the hand.
1472 %
1473 % \subsubsection{Re-Initialization}
1474 %
1475 % \par\vspace{0.5\baselineskip}\noindent
1476 % \DescribeMacro{\newgame}\MacroDef+{newgame}
1477 % This command resets most bridge diagram data and can be used to start a
1478 % new series of bridge diagrams. It is however not necessary to use
1479 % |\newgame| if one enters new cards for the \north etc.\ hands. The list
1480 % below shows which items are reset by calling |\newgame|
1481 % \begin{itemize}
1482 % \item resets |\boardnr{0}|.
1483 % \item resets |headlinetext| and |footlinetext|.
1484 % \item resets |LeftUpperText|, |LeftLowerText|, |RightUpperText| and
1485 % |RightLowerText|.
1486 % \item resets |northhand|, |easthand|, |southhand| and |westhand|.
1487 % \item resets |namesNS| and |namesEW|.
1488 % \item resets the checks for Spades, Hearts, Diamonds and Clubs.
1489 % \end{itemize}
1490 % \needspace{15\baselineskip}
1491 % \par\vspace{0.5\baselineskip}\noindent
1492 % \DescribeMacro{\setdefaults}\MacroDef+{setdefaults}[\Oarg{*}\string{\meta{key1=val1},\meta{key2=val2},\ldots\string}]\label{Defaults}
1493 % \par\noindent
1494 % \DeleteShortVerb{\|}
1495 % \begin{tabular}{>{\ttfamily}l>{\ttfamily}l}
1496 % key & font \\\hline
1497 % bidder & bidderfont \\
1498 % compass & compassfont \\
1499 % game & gamefont \\
1500 % legend & legendfont \\
1501 % name & namefont \\
1502 % other & otherfont \\\hline
1503 % \\
1504 % key & value \\\hline
1505 % colors & 0|1|\underline{2}|3|4A|4B \\
1506 % warn & \underline{off}|on \\
1507 % err & off|\underline{on} \\
1508 % \hline
1509 % \end{tabular}
1510 % \qquad
1511 % \begin{tabular}{>{\ttfamily}l>{\ttfamily}l}
1512 % key & value \\\hline
1513 % compline & \meta{factor} \\
1514 % compshow & off|\underline{on} \\
1515 % compsize & \meta{factor} \\
1516 % compturn & \underline{off}|on \\\hline
1517 % \\
1518 % key & value \\\hline
1519 % bidders & off|\underline{on} \\
1520 % bidfirst & N|E|S|\underline{W} \\
1521 % bidline & \underline{off}|on \\
1522 % bidlong & off|\underline{on} \\
1523 % \hline
1524 % \end{tabular}
1525 % \MakeShortVerb{\|}
1526 % \par\vspace{\baselineskip}
1527 % The macro |\setdefaults| uses a \meta{key}=\meta{val} mechanism. The
1528 % tables above show which keys are available. The underlined key values are
1529 % defaults. The available keys with respect to fonts are: |bidder|,
1530 % |compass|, |game|, |legend|, |name| and |other|. In upper the table to
1531 % the left the association between key and font is shown. A call e.g.\
1532 % |\setdefaults{name=\bfseries\scriptsize}| will set the default for the
1533 % namefont to the value specified. The starred form |\setdefaults*| will
1534 % also call |\resetfonts|, which effectuates any change in a new default
1535 % font immediately.
1536 %
1537 % In the lower table to the left you'll find the three keys that are also
1538 % possible as package options. They have been described already in section
1539 % \ref{Options}.
1540 %
1541 % The keys with respect to the compass are: |compline|, |compshow|,
1542 % |compsize| and |compturn|. They are shown in the upper table to the
1543 % right. With the first key one can set the linethickness of the compass
1544 % frame, the default is |0.1em|. The second key controls whether the
1545 % compass is shown or not. The third key controls the size of the compass,
1546 % which per default is |2.5em|. With the fourth key one can rotate the
1547 % letters for the \EastWest*! direction over 90°. The
1548 % multiplication-\meta{factor}, which defaults to the value |1|, can have
1549 % any non-negative real value.
1550 %
1551 % The keys with respect to the |bidding| diagram are: |bidders|, |bidfirst|,
1552 % |bidline| and |bidlong|. They are shown in the lower table to the right.
1553 % With the first key one can suppress the bidders in the bidding header.
1554 % With the second key one can set which bidder appears in the first column
1555 % of the diagram. The default is |W|. The third key controls whether an
1556 % |\hline| is printed below the header. The fourth key switches between
1557 % the long or short form of the non-bid calls, like \example{\pass} or
1558 % \example{\Pass!}.
1559 %
1560 % For the key-value |on| we have the synonyms |true| and |1|, for the
1561 % key-value |off| we have the synonyms |false| and |0|.
1562 % \par\vspace{0.5\baselineskip}\noindent
1563 % \DescribeMacro{\resetfonts}\MacroDef+{resetfonts}
1564 % When calling this macro, all fonts are set back to their default value.
1565 % This is the value that was explicitly set by a previous call of
1566 % |\setdefaults|, or to the intrinsic default value if |\setdefaults| has
1567 % not been called before.
1568 %
1569 % \subsection{Environments}
1570 %
1571 % In the first place we must warn the user for a peculiarity of the package
1572 % \packname{collcell}, which is used to do some special processing in these
1573 % 3 environments: \emph{The last row must either end with a newline} (|\\|)
1574 % \emph{or with an \emph{empty} cell.}\par\noindent
1575 % The advantage of the |collcell| processing is that within the |bidding|
1576 % and |play| diagrams we can use shorthands for the suit symbols: rather
1577 % than writing |3\Sp| in a |bidding| diagram we can also write |3S| to obtain
1578 % 3\,\Sp. In the |play| diagram we could write |HA| instead of |\He\,\Ace|
1579 % and get \He\,A as output. In |bidding| diagrams some non-bid calls may
1580 % appear in short or in long form, controlled by calling
1581 % |\setdfefaults{bidlong=on}|, which switches to the lang form, or
1582 % |\setdfefaults{bidlong=off}| which switches to the short form.
1583 % These non-bid calls are coded as follows: A small |p| yields short form
1584 % \example{\Pass!} or long form \example{\pass}. A capital |P| yields short
1585 % form \example{\Allpass*!} or long form \example{\allpass}. A capital |X|
1586 % yields short form \example{\Double!} and long form \example{\double}. A
1587 % capital |R| yields short form \example{\Redouble!} and long form
1588 % \example{\redouble}.\footnote{due to the fact that |x| denotes a
1589 % spotcard, we had to implement it this way}
1590 % \par\vspace{0.5\baselineskip}\noindent
1591 % \DescribeEnv{bidding}\EnvDef*+{bidding}[\Oarg{*!-}\oarg{pos}\parg{description}]\label{Bidding}
1592 % This environment has 3 tokens. The '|*|' centers the |bidding| diagram.
1593 % The '|!|' outputs the short form: e.g.\ \North*! rather than the long form
1594 % \North* in the table heading. The '|-|' completely suppresses the output.
1595 % The data is stored in a savebox and can be used in other macros, e.g.\ in
1596 % all |\showXX| macros. Next come 2 optional parameters. The first
1597 % one controls the alignment (default \textbf{c}) and the second one adds
1598 % the list of annotations below the |bidding| diagram. With |\setdefaults|
1599 % one can fine tune the look of the |bidding| diagram. Refer to page
1600 % \pageref{Defaults} for details. For example
1601 % \iffalse
1602 %<*verb>
1603 % \fi
1604 \begin{verbnobox}[\small]
1605 \begin{bidding}(\explainit{WeakTwo}\explainit{preemptive})
1606 2H\markit & p & 3H\markit & p \\
1607 \end{bidding}
1608 \quad
1609 \setdefaults{bidlong=off}
1610 \begin{bidding}!
1611 2H & p & 3H & p\\
1612 \end{bidding}\\
1613 \end{verbnobox}
1614 % \iffalse
1615 %</verb>
1616 % \fi
1617 % produces\\
1618 % \example{
1619 % \begin{bidding}(\explainit{WeakTwo}\\\explainit{preemptive})
1620 % 2H\markit & p & 3H\markit & p \\
1621 % \end{bidding}
1622 % \quad
1623 % \setdefaults{bidlong=off}
1624 % ^^A avoid clash with babel languages
1625 % \shorthandoff{!}
1626 % \begin{bidding}!
1627 % 2H & p & 3H & p \\
1628 % \end{bidding}
1629 % }
1630 %
1631 % \shorthandon{!}\setdefaults{bidlong=on}
1632 %
1633 % \par\vspace{0.3\baselineskip}\noindent
1634 % In addition to the shorthands we mentioned before, one can also use macros
1635 % in the bidding and play diagrams. As long as these macros appear as 1
1636 % single token in the diagram, no special care has to be taken. But if a
1637 % macro appears as multiple tokens, e.g.\ like the call |\Pass*!|, which
1638 % consists of the 3 tokens |\Pass|, |*| and |!|, then it \textbf{must} be
1639 % enclosed in braces |{...}| to make it act as 1 token. Without the
1640 % braces |\Pass*!| will produce \example{\Xfer{\Pass*!}}, with them
1641 % |{\Pass*!}| will produce \example{\Xfer{{\Pass*!}}}.
1642 % Note that although |\pass| expands to |\Pass*|, it wil produce the correct
1643 % \example{\Xfer{\pass}}.
1644 % \par\vspace{0.5\baselineskip}\noindent
1645 % \DescribeEnv{biddingpair}\EnvDef*+{biddingpair}[\Oarg{*!-}\oarg{pos}\parg{descr}]
1646 % This environment is essentially the same as the |bidding| environment, but
1647 % here the |bidding| diagram has only two columns rather than four.
1648 % \par\vspace{0.5\baselineskip}\noindent
1649 % \DescribeEnv{play}\EnvDef*+{play}[\Oarg{*}\marg{Lead}\oarg{Trump}]
1650 % This environment has 1 token, a '|*|', which controls the centering of
1651 % the table; 1 mandatory argument, denoting the opening lead and 1
1652 % optional argument which specifies the trump suit, with default: \NT. It
1653 % typesets a diagram with the sequence of playing tricks, by producing a
1654 % table with 8 columns: the running number; the player who had
1655 % had the lead; the 4 cards played in this trick and finally
1656 % the 2 columns that show how many tricks \NorthSouth*!{} and \EastWest*!{}
1657 % have won so far. The user has to specify only the columns 3-6, i.e.\ the
1658 % cards that were played. Columns 1--2 and 7--8 are constructed by
1659 % \OneDown. Just as in |bidding| diagrams, also here
1660 % one can denote the suit with |S|, |H|, |D|, or |C|. The winning card is
1661 % automatically detected, taking into account if a suit contract or \NT
1662 % is played. The winning tricks counters are then updated automatically.
1663 % Concerning consistency it is just as with hands and deals: If a card
1664 % occurs more than one time, an error is raised and for missing cards a
1665 % warning is issued.
1666 % \\[0.3\baselineskip]
1667 % \needspace{4\baselineskip}\noindent
1668 % \otherfont{\sffamily\bfseries\footnotesize}
1669 % \begin{minipage}{\linewidth}
1670 % \begin{minipage}[b]{0.36\linewidth}
1671 %
1672 % \iffalse
1673 %<*verb>
1674 % \fi
1675 \begin{verbnobox}[\small]
1676 \begin{play}{W} \\
1677 D3 & 2 & Q & K \\
1678 HA & 5 & 4 & J \\
1679 C3 & 5 & K & A \\
1680 \end{play}
1681 \end{verbnobox}
1682 % \iffalse
1683 %</verb>
1684 % \fi
1685 %
1686 % \end{minipage}
1687 % \quad
1688 % \example{
1689 % \begin{play}{W}
1690 % D3 & 2 & Q & K \\
1691 % HA & 5 & 4 & J \\
1692 % C3 & 5 & K & A \\
1693 % \end{play}
1694 % }
1695 % \end{minipage}
1696 %
1697 % \needspace{8\baselineskip}\noindent
1698 %
1699 % \iffalse
1700 %<*verb>
1701 % \fi
1702 \begin{verbnobox}[\small]
1703 \begin{play}*{W} \\
1704 D3 & 2 & Q & K \\
1705 HA & 5 & 4 & J \\
1706 C3 & 5 & K & A \\
1707 \end{play}
1708 \end{verbnobox}
1709 % \iffalse
1710 %</verb>
1711 % \fi
1712 %
1713 % produces the same diagram, but this time horizontally
1714 % centered.\\[0.5\baselineskip]
1715 % \example{
1716 % \begin{minipage}{0.95\linewidth}
1717 % \begin{play}*{W}
1718 % D3 & 2 & Q & K \\
1719 % HA & 5 & 4 & J \\
1720 % C3 & 5 & K & A \\
1721 % \end{play}
1722 % \end{minipage}
1723 % }
1724 % \otherfont{\sffamily\bfseries\footnotesize}
1725 %
1726 % \section{Final Remarks}
1727 %
1728 % \subsection{Known Bugs}
1729 %
1730 % \begin{itemize}
1731 % \item Some dictionaries have questionable translations.
1732 % \item The boxes in |\northhand| and |\southhand| lead to problems with
1733 % shifting the \west hand. See file Legends in the example bundle.
1734 % \end{itemize}
1735 % \newpage
1736 %
1737 % \subsection{ToDo}
1738 %
1739 % \begin{itemize}[itemsep=-2mm]
1740 % \item \textbf{Correct the description how to enable automatic language
1741 % switching (since we use package translator)}
1742 % \item Add the High Points to card diagrams (like Turnier in KA)
1743 % \item Check if |\def\xspace{}| is also needed in bidding...?
1744 % \item Make a template for showing 16 hands on 1 DIN A4 (3x5+1 or 4x4
1745 % landscape) e.g as handout for the hands on slides.
1746 % \item Read source files in PBN format. Example:
1747 % \url{http://new.bridgekosice.sk/bridzove-diagramy-vykrelene-pomocou-tex/}
1748 % \end{itemize}
1749 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1750 %
1751 % \subsection{Acknowledgements}
1752 %
1753 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1754 %
1755 %
1756 % This package is based on (ideas from) the style files:
1757 % \begin{itemize}[itemsep=-2mm]
1758 % \item |bridge-i v1.0 (1995/04/16)| by René Steiner and Thomas Hof.
1759 % \item |kibitzer v1.0 (1995/04/16)| by René Steiner and Thomas Hof.
1760 % \item |bridge v0.1 (2012/03/18)| by Antony Lee.
1761 % \item |grbbridge v2.2 (2013/12/24)| by Gordon Bower.
1762 % \end{itemize}
1763 % 
1764 % The style file |bridge-i| is based on the style file |bridge| v1.7c
1765 % (1994/12/20) by J.L. Braams, which on itself was based on an article
1766 % by Kees van der Laan in TUGboat (Vol 11 (1990), No 2: p265ff.
1767 % \par
1768 % Last but not least I want to thank all those wonderful people down
1769 % there in the Internet who spent their time in answering silly questions
1770 % and solving difficult problems. If I had imagined the difficulties I
1771 % would encounter, then I would not have started this work. And without the
1772 % help %of all these, to me unknown, people, this package would not exist.
1773 %
1774 % \StopEventually{}
1775 %
1776 % \newpage
1777 % \section{Implementation}
1778 %
1779 % \iffalse
1780 %<*package>
1781 % \fi
1782 %
1783 % \subsection{Prelimaries}
1784 %
1785 % \subsubsection{Packages we depend upon}
1786 %
1787 % \label{RequirePackage}
1788 % \begin{macrocode}
1789 % Warn if a too old expl3 package is used.
1790 \RequirePackage{expl3}[2019/09/21]% needed for LaTeX3 packages (xparse)
1791 \RequirePackage{%
1792 xcolor,% colorizing symbols \Sp etc.
1793 textcomp,% for the numbersign in environment play.
1794 moresize,% add \HUGE and \ssmall to font-sizes
1795 relsize,% relative font-sizes. (e.g. \smaller)
1796 makecmds,% needed for provideenvironment
1797 xparse,% optional params and starred commands
1798 xspace,% handling of spacing behind a command
1799 calc,% makes calculations and lengths easier
1800 ifthen,% easy booleans, tests and loops
1801 adjustbox,% stacked boxes in L-/R-Lower captions
1802 translator,% auto-translate terms (e.g. East->Ost)
1803 array,% actions for tabular column cells
1804 collcell,% macro calls for tabular column cells
1805 pgfopts,% for keyval opts, loads also pgfkeys
1806 environ,% for handling bidding environments
1807 xstring,% for easy string processing.
1808 tracklang,% for iterating over loaded languages
1809 pict2e,% for drawing the compass
1810 }
1811 % \end{macrocode}
1812 %\noindent
1813 % Add exceptions for xspace
1814 % \begin{macrocode}
1815 \xspaceaddexceptions{%
1816 = \markit \, \suit \translate
1817 2 3 4 5 6 7 8 9 T J Q K A
1818 }
1819 % \end{macrocode}
1820 %
1821 % \subsubsection{Options}
1822 %
1823 % We use the \packname{pgf} |<key>=<val>| system for our
1824 % options: |colors|, |warn| and |err|.
1825 % \begin{macrocode}
1826 \pgfkeys{/ODw/.is family}
1827 \def\ODw@set#1{\pgfkeys{/ODw,#1}}
1828 \ODw@set{colors/.is choice,}
1829 \ODw@set{warn/.is choice,}
1830 \ODw@set{err/.is choice,}
1831 % \end{macrocode}
1832 % The details for option |colors| are on page \pageref{Colors}ff and those for
1833 % option |warn| and |err| on page \pageref{Messages}.
1834 %
1835 % \subsubsection{Misc}
1836 %
1837 % \begin{macro}{\,}\MacroDef{,}
1838 % \begin{macro}{\thinspace}\MacroDef{thinspace}
1839 % We redefine |\thinspace| (originally $\frac{1}{6}$em) to a smaller amount.
1840 % That makes denominations like |3\Sp| (3\Sp) look better. The code is
1841 % from:\\
1842 % \url{https://tex.stackexchange.com/questions/181003/multiply-fine-tuning-with-a-thinspace}\\
1843 % This code however doesn't work when coded within an own package, unless we
1844 % use |\AtBeginDocument|.
1845 % \begin{macrocode}
1846 \AtBeginDocument{%
1847 \renewcommand{\,}[1][1]{%
1848 \ifmmode\mskip#1\thinmuskip%
1849 \else\thinspace[#1]\fi%
1850 }%
1851 \renewcommand{\thinspace}[1][1]{%
1852 \kern#1\dimexpr0.16667em\relax%
1853 }%
1854 }% AtBeginDocument
1855 % \end{macrocode}
1856 % \end{macro}
1857 % \end{macro}
1858 % \begin{macro}{\ODw@gsetlength}\MacroDef{ODw@gsetlength}[\marg{\bs len-name}\marg{len-value}]
1859 % \noindent
1860 %
1861 % We need to store the length of certain objects that are within a
1862 % group (the group is needed to keep the font-size changes local).
1863 % Therefore we define macro |\ODw@gsetlength|
1864 % that works globally. The code is based upon a solution on LaTeX
1865 % StackExchange:\\
1866 % (\url{https://tex.stackexchange.com/questions/406015/defining-macro-gsetlength-as-global-setlength-reliable})
1867 % \begin{macrocode}
1868 \gdef\ODw@gsetlength#1#2{%
1869 \begingroup
1870 \setlength\skip@{#2}% local assign to scratch reg.
1871 \global#1=\skip@% global assignment to #1;
1872 \endgroup% restore \skip@ by endgroup.
1873 }% ODw@gsetlength
1874 % \end{macrocode}
1875 % \end{macro}
1876 %
1877 % \begin{macro}{\ODw@append}\MacroDef{ODw@append}[\marg{tokens}]
1878 % In the environment |play| we need to calculate the winning tricks for
1879 % \NorthSouth*! and \EastWest*!\footnote{For details see page \pageref{Play}}.
1880 % We store this information as a string in |\ODw@Scratch| and use
1881 % |\ODw@append| to accumulate them.
1882 % \begin{macrocode}
1883 \gdef\ODw@append#1{%
1884 \bgroup%
1885 \edef\tmp{\the\ODw@Scratch #1}%
1886 \global\ODw@Scratch=\expandafter{\tmp}%
1887 \egroup%
1888 }% ODw@append
1889 % \end{macrocode}
1890 % \end{macro}
1891 %
1892 % \subsubsection{Variables}
1893 %
1894 % In this package we do use font relative sizing. That means that widths
1895 % and skips are defined in terms of |em|, |ex| and |baselineskip|. On the
1896 % other hand there are e.g.\ the real world names of the bidders, that must
1897 % be recorded. Some of these the user should be able to control. Rather
1898 % than forcing the user to do that directly with |\def| or |\renewcommand|
1899 % we store all this information in internal variables, by defining a
1900 % constant command. These variables can be set by calling a user command,
1901 % that is associated with the variable. E.g.\ the variable |\ODw@Skipwidth|
1902 % gets set by the command |\handskip|. The variables we use are:
1903 % \par\vspace{0.5\baselineskip}\noindent
1904 % \DescribeMacro{\ODw@BidderFont}
1905 % Controlled by |\bidderfont|: the font used for the players (|bidding|).
1906 % \par\noindent
1907 % \DescribeMacro{\ODw@CompassFont}
1908 % Controlled by |\compassfont|: the font used for the compass.
1909 % \par\noindent
1910 % \DescribeMacro{\ODw@GameFont}
1911 % Controlled by |\gamefont|: the font used for all card diagrams
1912 % \par\noindent
1913 % \DescribeMacro{\ODw@LegendFont}
1914 % Controlled by |\legendfont|: the font used for the annotations.
1915 % \par\noindent
1916 % \DescribeMacro{\ODw@NameFont}
1917 % Controlled by |\namefont|: the font used for the real world names.
1918 % \par\noindent
1919 % \DescribeMacro{\ODw@OtherFont}
1920 % Controlled by |\otherfont|: the font used for other bridge
1921 % expressions, also outside diagrams.
1922 % \par\vspace{0.5\baselineskip}\noindent
1923 % \DescribeMacro{\ODw@BidderDefault}
1924 % \DescribeMacro{\ODw@CompassDefault}
1925 % \DescribeMacro{\ODw@GameDefault}
1926 % \DescribeMacro{\ODw@LegendDefault}
1927 % \DescribeMacro{\ODw@NameDefault}
1928 % \DescribeMacro{\ODw@OtherDefault}
1929 % These contain the default values for the fonts
1930 % \par\vspace{5.5\baselineskip}\noindent
1931 % \DescribeMacro{\ODw@North@Name}
1932 % \DescribeMacro{\ODw@South@Name}
1933 % Controlled by |\namesNS|: hold the real world names of the \north
1934 % and the \south player.
1935 % \par\vspace{0.5\baselineskip}\noindent
1936 % \DescribeMacro{\ODw@East@Name}
1937 % \DescribeMacro{\ODw@West@Name}
1938 % Controlled by |\namesEW|: hold the real world names of the \east
1939 % and the \west player. These names are typeset using the font specified with
1940 % |\namefont|.
1941 % \par\vspace{0.5\baselineskip}\noindent
1942 % \DescribeMacro{ODw@BoardText}
1943 % Controlled by |\boardtext|: holds the board number and extra text.\\
1944 % \DescribeMacro{ODw@HeaderText}
1945 % Controlled by |\headlinetext|: holds header information for card
1946 % diagrams.\\
1947 % \DescribeMacro{ODw@FooterText}
1948 % Controlled by |\footlinetext|: holds footer information for card
1949 % diagrams.\\
1950 % \DescribeMacro{ODw@Last}
1951 % Used in command |\ODw@Tricks|: to store the player that had the
1952 % lead\footnote{see page \pageref{Last}}.\\
1953 % \DescribeMacro{\ODw@Skipwidth}
1954 % Controlled by |\handskip|: holds the distance between hand and bidding
1955 % diagram.
1956 % \begin{macrocode}
1957 \def\ODw@CompSize{1}% factor to enlarge the compass
1958 \def\ODw@CompLine{}% thickness of compass frame
1959 \def\ODw@Skipwidth{1em}%
1960 % \end{macrocode}
1961 %
1962 % \subsubsection{Booleans, Saveboxes, Lengths, Counters and Registers}
1963 %
1964 % \paragraph{Booleans}
1965 %
1966 % \DescribeMacro{\ifODw@description}
1967 % |\ifODw@description| is used in the |bidding| environments and the
1968 % command |\expertquiz| to test if there is an annotation that should
1969 % be written.
1970 % \par\noindent
1971 % \DescribeMacro{\ifODw@short}
1972 % |\ifODw@short| is used in the |bidding| environments and the command
1973 % |\expertquiz| to denote if a short form of the diagram header is to be
1974 % used.
1975 % \par\noindent
1976 % \DescribeMacro{\ifODw@monochrome}
1977 % |\ifODw@monochrome| flags the case
1978 % that the user specified |colors=0| or |colors=1|, i.e.\ just black and
1979 % white. In this situation we will not print the vulnerable side in red,
1980 % but use italics instead.
1981 % \par\noindent
1982 % \DescribeMacro{\ifOdW@CardSkip}
1983 % |\ifOdW@CardSkip| determines whether we need some extra space between
1984 % card ranks (i.e.\ in suit descriptions) or not (i.e.\ in |bidding|
1985 % or |play| diagrams).
1986 % \par\noindent
1987 % \DescribeMacro{\ifOdW@Bidders}
1988 % |\ifODw@Bidders| suppresses the bidders in the bidding header.
1989 % \par\noindent
1990 % \DescribeMacro{\ifOdW@BidLine}
1991 % |\ifODw@BidLine| draw a |\hline| below the bidding header.
1992 % \par\noindent
1993 % \DescribeMacro{\ifOdW@LongCalls}
1994 % |\ifODw@LongCalls| determines whether to use the short (like \North*!) or
1995 % the long form (like \North*) for calls in the |bidding| diagram.
1996 % \par\noindent
1997 % \DescribeMacro{\ifOdW@CompShow}
1998 % With |\ifODw@CompShow| one can suppress drawing a compass within card
1999 % diagramns completely.
2000 % \par\noindent
2001 % \DescribeMacro{\ifOdW@CompTurn}
2002 % With |\ifODw@CompTurn| one rotates letters |E| and |W| in the
2003 % compass 90°.
2004 % \begin{macrocode}
2005 \newif\ifODw@description% must typeset an annotation
2006 \newif\ifODw@short% short form in bidding header
2007 \newif\ifODw@monochrome% no colors wanted
2008 \newif\ifOdW@CardSkip% skip between ranks needed
2009 % \end{macrocode}
2010 % The next booleans are directly controlled by |\setdefaults|.
2011 % \begin{macrocode}
2012 \newif\ifODw@Bidders% suppress bidders in bidding header
2013 \newif\ifODw@BidLine% draw \hline below bidding header
2014 \newif\ifODw@LongCalls% switch between long/short calls
2015 \newif\ifODw@CompShow% show compass or not
2016 \newif\ifODw@CompTurn% turn E-W letters 90°
2017 % \end{macrocode}
2018 % \begin{macro}{\ODw@EmptyHeader}
2019 % \begin{macro}{\ODw@EmptyFooter}
2020 % Since there seems to be a problem in using\label{Empty}
2021 % |\ifthenelse|\footnote{\textbf{ifthenelse} bites \textbf{multicolumn}!}
2022 % in particular places, these booleans are set by calling |ODw@TestIfEmpty|
2023 % (which uses an ordinary |\ifthenelse|) \emph{outside} the dangerous
2024 % places, and then use e.g.\ |\ifODw@EmptyHeader| as a test whether the
2025 % header is empty or not.
2026 % \begin{macrocode}
2027 \newboolean{ODw@EmptyHeader}% = 'header is empty'
2028 \newboolean{ODw@EmptyFooter}% = 'footer is empty'
2029 % \end{macrocode}
2030 % \end{macro}
2031 % \end{macro}
2032 % \paragraph{Saveboxes}
2033 % \DescribeMacro{\ODw@Diagram@Box}
2034 % |\ODw@Diagram@Box| is to store the actual card diagram (the compass
2035 % with the hands) in order to calculate its width.
2036 % \par\noindent
2037 % \DescribeMacro{\ODw@BidBox}
2038 % |\ODw@BidBox| stores a |bidding| diagram.
2039 % \par\noindent
2040 % \DescribeMacro{\ODw@Hand@Box}
2041 % |\ODw@Hand@Box| stores a hand with the 4 suits.
2042 % \par\noindent
2043 % \begin{macrocode}
2044 \newsavebox\ODw@Diagram@Box
2045 \newsavebox\ODw@Hand@Box
2046 \newsavebox\ODw@BidBox
2047 % \end{macrocode}
2048 % \paragraph{Lengths}
2049 % \DescribeMacro{\ODw@Bid@Width}
2050 % Is used to store the actual width of the |bidding| diagram.
2051 % \par\noindent
2052 % \DescribeMacro{\ODw@Card@Skip} Defines space between
2053 % adjacent cards in suits.
2054 % \par\noindent
2055 % \DescribeMacro{\ODw@Diagram@Width} Defines the width of compass plus
2056 % (\EastWest*!) hands.
2057 % \par\noindent
2058 % \DescribeMacro{\ODw@Skip@Width} Defines the distance between the card
2059 % diagram and the |bidding| diagram.
2060 % \par\noindent
2061 % \DescribeMacro{\ODw@Tmp@Len}
2062 % \par\noindent
2063 % \DescribeMacro{\ODw@Tmp@Width} Auxiliary lengths, used in several
2064 % calculations.
2065 % \par\noindent
2066 % \begin{macrocode}
2067 \newlength\ODw@Compasssize% the size of the compass.
2068 \newlength\ODw@Diagram@Width
2069 \newlength\ODw@Card@Skip
2070 \setlength\ODw@Card@Skip{.15em}% space between cards
2071 \newlength\ODw@Bid@Width
2072 \newlength\ODw@Skip@Width
2073 \setlength\ODw@Skip@Width{\ODw@Skipwidth}
2074 \newlength\ODw@Tmp@Len% temp var for computations
2075 \newlength\ODw@Tmp@Width% temp var for computations
2076 % \end{macrocode}
2077 % \paragraph{Counters}
2078 % \DescribeMacro{ODw@Nr} Counts lines (in |play| diagrams) and explanations
2079 % (in |bidding| diagrams).
2080 % \begin{macrocode}
2081 \newcounter{ODw@Nr}
2082 % \end{macrocode}
2083 % \par\noindent
2084 % \DescribeMacro{ODw@Cnt} Auxiliary counter, used in several calculations.
2085 % \begin{macrocode}
2086 \newcounter{ODw@Cnt}
2087 % \end{macrocode}
2088 % \par\noindent
2089 % \DescribeMacro{ODw@PlayerNr} Set to the player that won the trick in
2090 % environment |play|.
2091 % \begin{macrocode}
2092 \newcounter{ODw@PlayerNr}
2093 % \end{macrocode}
2094 % \par\noindent
2095 % \DescribeMacro{ODw@NSCnt} Holds the number of N-S tricks in environment
2096 % |play|.
2097 % \begin{macrocode}
2098 \newcounter{ODw@NSCnt}
2099 % \end{macrocode}
2100 % \par\noindent
2101 % \DescribeMacro{ODw@EWCnt} Holds the number of E-W tricks in environment
2102 % |play|.
2103 % \begin{macrocode}
2104 \newcounter{ODw@EWCnt}
2105 % \end{macrocode}
2106 % \paragraph{Registers}
2107 % \DescribeMacro{ODw@Scratch} Tempory store for winning tricks in
2108 % environment |play|.
2109 % \begin{macrocode}
2110 \newtoks{\ODw@Scratch}
2111 % \end{macrocode}
2112 %
2113 % \subsubsection{Fonts}
2114 %
2115 % \paragraph{Text Fonts}
2116 %
2117 % Here we merely define the commands to set the default fonts. At the end
2118 % of this .sty file they are set to their value. Refer to
2119 % section~\ref{Init} for details.
2120 % \begin{macro}{\bidderfont}
2121 % \begin{macro}{\ODw@BidderFont}
2122 % The font used to indicate the symbolic player (N, E, S, W) in bidding
2123 % diagrams. The default is |\mdseries\sffamily|.
2124 % \begin{macrocode}
2125 \newcommand\bidderfont[1]{\gdef\ODw@BidderFont{#1}}
2126 % \end{macrocode}
2127 % \end{macro}
2128 % \end{macro}
2129 %
2130 % \begin{macro}{\compassfont}
2131 % \begin{macro}{\ODw@CompassFont}
2132 % The font used to indicate the directions (N, E, S, W) in the compass. The
2133 % default is |\mdseries\sffamily|.
2134 % \begin{macrocode}
2135 \newcommand\compassfont[1]{\gdef\ODw@CompassFont{#1}}
2136 % \end{macrocode}
2137 % \end{macro}
2138 % \end{macro}
2139 %
2140 % \begin{macro}{\namefont}
2141 % \begin{macro}{\ODw@NameFont}
2142 % The font used for the real world names of the players in bidding
2143 % diagrams. The default id |\mdseries\slshape|.
2144 % \begin{macrocode}
2145 \newcommand\namefont[1]{\gdef\ODw@NameFont{#1}}
2146 % \end{macrocode}
2147 % \end{macro}
2148 % \end{macro}
2149 %
2150 % \begin{macro}{\legendfont}
2151 % \begin{macro}{\ODw@LegendFont}
2152 % The font used for the conditions in card diagrams. The default is
2153 % |\mdseries\rmfamily|.
2154 % \begin{macrocode}
2155 \newcommand\legendfont[1]{\gdef\ODw@LegendFont{#1}}
2156 % \end{macrocode}
2157 % \end{macro}
2158 % \end{macro}
2159 %
2160 % \begin{macro}{\otherfont}
2161 % \begin{macro}{\ODw@OtherFont}
2162 % The font used for the other bridge expressions like |\north|, |\pass| or
2163 % |\double|. The default is |\bfseries\sffamily|.
2164 % \begin{macrocode}
2165 \newcommand\otherfont[1]{\gdef\ODw@OtherFont{#1}}
2166 % \end{macrocode}
2167 % \end{macro}
2168 % \end{macro}
2169 %
2170 % \begin{macro}{\gamefont}
2171 % The font for the hands and calls. It sets the general font-size/widths for
2172 % the game. The default is |\bfseries\sffamily|.
2173 % \par\noindent
2174 % \begin{macro}{\ODw@GameFont}
2175 % We use widths that are dynamically adjusted at font changes and store the
2176 % 'value' as text in |\ODw@GameFont|.
2177 % \par\noindent
2178 % \begin{macro}{\ODw@GameSize}
2179 % |\ODw@GameSize| recalculates these
2180 % sizes and is called in all show- and bid-diagrams.
2181 % \begin{macrocode}
2182 \newcommand\gamefont[1]{%
2183 \gdef\ODw@GameFont{#1}%
2184 \gdef\ODw@GameSize{% recalculate dimens for the new font
2185 \ODw@GameFont%
2186 \setlength\ODw@Skip@Width{\ODw@Skipwidth}%
2187 }%
2188 }% gamefont
2189 % \end{macrocode}
2190 % \end{macro}
2191 % \end{macro}
2192 % \end{macro}
2193 %
2194 % \paragraph{Symbol Font}
2195 % We need special symbols to get solid colored \He{} and \Di, rather than
2196 % \textcolor{red}{\ensuremath{\heartsuit}}{} and
2197 % \textcolor{red}{\ensuremath{\diamondsuit}}. We use those from |stix|.
2198 % As the shape of the 'normal' black suits differ from the red ones we also
2199 % take the black suits from the font |stix|. First we define the symbols
2200 % and font. As we do not want to load the complete package, we only use
2201 % the relevant piece of code found in |txfont.sty|:
2202 % \begin{macrocode}
2203 \fontencoding{T1}\fontfamily{stix}
2204 \fontseries{m}\fontshape{n}\selectfont
2205 %
2206 % Code stolen from txfonts.sty.
2207 % It works smoothly: thank you guys!
2208 % Because of an interference with package newtxmath I had to rename
2209 % symbols into ODw@symbols and symbolsC into ODw@symbolsC
2210 %
2211 \DeclareSymbolFont{ODw@symbols}{OMS}{txsy}{m}{n}
2212 \SetSymbolFont{ODw@symbols}{bold}{OMS}{txsy}{bx}{n}
2213 \DeclareFontSubstitution{OMS}{txsy}{m}{n}
2214 \DeclareSymbolFont{ODw@symbolsC}{U}{txsyc}{m}{n}
2215 \SetSymbolFont{ODw@symbolsC}{bold}{U}{txsyc}{bx}{n}
2216 \DeclareFontSubstitution{U}{txsyc}{m}{n}
2217 % \end{macrocode}
2218 % \begin{macro}{\ODw@spadesuit}
2219 % \begin{macrocode}
2220 \DeclareMathSymbol{\ODw@spadesuit}{\mathord}{ODw@symbols}{127}
2221 % \end{macrocode}
2222 % \end{macro}
2223 % \begin{macro}{\ODw@varheart}
2224 % \begin{macrocode}
2225 \DeclareMathSymbol{\ODw@varheart}{\mathord}{ODw@symbolsC}{114}
2226 % \end{macrocode}
2227 % \end{macro}
2228 % \begin{macro}{\ODw@vardiamond}
2229 % \begin{macrocode}
2230 \DeclareMathSymbol{\ODw@vardiamond}{\mathord}{ODw@symbolsC}{113}
2231 % \end{macrocode}
2232 % \end{macro}
2233 % \begin{macro}{\ODw@clubsuit}
2234 % \begin{macrocode}
2235 \DeclareMathSymbol{\ODw@clubsuit}{\mathord}{ODw@symbols}{124}
2236 % \end{macrocode}
2237 % \end{macro}
2238 %
2239 % \subsection{Bridge Basic Terms}
2240 %
2241 % \subsubsection{Suit Symbols}
2242 %
2243 % First we supply shorthands for the `five' suits (\Cl, \Di, \He, \Sp and
2244 % \NT) that are used in the game of bridge.
2245 % We define the international version with the English shortcuts. We use
2246 % the |xcolor| package to colorize the suit symbols. The color can be set
2247 % as an |<key>=<val>| option when loading the package. The option
2248 % |colors=0| means mono-color (black only), synonyms of key 0 are |mono|
2249 % and |black|. |colors=1| means black and white, a synonym is |b+w|.
2250 % |colors=2| means bi-color (black and red), with synonym |b+r|.
2251 % |colors=3| means grey, with synonyms |gray| and |grey|. This 'color' is meant for special
2252 % effects, e.g. for making unimportant parts less visible
2253 % |colors=4A| gives qua-color (green, orange, red and blue); synonyms are
2254 % |fourA| and |4a|. Finally |colors=4B| defines the second qua-color (black,
2255 % orange, red and green) with synonyms |fourB| and |4b|.
2256 %
2257 % We precede all the suit symbols with a `very-thin-space' (|\,[0.3]|)
2258 % which is 0.3 the size of a normal |\thinspace|.\label{Colors}
2259 %
2260 % In order to test which suit (|\Cl|,\ldots) was encountered in
2261 % |\ODw@translate|\footnote{see page \pageref{Translate}} we \emph{must}
2262 % define the suits with a |renewrobustcommand|. So we must |\def| them
2263 % first.
2264 %
2265 % \changes{v0.6a}{2018/03/15}{\\
2266 % - In order to test which suit (\cmd{\Cl},\ldots) was encountered in \cmd{\ODw@translate} (see page \pageref{Translate}) we \emph{must} define the suits as a \emph{renewrobustcommand}. So we \cmd{\def}ine them first! The idea was given on LaTeX StackExchange by egreg, see \url{https://tex.stackexchange.com/questions/420257/test-which-macro-is-called-in-tabular/420258#420258}
2267 % }
2268 %
2269 % \begin{macrocode}
2270 % \def them first and then use renewrobustcmd!
2271 \def\Cl{}\def\Di{}\def\He{}\def\Sp{}%
2272 \ODw@set{%
2273 colors/0/.code={%
2274 \ODw@monochrometrue%
2275 \renewrobustcmd\Cl{\textcolor{black}%
2276 {\,[0.3]\ensuremath{\ODw@clubsuit}}\xspace}%
2277 \renewrobustcmd\Di{\textcolor{black}%
2278 {\,[0.3]\ensuremath{\ODw@vardiamond}}\xspace}%
2279 \renewrobustcmd\He{\textcolor{black}%
2280 {\,[0.3]\ensuremath{\ODw@varheart}}\xspace}%
2281 \renewrobustcmd\Sp{\textcolor{black}%
2282 {\,[0.3]\ensuremath{\ODw@spadesuit}}\xspace}%
2283 }%
2284 }
2285 \ODw@set{colors/mono/.code={\pgfkeys{/ODw/colors=0}}}
2286 \ODw@set{colors/black/.code={\pgfkeys{/ODw/colors=0}}}
2287 %
2288 \ODw@set{%
2289 colors/1/.code={%
2290 \ODw@monochrometrue%
2291 \renewrobustcmd\Cl{\textcolor{black}%
2292 {\,[0.3]\ensuremath{\ODw@clubsuit}}\xspace}%
2293 \renewrobustcmd\Di{\,[0.3]\ensuremath{\diamondsuit}\xspace}%
2294 \renewrobustcmd\He{\,[0.3]\ensuremath{\heartsuit}\xspace}%
2295 \renewrobustcmd\Sp{\textcolor{black}%
2296 {\,[0.3]\ensuremath{\ODw@spadesuit}}\xspace}%
2297 }%
2298 }
2299 \ODw@set{colors/b+w/.code={\pgfkeys{/ODw/colors=1}}}
2300 %
2301 \ODw@set{%
2302 colors/2/.code={%
2303 \ODw@monochromefalse%
2304 \renewrobustcmd\Cl{\textcolor{black}%
2305 {\,[0.3]\ensuremath{\ODw@clubsuit}}\xspace}%
2306 \renewrobustcmd\Di{\textcolor{red}%
2307 {\,[0.3]\ensuremath{\ODw@vardiamond}}\xspace}%
2308 \renewrobustcmd\He{\textcolor{red}%
2309 {\,[0.3]\ensuremath{\ODw@varheart}}\xspace}%
2310 \renewrobustcmd\Sp{\textcolor{black}%
2311 {\,[0.3]\ensuremath{\ODw@spadesuit}}\xspace}%
2312 }%
2313 }
2314 \ODw@set{colors/b+r/.code={\pgfkeys{/ODw/colors=2}}}
2315 %
2316 \ODw@set{%
2317 colors/3/.code={%
2318 \ODw@monochromefalse%
2319 \renewrobustcmd\Cl{\textcolor{gray}%
2320 {\,[0.3]\ensuremath{\ODw@clubsuit}}\xspace}%
2321 \renewrobustcmd\Di{\textcolor{gray}%
2322 {\,[0.3]\ensuremath{\ODw@vardiamond}}\xspace}%
2323 \renewrobustcmd\He{\textcolor{gray}%
2324 {\,[0.3]\ensuremath{\ODw@varheart}}\xspace}%
2325 \renewrobustcmd\Sp{\textcolor{gray}%
2326 {\,[0.3]\ensuremath{\ODw@spadesuit}}\xspace}%
2327 }%
2328 }
2329 \ODw@set{colors/grey/.code={\pgfkeys{/ODw/colors=3}}}
2330 \ODw@set{colors/gray/.code={\pgfkeys{/ODw/colors=3}}}
2331 %
2332 \ODw@set{%
2333 colors/4A/.code={%
2334 \ODw@monochromefalse%
2335 \renewrobustcmd\Cl{\textcolor{green}%
2336 {\,[0.3]\ensuremath{\ODw@clubsuit}}\xspace}%
2337 \renewrobustcmd\Di{\textcolor{orange}%
2338 {\,[0.3]\ensuremath{\ODw@vardiamond}}\xspace}%
2339 \renewrobustcmd\He{\textcolor{red}%
2340 {\,[0.3]\ensuremath{\ODw@varheart}}\xspace}%
2341 \renewrobustcmd\Sp{\textcolor{blue}%
2342 {\,[0.3]\ensuremath{\ODw@spadesuit}}\xspace}%
2343 }%
2344 }
2345 \ODw@set{colors/fourA/.code={\pgfkeys{/ODw/colors=4A}}}
2346 \ODw@set{colors/4a/.code={\pgfkeys{/ODw/colors=4A}}}
2347 %
2348 \ODw@set{%
2349 colors/4B/.code={%
2350 \ODw@monochromefalse%
2351 \renewrobustcmd\Cl{\textcolor{black}%
2352 {\,[0.3]\ensuremath{\ODw@clubsuit}}\xspace}%
2353 \renewrobustcmd\Di{\textcolor{orange}%
2354 {\,[0.3]\ensuremath{\ODw@vardiamond}}\xspace}%
2355 \renewrobustcmd\He{\textcolor{red}%
2356 {\,[0.3]\ensuremath{\ODw@varheart}}\xspace}%
2357 \renewrobustcmd\Sp{\textcolor{green}%
2358 {\,[0.3]\ensuremath{\ODw@spadesuit}}\xspace}%
2359 }%
2360 }
2361 \ODw@set{colors/fourB/.code={\pgfkeys{/ODw/colors=4B}}}
2362 \ODw@set{colors/4b/.code={\pgfkeys{/ODw/colors=4B}}}
2363 % \end{macrocode}
2364 %
2365 % \begin{macro}{\nt}
2366 % \begin{macro}{\NT}
2367 % Because some languages use a different symbol for \NT{} (\nt*) we must
2368 % look it up in the dictionary to find e.g.\ \Translate{\NT}
2369 % (\Translate{\nt*}) for German.
2370 % \begin{macrocode}
2371 \NewDocumentCommand\nt{s t!}{%
2372 \bgroup%
2373 \ODw@OtherFont%
2374 \IfBooleanTF#1{%
2375 \IfBooleanTF#2
2376 {\,[0.3]\translate{NT-(ODw)}}%
2377 {\translate{No Trump-(ODw)}}%
2378 }{%
2379 \IfBooleanTF#2
2380 {\,[0.3]\translate{nt-(ODw)}}%
2381 {\translate{no trump-(ODw)}}%
2382 }%
2383 \egroup%
2384 \xspace%
2385 }% nt
2386 % \end{macrocode}
2387 % Define a practical shorthand to produce \NT{} without the need to add a
2388 % token.
2389 % \begin{macrocode}
2390 \def\NT{\nt*!}
2391 % \end{macrocode}
2392 % \end{macro}
2393 % \end{macro}
2394 % \par\vspace{0.3\baselineskip}\noindent
2395 % \begin{macro}{\ODw@SetRank}\MacroDef{ODw@SetRank}[\marg{card rank}]
2396 % |\ODw@SetRank| stores the rank of the card played in |\ODw@Rank|. This is
2397 % essentially the intrinsic rank of the card (\emph{2} for a 2, \emph{14}
2398 % for an Ace), but there are special cases:
2399 % \begin{itemize}[itemsep=-2mm,topsep=-1em]
2400 % \item Spot cards (denoted with \emph{x}) always get rank 0
2401 % \item Discards always get rank 0
2402 % \item Trump cards get 15 (\emph{15} to ensure that a spot trump card
2403 % defeats an Ace) added to the intrinsic rank, to make sure
2404 % that:
2405 % \begin{itemize}[itemsep=-1mm,topsep=-0.3em]
2406 % \item A trump card will defeat all other cards
2407 % \item The highest trump card will win the trick
2408 % \end{itemize}
2409 % \end{itemize}
2410 % \par\vspace{0.5\baselineskip}
2411 % We first define three variables, one to store the suit of the actual card,
2412 % the second one to store which suit was led and the last variable
2413 % to store which suit is the trump suit, all initialized with the '\NT-suit'.
2414 % \begin{macrocode}
2415 \gdef\ODw@SuitPlayed{N}
2416 \gdef\ODw@SuitLead{N}
2417 \gdef\ODw@TrumpSuit{N}
2418 \newcounter{ODw@Rank}
2419 % \end{macrocode}
2420 % \begin{macrocode}
2421 \def\ODw@SetRank#1{%
2422 \ifthenelse{\equal{\ODw@SuitPlayed}{\ODw@SuitLead}}%
2423 % if a suit is followed, store the intrinsic rank
2424 {\setcounter{ODw@Rank}{#1}}%
2425 {% else, if a suit is not followed then ...
2426 % (at NoTrump, the trumpsuit is coded 'N' and will
2427 % never match a real suit (coded C, D, H and S))
2428 % thus avoiding that trump cards are detected
2429 \ifthenelse{\equal{\ODw@SuitPlayed}{\ODw@TrumpSuit}}%
2430 % if it is a trump card, increase the rank
2431 {\setcounter{ODw@Rank}{#1}%
2432 \addtocounter{ODw@Rank}{15}}%
2433 % if it is a discard, set the rank to 0 to make
2434 % sure it will never win
2435 {\setcounter{ODw@Rank}{0}}%
2436 }% ifthen
2437 % If the card was of another suit,
2438 % then ODw@SuitPlayed was changed.
2439 % If we encounter 'unsuited' cards,
2440 % then we must reestablish the
2441 % original ODw@SuitPlayed.
2442 \global\edef\ODw@SuitPlayed{\ODw@SuitLead}% org. suit
2443 }% ODw@SetRank
2444 % \end{macrocode}
2445 % \end{macro}
2446 % \par\vspace{0.3\baselineskip}\noindent
2447 % \begin{macro}{\ODw@Xfer}\MacroDef{ODw@Xfer}[\marg{tokens}]
2448 % This macro gets called by |ODw@Tfer| which is automatically called in the
2449 % environments |play|, |bidding| and |biddingpair| by means of
2450 % |columntype P| and |columntype B| to convert at one hand the shorthand
2451 % suit code in suit symbols and at the other hand to translate card honors
2452 % into the active language. It also converts the card value |T| into
2453 % \Xfer{T} and a hyphen into an en-dash. It calls |\ODw@translate| to do
2454 % the work.
2455 %
2456 % The following code was contributed on StackExchange by egreg, see
2457 % \url{https://tex.stackexchange.com/questions/417731/problem-with-xstring-ifeqcase-case-falls-thru/417788?noredirect=1#comment1045001_417788}
2458 % \begin{macrocode}
2459 \ExplSyntaxOn
2460 % NB: now all spaces are ignored, use '~' if needed.
2461 \NewDocumentCommand{\ODw@Xfer}{m}{
2462 \bgroup
2463 % we do not want spaces here
2464 \def\xspace{}
2465 \tl_map_function:nN {#1} \ODw@translate:n
2466 \egroup
2467 }% ODw@Xfer
2468 % \end{macrocode}
2469 % \end{macro}
2470 % \par\vspace{0.3\baselineskip}\noindent
2471 % \begin{macro}{\ODw@translate}\MacroDef{ODw@translate}[\marg{tokens}]
2472 % |\ODw@translate| processes a (relatively short) string of tokens that
2473 % determine an entry in |bidding| or |play| diagrams, and also
2474 % in all situations where suits are defined. It gets called by |\ODw@Xfer|.
2475 %
2476 % It expects bridge stuff describing strings like |AKT54| to produce the
2477 % suit \suit{AKT52}, |2H\alert| to produce the call
2478 % \Xfer{2H\alert} in the |bidding| diagram, or |DA| to produce \Xfer{DA} as
2479 % entry in the |play| diagram to show that the ace of diamonds was played.
2480 % Please note that constructs like |\textit{DA}| or |\frame{2H}| are not
2481 % allowed and will produce rather misleading errors like:\\
2482 % \example{|! Argument of \bs ODw@translate:n has an extra \}.|} or \\
2483 % \example{|! Missing number,treated as zero.|}\\[0.2\baselineskip]
2484 % Even clever people who use |{\frame{2H}}| will get disoppointed, because
2485 % they'll get \frame{2H} rather than the wanted \frame{2\He}. But the very
2486 % clever people can reach their goal by using |{\frame{2\He}}| or
2487 % |{\textit{\Di A}}|.
2488 % \par\vspace{0.5\baselineskip}
2489 % \begin{macrocode}
2490 \cs_new_protected:Nn \ODw@translate:n
2491 {
2492 \setcounter{ODw@Rank}{0}
2493 \str_case:nnTF {#1}
2494 { % Store the suit of the card played
2495 % needed to determine the winner
2496 % and for checking for multiple cards
2497 {C}{\Cl\gdef\ODw@SuitPlayed{C}}
2498 {D}{\Di\gdef\ODw@SuitPlayed{D}}
2499 {H}{\He\gdef\ODw@SuitPlayed{H}}
2500 {S}{\Sp\gdef\ODw@SuitPlayed{S}}
2501 {N}{\NT\gdef\ODw@SuitPlayed{N}}
2502 % Translate a hyphen into an en-dash
2503 {-}{--}
2504 %
2505 % 1: translate the honour cards,
2506 % 2: store the played cards for checking
2507 % 3: and set their rank. This must be done last, because
2508 % \ODw@SetRank resets \ODw@SuitPlayed to \ODw@SuitLead
2509 % Honour Cards
2510 % 1 2
2511 {A}{\Ace*!\ODw@AppendCard{\ODw@SuitPlayed}{A}
2512 \ODw@SetRank{14}}% 3
2513 {K}{\King*!\ODw@AppendCard{\ODw@SuitPlayed}{K}
2514 \ODw@SetRank{13}}
2515 {Q}{\Queen*!\ODw@AppendCard{\ODw@SuitPlayed}{Q}
2516 \ODw@SetRank{12}}
2517 {J}{\Jack*!\ODw@AppendCard{\ODw@SuitPlayed}{J}
2518 \ODw@SetRank{11}}
2519 {T}{\kern-0.1em1\kern-0.1em0% massage 1 and 0 a bit
2520 \ODw@AppendCard{\ODw@SuitPlayed}{T}\ODw@SetRank{10}}
2521 % Numeral Cards
2522 {9}{9\ODw@AppendCard{\ODw@SuitPlayed}{9}\ODw@SetRank{9}}
2523 {8}{8\ODw@AppendCard{\ODw@SuitPlayed}{8}\ODw@SetRank{8}}
2524 {7}{7\ODw@AppendCard{\ODw@SuitPlayed}{7}\ODw@SetRank{7}}
2525 {6}{6\ODw@AppendCard{\ODw@SuitPlayed}{6}\ODw@SetRank{6}}
2526 {5}{5\ODw@AppendCard{\ODw@SuitPlayed}{5}\ODw@SetRank{5}}
2527 {4}{4\ODw@AppendCard{\ODw@SuitPlayed}{4}\ODw@SetRank{4}}
2528 {3}{3\ODw@AppendCard{\ODw@SuitPlayed}{3}\ODw@SetRank{3}}
2529 {2}{2\ODw@AppendCard{\ODw@SuitPlayed}{2}\ODw@SetRank{2}}
2530 % A spot card has rank 0
2531 {x}{x\ODw@SetRank{0}}
2532 %
2533 % Non cards (bidding only)
2534 {1}{1}% this enables e.g. 1\He in biddings
2535 {p}{\ifODw@LongCalls\Pass*\else\Pass!\fi}
2536 {P}{\ifODw@LongCalls\Allpass*\else\Allpass*!\fi}
2537 {X}{\ifODw@LongCalls\Double*\else\Double!\fi}
2538 {R}{\ifODw@LongCalls\Redouble*\else\Redouble!\fi}
2539 }% case
2540 {% if matched (case T(rue))
2541 \ifOdW@CardSkip\hspace{\ODw@Card@Skip}\fi
2542 % suit of 1st card (ODw@SuitLead) is ODw@SuitPlayed
2543 \if\theODw@PlayerNr1
2544 \global\edef\ODw@SuitLead{\ODw@SuitPlayed}
2545 \fi
2546 }
2547 % \end{macrocode}
2548 % We offer the possibility that one can use also |\He| in |bidding| and
2549 % |play| diagrams rather than just the abbreviation |H|. Therefore we must
2550 % test which suit was given and set |\ODw@SuitPlayed| accordingly. To make
2551 % this test work, we had to redefine the suit macros with an
2552 % |\renewrobustcmd|.\label{Translate} Here we also issue |\expandafter{#1}|
2553 % rather than just |#1|. Otherwise, among others, the coloring of the suit
2554 % symbol would extend behind it. Curiously enough the phenomena does not
2555 % occur anymore. I leave the expandafter in, until this is cleared.
2556 % \begin{macrocode}
2557 {% if not matched (case F(alse))
2558 \ifx#1\Cl\gdef\ODw@SuitPlayed{C}\fi
2559 \ifx#1\Di\gdef\ODw@SuitPlayed{D}\fi
2560 \ifx#1\He\gdef\ODw@SuitPlayed{H}\fi
2561 \ifx#1\Sp\gdef\ODw@SuitPlayed{S}\fi
2562 \expandafter{#1}% enables e.g. 1\He
2563 % suit of 1st card (ODw@SuitLead) is ODw@SuitPlayed
2564 \if\theODw@PlayerNr1
2565 \global\edef\ODw@SuitLead{\ODw@SuitPlayed}
2566 \fi
2567 }
2568 }% ODw@translate
2569 \ExplSyntaxOff
2570 % \end{macrocode}
2571 % \end{macro}
2572 % \par\vspace{0.3\baselineskip}\noindent
2573 % \begin{macro}{\ODw@AppendCard}\MacroDef{ODw@AppendCard}[\marg{suit}\marg{card}]
2574 % In order to do a simple consistency check in |play| diagrams, we
2575 % need to store the cards that were played. We do that for each suit in the
2576 % variable |\ODw@<suit>|. This macro is called in |\ODw@translate|, i.e.\
2577 % for all situations where cards are to be manipulated. But the result of
2578 % |\ODw@AppendCard| is used only within |play| diagrams. The macro
2579 % |\ODw@appendcard| appends 1 character to a string.
2580 %
2581 % \begin{macrocode}
2582 %
2583 \newcommand{\ODw@appendcard}[2]{\xdef#1{#1#2}}
2584
2585 \newcommand\ODw@AppendCard[2]{%
2586 \IfEqCase{#1}{%
2587 {C}{\ODw@appendcard{\ODw@Clubs}{#2}}%
2588 {D}{\ODw@appendcard{\ODw@Diamonds}{#2}}%
2589 {H}{\ODw@appendcard{\ODw@Hearts}{#2}}%
2590 {S}{\ODw@appendcard{\ODw@Spades}{#2}}%
2591 }%
2592 }% ODw@AppendCard
2593 % \end{macrocode}
2594 % \end{macro}
2595 % \par\vspace{0.3\baselineskip}\noindent
2596 % \begin{macro}{\ODw@PTfer}\MacroDef{ODw@PTfer}[\marg{tokens}]
2597 % This macro is called within |play| diagrams where we can write |HA| and
2598 % get \Xfer{HA}. Also all relevant symbols get translated into the active
2599 % language. We use the counter |ODw@PlayerNr| to determine the column in
2600 % the |play| diagrams with the winning card, and from this we can compute
2601 % which player won the trick.
2602 % |\ODw@PTfer| is essentially called for each entry in all columns of the
2603 % |play| diagram through the column definition:\\
2604 % |\newcolumntype{P}{>{\collectcell\ODw@PTfer}c<{\endcollectcell}}|
2605 %
2606 % We first define two counters, both initially set to zero.
2607 % \begin{macrocode}
2608 \newcounter{ODw@Highest}% the highest rank until now
2609 \setcounter{ODw@Highest}{0}
2610 \newcounter{ODw@WinningNr}% player with the highest rank
2611 \setcounter{ODw@WinningNr}{0}
2612
2613 \def\ODw@PTfer#1{%
2614 \stepcounter{ODw@PlayerNr}%
2615 \ODw@Xfer{#1}% ODw@Rank = the rank for this card
2616 \ifthenelse{\value{ODw@Rank} > \value{ODw@Highest}}%
2617 {% This rank is higher than previous highest one
2618 \setcounter{ODw@WinningNr}{\theODw@PlayerNr}%
2619 \setcounter{ODw@Highest}{\theODw@Rank}%
2620 }%
2621 {}%
2622 \ifthenelse{\value{ODw@PlayerNr} = 4}%
2623 {% last player: Process the winning trick:
2624 \stepcounter{ODw@Nr}% Start new row with new player
2625 \ODw@AccTricks% Accumulate tricks for N-S/E-W
2626 }%
2627 {}%
2628 }
2629 % \end{macrocode}
2630 % \end{macro}
2631 % \par\vspace{0.3\baselineskip}\noindent
2632 % \begin{macro}{\ODw@FTfer}\MacroDef{ODw@FTfer}[\marg{tokens}]
2633 % |\ODw@FTfer| is called for the first column of the |play| diagram
2634 % TableII. In |\ODw@Tricks| it just resets |ODw@PlayerNr| and |\ODw@Last|
2635 % and writes the player who leads. Finally it processes the entry of the
2636 % first column by calling |\ODw@PTfer|.
2637 % |\ODw@FTfer| is essentially called for the entries in the first column of
2638 % TableII in the |play| diagram through the column definition:\\
2639 % |\newcolumntype{F}{>{\collectcell\ODw@FTfer}c<{\endcollectcell}}|
2640 % \begin{macrocode}
2641 \def\ODw@FTfer#1{%
2642 \ODw@Tricks%
2643 \ODw@PTfer{#1}%
2644 }% ODw@FTfer
2645 % \end{macrocode}
2646 % \end{macro}
2647 % \par\vspace{0.3\baselineskip}\noindent
2648 % \begin{macro}{\ODw@BTfer}\MacroDef{ODw@BTfer}[\marg{tokens}]
2649 % This macro is called within |bidding| diagrams and enables us to type
2650 % |1C\announce| and get \Xfer{1C\announce}. The symbols get translated into
2651 % the active language. |\ODw@BTfer| is essentially called for each entry in
2652 % the |bidding| diagrams through:\\
2653 % |\newcolumntype{B}{>{\collectcell\ODw@BTfer}c<{\endcollectcell}}|
2654 %
2655 % As there is no special processing for the biding entries, we call |\ODw@Xfer|
2656 % right away to do the job.
2657 %
2658 % \begin{macrocode}
2659 \def\ODw@BTfer#1{%
2660 \ODw@Xfer{#1}%
2661 }
2662 % \end{macrocode}
2663 % \end{macro}
2664 %
2665 % \subsubsection{Names of Directions and Axes}
2666 %
2667 % \begin{macro}{\North}\MacroDef{North}[\Oarg{*!}]
2668 % \begin{macro}{\north}\MacroDef{north}
2669 % \begin{macrocode}
2670 \NewDocumentCommand\North{s t!}{%
2671 \bgroup%
2672 \ODw@OtherFont%
2673 \IfBooleanTF#1{%
2674 \IfBooleanTF{#2}{\ODw@N*}{\ODw@North*}%
2675 }{%
2676 \IfBooleanTF{#2}{\ODw@N}{\ODw@North}%
2677 }% TF#1
2678 \egroup%
2679 \xspace%
2680 }% North
2681 %
2682 \def\north{\North*}
2683 % \end{macrocode}
2684 % \end{macro}
2685 % \end{macro}
2686
2687 % \begin{macro}{\East}\MacroDef{East}[\Oarg{*!}]
2688 % \begin{macro}{\east}\MacroDef{east}
2689 % \begin{macrocode}
2690 \NewDocumentCommand\East{s t!}{%
2691 \bgroup%
2692 \ODw@OtherFont%
2693 \IfBooleanTF#1{%
2694 \IfBooleanTF{#2}{\ODw@E*}{\ODw@East*}%
2695 }{%
2696 \IfBooleanTF{#2}{\ODw@E}{\ODw@East}%
2697 }% TF#1
2698 \egroup%
2699 \xspace%
2700 }% East
2701 %
2702 \def\east{\East*}
2703 % \end{macrocode}
2704 % \end{macro}
2705 % \end{macro}
2706
2707 % \begin{macro}{\South}\MacroDef{South}[\Oarg{*!}]
2708 % \begin{macro}{\south}\MacroDef{south}
2709 % \begin{macrocode}
2710 \NewDocumentCommand\South{s t!}{%
2711 \bgroup%
2712 \ODw@OtherFont%
2713 \IfBooleanTF#1{%
2714 \IfBooleanTF{#2}{\ODw@S*}{\ODw@South*}%
2715 }{%
2716 \IfBooleanTF{#2}{\ODw@S}{\ODw@South}%
2717 }% TF#1
2718 \egroup%
2719 \xspace%
2720 }% South
2721 %
2722 \def\south{\South*}
2723 % \end{macrocode}
2724 % \end{macro}
2725 % \end{macro}
2726
2727 % \begin{macro}{\West}\MacroDef{West}[\Oarg{*!}]
2728 % \begin{macro}{\west}\MacroDef{west}
2729 % \begin{macrocode}
2730 \NewDocumentCommand\West{s t!}{%
2731 \bgroup%
2732 \ODw@OtherFont%
2733 \IfBooleanTF#1{%
2734 \IfBooleanTF{#2}{\ODw@W*}{\ODw@West*}%
2735 }{%
2736 \IfBooleanTF{#2}{\ODw@W}{\ODw@West}%
2737 }% TF#1
2738 \egroup%
2739 \xspace%
2740 }% West
2741 %
2742 \def\west{\West*}
2743 % \end{macrocode}
2744 % \end{macro}
2745 % \end{macro}
2746 %
2747 % \begin{macro}{\NorthSouth}\MacroDef{NorthSouth}[\Oarg{*!}]
2748 % \begin{macro}{\northsouth}\MacroDef{northsouth}
2749 % \begin{macrocode}
2750 \NewDocumentCommand\NorthSouth{s t!}{%
2751 \bgroup%
2752 \ODw@OtherFont%
2753 \IfBooleanTF#1{%
2754 \IfBooleanTF{#2}{\North*!--\South*!}{\North*--\South*}%
2755 }{%
2756 \IfBooleanTF{#2}{\North!--\South!}{\North--\South}%
2757 }%
2758 \egroup%
2759 \xspace%
2760 }% NorthSouth
2761 %
2762 \def\northsouth{\NorthSouth*}
2763 % \end{macrocode}
2764 % \end{macro}
2765 % \end{macro}
2766
2767 % \begin{macro}{\EastWest}\MacroDef{EastWest}[\Oarg{*!}]
2768 % \begin{macro}{\eastwest}\MacroDef{eastwest}
2769 % \begin{macrocode}
2770 \NewDocumentCommand\EastWest{s t!}{%
2771 \bgroup%
2772 \ODw@OtherFont%
2773 \IfBooleanTF#1{%
2774 \IfBooleanTF{#2}{\East*!--\West*!}{\East*--\West*}%
2775 }{%
2776 \IfBooleanTF{#2}{\East!--\West!}{\East--\West}%
2777 }%
2778 \egroup%
2779 \xspace%
2780 }% EastWest
2781 %
2782 \def\eastwest{\EastWest*}
2783 % \end{macrocode}
2784 % \end{macro}
2785 % \end{macro}
2786 % Next we define macros that translate the short form of the directions
2787 % into the active language.
2788 % \par\noindent
2789 % \begin{macro}{\ODw@N}
2790 % \begin{macro}{\ODw@E}
2791 % \begin{macro}{\ODw@S}
2792 % \begin{macro}{\ODw@W}
2793 % \begin{macrocode}
2794 \def\ODw@N{%
2795 \@ifstar{\translate{N-(ODw)}}%
2796 {\translate{n-(ODw)}}%
2797 }
2798 \def\ODw@E{%
2799 \@ifstar{\translate{E-(ODw)}}%
2800 {\translate{e-(ODw)}}%
2801 }
2802 \def\ODw@S{%
2803 \@ifstar{\translate{S-(ODw)}}%
2804 {\translate{s-(ODw)}}%
2805 }
2806 \def\ODw@W{%
2807 \@ifstar{\translate{W-(ODw)}}%
2808 {\translate{w-(ODw)}}%
2809 }
2810 % \end{macrocode}
2811 % \end{macro}
2812 % \end{macro}
2813 % \end{macro}
2814 % \end{macro}
2815 %
2816 %
2817 % \begin{macro}{\ODw@NS}
2818 % \begin{macro}{\ODw@EW}
2819 % \begin{macrocode}
2820 \def\ODw@NS{\ODw@N--\ODw@S}
2821 \def\ODw@EW{\ODw@E--\ODw@W}
2822 % \end{macrocode}
2823 % \end{macro}
2824 % \end{macro}
2825 %
2826 %
2827 % \begin{macro}{\ODw@North}
2828 % \begin{macro}{\ODw@East}
2829 % \begin{macro}{\ODw@South}
2830 % \begin{macro}{\ODw@West}
2831 % \begin{macrocode}
2832 \def\ODw@North{%
2833 \@ifstar{\translate{North-(ODw)}}%
2834 {\translate{north-(ODw)}}%
2835 }
2836 \def\ODw@East{%
2837 \@ifstar{\translate{East-(ODw)}}%
2838 {\translate{east-(ODw)}}%
2839 }
2840 \def\ODw@South{%
2841 \@ifstar{\translate{South-(ODw)}}%
2842 {\translate{south-(ODw)}}%
2843 }
2844 \def\ODw@West{%
2845 \@ifstar{\translate{West-(ODw)}}%
2846 {\translate{west-(ODw)}}%
2847 }
2848 % \end{macrocode}
2849 % \end{macro}
2850 % \end{macro}
2851 % \end{macro}
2852 % \end{macro}
2853 %
2854 %
2855 % \subsubsection{Non-Bid Calls}
2856 %
2857 % \begin{macro}{\Pass}\MacroDef{Pass}[\Oarg{*!}]
2858 % \begin{macro}{\pass}\MacroDef{pass}
2859 % \begin{macrocode}
2860 \NewDocumentCommand\Pass{s t!}{%
2861 \bgroup%
2862 \ODw@OtherFont%
2863 \IfBooleanTF{#1}{%
2864 \IfBooleanTF{#2}%
2865 {\translate{Pass!-(ODw)}}%
2866 {\translate{Pass-(ODw)}}%
2867 }{%
2868 \IfBooleanTF{#2}%
2869 {\translate{pass!-(ODw)}}%
2870 {\translate{pass-(ODw)}}%
2871 }% TF#1
2872 \egroup%
2873 \xspace%
2874 }% Pass
2875 %
2876 \def\pass{\Pass*}
2877 % \end{macrocode}
2878 % \end{macro}
2879 % \end{macro}
2880
2881 % \begin{macro}{\Allpass}\MacroDef{Allpass}[\Oarg{*!}]
2882 % \begin{macro}{\allpass}\MacroDef{allpass}
2883 % \begin{macrocode}
2884 \NewDocumentCommand\Allpass{s t!}{%
2885 \bgroup%
2886 \ODw@OtherFont%
2887 \IfBooleanTF#1{%
2888 \IfBooleanTF{#2}%
2889 {\translate{AP-(ODw)}}%
2890 {\translate{All pass-(ODw)}}%
2891 }{%
2892 \IfBooleanTF{#2}%
2893 {\translate{ap-(ODw)}}%
2894 {\translate{all pass-(ODw)}}%
2895 }% TF#1
2896 \egroup%
2897 \xspace%
2898 }% Allpass
2899 %
2900 \def\allpass{\Allpass*}
2901 % \end{macrocode}
2902 % \end{macro}
2903 % \end{macro}
2904
2905 % \begin{macro}{\Double}\MacroDef{Double}[\Oarg{*!}]
2906 % \begin{macro}{\double}\MacroDef{double}
2907 % \begin{macrocode}
2908 \NewDocumentCommand\Double{s t!}{%
2909 \bgroup%
2910 \ODw@OtherFont%
2911 \IfBooleanTF#1{%
2912 \IfBooleanTF{#2}%
2913 {\translate{Dbl-(ODw)}}%
2914 {\translate{Double-(ODw)}}%
2915 }{%
2916 \IfBooleanTF{#2}%
2917 {X}%
2918 {\translate{double-(ODw)}}%
2919 }% TF#1
2920 \egroup%
2921 \xspace%
2922 }% Double
2923 %
2924 \def\double{\Double*}
2925 % \end{macrocode}
2926 % \end{macro}
2927 % \end{macro}
2928
2929 % \begin{macro}{\Redouble}\MacroDef{Redouble}[\Oarg{*!}]
2930 % \begin{macro}{\redouble}\MacroDef{redouble}
2931 % \begin{macrocode}
2932 \NewDocumentCommand\Redouble{s t!}{%
2933 \bgroup%
2934 \ODw@OtherFont%
2935 \IfBooleanTF#1{%
2936 \IfBooleanTF{#2}%
2937 {\translate{ReDbl-(ODw)}}%
2938 {\translate{ReDouble-(ODw)}}%
2939 }{%
2940 \IfBooleanTF{#2}%
2941 {\mbox{X\kern-0.1em X}}%
2942 {\translate{redouble-(ODw)}}%
2943 }% TF#1
2944 \egroup%
2945 \xspace%
2946 }% Redouble
2947 %
2948 \def\redouble{\Redouble*}
2949 % \end{macrocode}
2950 % \end{macro}
2951 % \end{macro}
2952 %
2953 %
2954 % \subsubsection{Bidding Diagrams}
2955 %
2956 % \DeleteShortVerb{\|}
2957 % \begin{macro}{\ODw@FirstBidCol}\MacroDef{ODw@FirstBidCol}[\marg{{\upshape N|S|E|W}}]
2958 % \MakeShortVerb{\|}
2959 %
2960 % |\ODw@FirstBidCol| determines which player starts in the first bidding column.
2961 % We also take care that the real world name of the players are kept
2962 % associated with the columns. For |\ODw@BidderX| (X=I,II,III,IV) we
2963 % define two macros: |\ODw@BidderX| and |\ODw@BidderX*| in one. When these
2964 % macros are called in the |bidding| diagram, the starred version writes the
2965 % short notation whereas the unstarred one writes the long version.
2966 % \begin{macrocode}
2967 \newcommand\ODw@FirstBidCol[1]{%
2968 \IfEqCase{#1}{%
2969 {N}{%
2970 \def\ODw@BidderI{\@ifstar{\ODw@North*}{\ODw@N*}}%
2971 \def\ODw@BidderII{\@ifstar{\ODw@East*}{\ODw@E*}}%
2972 \def\ODw@BidderIII{\@ifstar{\ODw@South*}{\ODw@S*}}%
2973 \def\ODw@BidderIV{\@ifstar{\ODw@West*}{\ODw@W*}}%
2974 \def\ODw@NameI{\ODw@North@Name}%
2975 \def\ODw@NameII{\ODw@East@Name}%
2976 \def\ODw@NameIII{\ODw@South@Name}%
2977 \def\ODw@NameIV{\ODw@West@Name}%
2978 }%
2979 {E}{%
2980 \def\ODw@BidderI{\@ifstar{\ODw@East*}{\ODw@E*}}%
2981 \def\ODw@BidderII{\@ifstar{\ODw@South*}{\ODw@S*}}%
2982 \def\ODw@BidderIII{\@ifstar{\ODw@West*}{\ODw@W*}}%
2983 \def\ODw@BidderIV{\@ifstar{\ODw@North*}{\ODw@N*}}%
2984 \def\ODw@NameI{\ODw@East@Name}%
2985 \def\ODw@NameII{\ODw@South@Name}%
2986 \def\ODw@NameIII{\ODw@West@Name}%
2987 \def\ODw@NameIV{\ODw@North@Name}%
2988 }%
2989 {S}{%
2990 \def\ODw@BidderI{\@ifstar{\ODw@South*}{\ODw@S*}}%
2991 \def\ODw@BidderII{\@ifstar{\ODw@West*}{\ODw@W*}}%
2992 \def\ODw@BidderIII{\@ifstar{\ODw@North*}{\ODw@N*}}%
2993 \def\ODw@BidderIV{\@ifstar{\ODw@East*}{\ODw@E*}}%
2994 \def\ODw@NameI{\ODw@South@Name}%
2995 \def\ODw@NameII{\ODw@West@Name}%
2996 \def\ODw@NameIII{\ODw@North@Name}%
2997 \def\ODw@NameIV{\ODw@East@Name}%
2998 }%
2999 {W}{%
3000 \def\ODw@BidderI{\@ifstar{\ODw@West*}{\ODw@W*}}%
3001 \def\ODw@BidderII{\@ifstar{\ODw@North*}{\ODw@N*}}%
3002 \def\ODw@BidderIII{\@ifstar{\ODw@East*}{\ODw@E*}}%
3003 \def\ODw@BidderIV{\@ifstar{\ODw@South*}{\ODw@S*}}%
3004 \def\ODw@NameI{\ODw@West@Name}%
3005 \def\ODw@NameII{\ODw@North@Name}%
3006 \def\ODw@NameIII{\ODw@East@Name}%
3007 \def\ODw@NameIV{\ODw@South@Name}%
3008 }%
3009 }% IfEqCase
3010 }% ODw@FirstBidCol
3011 % \end{macrocode}
3012 % \end{macro}
3013 %
3014 % Next we define the real world names for the \NorthSouth*! and the \EastWest*!
3015 % bidders. We use |\ODw@All@Names| as variable to test if we have names for
3016 % bidders at all: If it is empty, then no names were defined.
3017 % \begin{macro}{\namesNS}\MacroDef{namesNS}[\marg{N-name}\marg{S-name}]
3018 % \begin{macrocode}
3019 \newcommand\namesNS[2]{%
3020 \gdef\ODw@North@Name{#1}%
3021 \gdef\ODw@South@Name{#2}%
3022 \gdef\ODw@All@Names{#1#2\ODw@East@Name\ODw@West@Name}%
3023 }% namesNS
3024 % \end{macrocode}
3025 % \end{macro}
3026 %
3027 % \begin{macro}{\namesEW}\MacroDef{namesEW}[\marg{E-name}\marg{W-name}]
3028 % \begin{macrocode}
3029 \newcommand\namesEW[2]{%
3030 \gdef\ODw@East@Name{#1}%
3031 \gdef\ODw@West@Name{#2}%
3032 \gdef\ODw@All@Names{#1#2\ODw@North@Name\ODw@South@Name}%
3033 }% namesEW
3034 % \end{macrocode}
3035 % \end{macro}
3036 %
3037 % \subsubsection{Diagram Hands}
3038 %
3039 % Here we implement commands that store the cards that each player holds.
3040 % E.g.\ |\northhand| defines the complete hand, i.e.\ all 4 suits for the
3041 % \North*-player. They have an optional parameter (an offset, default |0pt|)
3042 % to finetune the distance to the compass. In |\ODw@Nhand| and
3043 % |\ODw@Shand| we use a makebox to prevent that its width goes beyond the
3044 % |NESW| compass (but this can interfere with the Right-U/L-Legend). Within
3045 % these macros, we check the consistency of the cards in the hand and also
3046 % store card-information to check a complete deal later.
3047 % \begin{macro}{\northhand}\MacroDef{northhand}[\oarg{v-offset}\marg{Sp}\marg{He}\marg{Di}\marg{Cl}]
3048 % |\northhand[v-offset]{Sp}{He}{Di}{Cl}|\\
3049 % | 1 2 3 4 5|
3050 % \begin{macrocode}
3051 \newcommand\northhand[5][0pt]{%
3052 % check that north has 13 cards
3053 \ODw@ChkNrOfCards{#2#3#4#5}{\north}%
3054 \gdef\ODw@NSpades{#2}% Save norths cards
3055 \gdef\ODw@NHearts{#3}% of all suits
3056 \gdef\ODw@NDiamonds{#4}% for later
3057 \gdef\ODw@NClubs{#5}% checking
3058 % \end{macrocode}
3059 % \begin{macro}{\ODw@Nhand}
3060 % We fit the \north hand in a box to avoid that a
3061 % very long suit shifts the \east hand to the right
3062 % \begin{macrocode}
3063 \gdef\ODw@Nhand{%
3064 \makebox[\ODw@Compasssize + 2ex][l]{%
3065 \ODw@hand{t}{#2}{#3}{#4}{#5}%
3066 }%
3067 \vspace{#1}%
3068 }%
3069 % \end{macrocode}
3070 % \end{macro}
3071 % \begin{macrocode}
3072 }% northhand
3073 % \end{macrocode}
3074 % \end{macro}
3075
3076 % \begin{macro}{\easthand}\MacroDef{easthand}[\oarg{h-offset}\marg{Sp}\marg{He}\marg{Di}\marg{Cl}]
3077 % |\easthand[h-offset]{Sp}{He}{Di}{Cl}|\\
3078 % | 1 2 3 4 5|
3079 % \begin{macrocode}
3080 \newcommand\easthand[5][0pt]{%
3081 % check that east has 13 cards
3082 \ODw@ChkNrOfCards{#2#3#4#5}{\east}%
3083 \gdef\ODw@ESpades{#2}% Save easts cards
3084 \gdef\ODw@EHearts{#3}% of all suits
3085 \gdef\ODw@EDiamonds{#4}% for later
3086 \gdef\ODw@EClubs{#5}% checking
3087 % \end{macrocode}
3088 % \begin{macro}{\ODw@Ehand}
3089 % \begin{macrocode}
3090 \gdef\ODw@Ehand{%
3091 \hspace{#1}%
3092 \ODw@hand{c}{#2}{#3}{#4}{#5}%
3093 }%
3094 % \end{macrocode}
3095 % \end{macro}
3096 % \begin{macrocode}
3097 }% easthand
3098 % \end{macrocode}
3099 % \end{macro}
3100
3101 % \begin{macro}{\southhand}\MacroDef{southhand}[\oarg{v-offset}\marg{Sp}\marg{He}\marg{Di}\marg{Cl}]
3102 % |\southhand[v-offset]{Sp}{He}{Di}{Cl}|\\
3103 % | 1 2 3 4 5|
3104 % \begin{macrocode}
3105 \newcommand\southhand[5][0pt]{%
3106 % check that south has 13 cards
3107 \ODw@ChkNrOfCards{#2#3#4#5}{\south}%
3108 \gdef\ODw@SSpades{#2}% Save souths cards
3109 \gdef\ODw@SHearts{#3}% of all suits
3110 \gdef\ODw@SDiamonds{#4}% for later
3111 \gdef\ODw@SClubs{#5}% checking
3112 % \end{macrocode}
3113 % \begin{macro}{\ODw@Shand}
3114 % We fit the \south hand in a box to avoid that a
3115 % very long suit shifts the \east hand to the right
3116 % \begin{macrocode}
3117 \gdef\ODw@Shand{%
3118 \parbox[b]{\ODw@Compasssize + 2ex}{%
3119 \vspace*{#1}\par%
3120 \makebox[0pt][l]{%
3121 \ODw@hand{b}{#2}{#3}{#4}{#5}%
3122 }%
3123 }%
3124 }%
3125 % \end{macrocode}
3126 % \end{macro}
3127 % \begin{macrocode}
3128 }% southhand
3129 % \end{macrocode}
3130 % \end{macro}
3131
3132 % \begin{macro}{\westhand}\MacroDef{westhand}[\oarg{h-offset}\marg{Sp}\marg{He}\marg{Di}\marg{Cl}]
3133 % |\westhand[h-offset]{Sp}{He}{Di}{Cl}|\\
3134 % | 1 2 3 4 5|
3135 % \begin{macrocode}
3136 \newcommand\westhand[5][0pt]{%
3137 % check that west has 13 cards
3138 \ODw@ChkNrOfCards{#2#3#4#5}{\west}%
3139 \gdef\ODw@WSpades{#2}% Save wests cards
3140 \gdef\ODw@WHearts{#3}% of all suits
3141 \gdef\ODw@WDiamonds{#4}% for later
3142 \gdef\ODw@WClubs{#5}% checking
3143 % \end{macrocode}
3144 % \begin{macro}{\ODw@Whand}
3145 % \begin{macrocode}
3146 \gdef\ODw@Whand{%
3147 \ODw@hand{c}{#2}{#3}{#4}{#5}%
3148 \hspace*{#1}%
3149 }%
3150 % \end{macrocode}
3151 % \end{macro}
3152 % \begin{macrocode}
3153 }% westhand
3154 % \end{macrocode}
3155 % \end{macro}
3156 %
3157 % \subsubsection{A Single Hand}
3158 %
3159 % Sometimes we want to show only (the cards of) one single hand.
3160 %
3161 % \noindent
3162 % \begin{macro}{\hand}\MacroDef{hand}[\Oarg{*!-}\oarg{pos}\marg{Sp}\marg{He}\marg{Di}\marg{Cl}]
3163 % \begin{macrocode}
3164 \NewDocumentCommand\hand{s t! t- O{c}mmmm}{%
3165 % \end{macrocode}
3166 % |\hand* ! -[pos]{Sp}{He}{Di}{Cl}|\\
3167 % | 1 2 3 4 5 6 7 8|\\
3168 % This macro has 3 optional tokens that act as follows:\\
3169 % Naked mode: Displays the hand horizontally, left aligned.\\
3170 % |*| mode: Displays the hand horizontally, centered.\\
3171 % |!| mode: Displays the hand vertically, left aligned.\\
3172 % |*!| mode: Displays the hand vertically, centered.\\
3173 % |-| mode: Output is suppressed, it is stored in a savebox for later use.
3174 % \par\vspace{0.3\baselineskip}\noindent
3175 % The 4th argument is the aligning (used only in case of a vertical hand):
3176 % default \textbf{c}. The rest of the arguments denote the cards of the
3177 % suits.
3178 %
3179 % We first check that this hand has 13 cards. Then we check for each
3180 % suit that there are no multiples. Finally we store the hand in
3181 % |\ODw@Hand@Box|. If output is not suppressed, we write the hand with
3182 % |\usebox\ODw@Hand@Box|.
3183 % \begin{macrocode}
3184 \ODw@ChkNrOfCards{#5#6#7#8}{Hand}%
3185 \ODw@ChkSameCards{#5}{\Sp}%
3186 \ODw@ChkSameCards{#6}{\He}%
3187 \ODw@ChkSameCards{#7}{\Di}%
3188 \ODw@ChkSameCards{#8}{\Cl}%
3189 \global\sbox{\ODw@Hand@Box}{%
3190 \bgroup%
3191 \ODw@GameSize%
3192 \IfBooleanTF{#2}%
3193 {\ODw@vhand[#4]{#5}{#6}{#7}{#8}}%
3194 {\ODw@hhand{#5}{#6}{#7}{#8}}%
3195 \egroup%
3196 }% sbox
3197 \IfBooleanTF{#3}{}{%
3198 \IfBooleanTF{#1}%
3199 {{\centering \usebox{\ODw@Hand@Box}\par}}%
3200 {\usebox{\ODw@Hand@Box}}%
3201 }%
3202 }% hand
3203 % \end{macrocode}
3204 % \end{macro}
3205 %
3206 % \begin{macro}{\ODw@hhand}\MacroDef{ODw@hhand}[\marg{Sp}\marg{He}\marg{Di}\marg{Cl}]
3207 % Displays a hand horizontally (e.g.\ \hand{xxxx}{xxx}{xxx}{xxx}). We use a
3208 % |tabular| with 4 columns in 1 row to print the 4 suits.
3209 % \begin{macrocode}
3210 \newcommand\ODw@hhand[4]{%
3211 \bgroup%
3212 \def\xspace{}% undo xspace locally
3213 % it screws the distance between suit and cards
3214 \setlength\tabcolsep{1\ODw@Card@Skip}%
3215 \begin{tabular}{llll}
3216 % we can't use \suit here: it would cause double checks!
3217 \Sp\hspace{0.3em}\ODw@Cards{#1} &%
3218 \He\hspace{0.3em}\ODw@Cards{#2} &%
3219 \Di\hspace{0.3em}\ODw@Cards{#3} &%
3220 \Cl\hspace{0.3em}\ODw@Cards{#4} \\
3221 \end{tabular}%
3222 \egroup%
3223 }% ODw@hhand
3224 % \end{macrocode}
3225 % \end{macro}
3226 %
3227 %
3228 % \begin{macro}{\ODw@vhand}\MacroDef{ODw@vhand}[\oarg{pos}\marg{Sp}\marg{He}\marg{Di}\marg{Cl}]
3229 % \shorthandoff{!}
3230 % Display a hand vertically (e.g.\ \hand!{xxxx}{xxx}{xxx}{xxx}). We call
3231 % \shorthandon{!}
3232 % |\ODw@hand| to do the job.
3233 % \begin{macrocode}
3234 \newcommand\ODw@vhand[5][c]{%
3235 \ODw@hand{#1}{#2}{#3}{#4}{#5}%
3236 }% ODw@vhand
3237 % \end{macrocode}
3238 % \end{macro}
3239 %
3240 % \begin{macro}{\ODw@hand}\MacroDef{ODw@hand}[\oarg{pos}\marg{Sp}\marg{He}\marg{Di}\marg{Cl}]
3241 % We put a hand and some spacing in a |tabular| by reading the cards for
3242 % each suit, making the lines more tense with the |\\[-0.5ex]|.
3243 % Empty hands are discarded completely.
3244 %
3245 % \begin{macrocode}
3246 \newcommand\ODw@hand[5]{%
3247 % \end{macrocode}
3248 % |ODw@hand{pos}{spades}{hearts}{diamonds}{clubs}|\\
3249 % | 1 2 3 4 5|
3250 % \par\noindent
3251 % First we test if the hand is completely empty; only if not, we output
3252 % something.
3253 % \begin{macrocode}
3254 \ifthenelse{\equal{#2#3#4#5}{}}{}{%
3255 \setlength\tabcolsep{\ODw@Card@Skip}%
3256 %JW \ODw@GameSize% XYX JW 30.04.2018
3257 \begin{tabular}[#1]{ll}%
3258 % we can't use \suit here: it would cause double checks!
3259 \Sp & \ODw@Cards{#2}\\[-0.5ex]
3260 \He & \ODw@Cards{#3}\\[-0.5ex]
3261 \Di & \ODw@Cards{#4}\\[-0.5ex]
3262 \Cl & \ODw@Cards{#5}\\
3263 \end{tabular}%
3264 }% ifthenelse
3265 }% ODw@hand
3266 % \end{macrocode}
3267 % \end{macro}
3268 %
3269 % \subsubsection{Suits}
3270 %
3271 % In some cases, we need only a collection of cards, without a suit symbol.
3272 % \begin{macro}{\onesuitAll}\MacroDef{onesuitAll}[\Oarg{*!}\marg{N}\marg{S}\marg{E}\marg{W}]
3273 % Display the cards of one suit in a \North*!{}\South*!--\East*!{}\West*! diagram, with
3274 % the \North*!-, \East*!-, \South*!- and \West*!-hand.
3275 % \begin{macrocode}
3276 \NewDocumentCommand\onesuitAll{s t! mmmm}{%
3277 % \end{macrocode}
3278 % |onesuitAll* !{N-hand}{S-hand}{E-hand}{W-hand}|\\
3279 % | 1 2 3 4 5 6|\\
3280 % |Naked version: Use a |\ODwBox\\
3281 % |* version: Display the diagram centered|\\
3282 % |! version: use the NESW compass|
3283 % \par\noindent
3284 % First we test that we have no multiple cards in the suit. Then we use a
3285 % |tabular| to place the cards around a compass or around a box.
3286 % \begin{macrocode}
3287 \ODw@ChkSameCards{#3#4#5#6}{}%
3288 \IfBooleanTF#1{\begin{center}}{}%
3289 \bgroup%
3290 \ODw@GameSize%
3291 \setlength\tabcolsep{0em}%
3292 \begin{tabular}{@{}r@{ }c@{ }l@{}}%
3293 %\begin{tabular}{@{}rcl@{}}%
3294 & \ODw@Cards{#3} \IfBooleanTF#2{\\[-0.2em]}{\\}%
3295 \ODw@Cards{#6} & \IfBooleanTF#2{\ODw@Compass}{\ODw@Box}%
3296 & \ODw@Cards{#5} \IfBooleanTF#2{\\[-0.2em]}{\\}%
3297 & \ODw@Cards{#4}\\
3298 \end{tabular}%
3299 \egroup%
3300 \IfBooleanTF#1{\end{center}}{}%
3301 }% onesuitAll
3302 % \end{macrocode}
3303 % \end{macro}
3304 %
3305 %
3306 % \begin{macro}{\onesuitNS}\MacroDef{onesuitNS}[\Oarg{*!}\marg{N}\marg{S}]
3307 % Display a suit as |NS|-diagram. Similar to |\onesuitAll| but with only
3308 % |N|- and |S|-hand.
3309 % \begin{macrocode}
3310 \NewDocumentCommand\onesuitNS{s t! mm}{%
3311 % \end{macrocode}
3312 % |onesuitNS* !{N-hand}{S-hand}|\\
3313 % | 1 2 3 4|\\
3314 % |Naked version: Use a |\ODwBox\\
3315 % |* version: Display the diagram centered|\\
3316 % |! version: use the NESW compass|
3317 %
3318 % \begin{macrocode}
3319 \ODw@ChkSameCards{#3#4}{}%
3320 \IfBooleanTF#1{\begin{center}}{}%
3321 \bgroup%
3322 \ODw@GameSize%
3323 \begin{tabular}{@{}c@{}}%
3324 \ODw@Cards{#3}\IfBooleanTF#2{\\[-0.2em]}{\\}%
3325 \IfBooleanTF#2{\ODw@Compass\\[-0.2em]}{\ODw@Box\\}%
3326 \ODw@Cards{#4}%
3327 \end{tabular}%
3328 \egroup%
3329 \IfBooleanTF#1{\end{center}}{}%
3330 }% onesuitNS
3331 % \end{macrocode}
3332 % \end{macro}
3333 %
3334 %
3335 % \begin{macro}{\onesuitEW}\MacroDef{onesuitEW}[\Oarg{*!}\marg{E}\marg{W}]
3336 % Display a suit as |EW| diagram. Similar to |\onesuitAll| but with only
3337 % |E|- and |W|-hand.
3338 % \begin{macrocode}
3339 \NewDocumentCommand\onesuitEW{s t! mm}{%
3340 % \end{macrocode}
3341 % |onesuitEW* !{E-hand}{W-hand}|\\
3342 % | 1 2 3 4|\\
3343 % |Naked version: Use a |\ODwBox\\
3344 % |* version: Display the diagram centered|\\
3345 % |! version: use the NESW compass|
3346 %
3347 % \begin{macrocode}
3348 \ODw@ChkSameCards{#3#4}{}%
3349 \IfBooleanTF#1{\begin{center}}{}%
3350 \bgroup%
3351 \ODw@GameSize%
3352 \begin{tabular}{@{}r@{ }c@{ }l@{}}%
3353 \ODw@Cards{#4} &%
3354 \IfBooleanTF#2{\ODw@Compass}{\ODw@Box} &%
3355 \ODw@Cards{#3} \\%
3356 \end{tabular}%
3357 \egroup%
3358 \IfBooleanTF#1{\end{center}}{}%
3359 }% onesuitEW
3360 % \end{macrocode}
3361 % \end{macro}
3362 %
3363 % \begin{macro}{\onesuitNE}\MacroDef{onesuitNE}[\Oarg{*!}\marg{N}\marg{E}]
3364 % Display a suit as |NE| diagram. Similar to |\onesuitAll| but with only
3365 % |N|- and |E|-hand.
3366 % \begin{macrocode}
3367 \NewDocumentCommand\onesuitNE{s t! mm}{%
3368 % \end{macrocode}
3369 % |onesuitNE* !{N-hand}{E-hand}|\\
3370 % | 1 2 3 4|\\
3371 % |Naked version: Use a |\ODwBox\\
3372 % |* version: Display the diagram centered|\\
3373 % |! version: use the NESW compass|
3374 %
3375 % \begin{macrocode}
3376 \ODw@ChkSameCards{#3#4}{}%
3377 \IfBooleanTF#1{\begin{center}}{}%
3378 \bgroup%
3379 \ODw@GameSize%
3380 \begin{tabular}[b]{c@{ }l@{}}%
3381 \ODw@Cards{#3} \\%
3382 \IfBooleanTF#2{\ODw@Compass}{\ODw@Box} &%
3383 \ODw@Cards{#4} \\%
3384 \end{tabular}%
3385 \egroup%
3386 \IfBooleanTF#1{\end{center}}{}%
3387 }% onesuitEW
3388 % \end{macrocode}
3389 % \end{macro}
3390 %
3391 % \begin{macro}{\onesuitNW}\MacroDef{onesuitNW}[\Oarg{*!}\marg{N}\marg{W}]
3392 % Display a suit as |NW| diagram. Similar to |\onesuitAll| but with only
3393 % |N|- and |W|-hand.
3394 % \begin{macrocode}
3395 \NewDocumentCommand\onesuitNW{s t! mm}{%
3396 % \end{macrocode}
3397 % |onesuitNW* !{N-hand}{W-hand}|\\
3398 % | 1 2 3 4|\\
3399 % |Naked version: Use a |\ODwBox\\
3400 % |* version: Display the diagram centered|\\
3401 % |! version: use the NESW compass|
3402 %
3403 % \begin{macrocode}
3404 \ODw@ChkSameCards{#3#4}{}%
3405 \IfBooleanTF#1{\begin{center}}{}%
3406 \bgroup%
3407 \ODw@GameSize%
3408 \begin{tabular}[b]{r@{ }c}%
3409 & \ODw@Cards{#3} \\%
3410 \ODw@Cards{#4} & \IfBooleanTF#2{\ODw@Compass}{\ODw@Box} \\%
3411 \end{tabular}%
3412 \egroup%
3413 \IfBooleanTF#1{\end{center}}{}%
3414 }% onesuitEW
3415 % \end{macrocode}
3416 % \end{macro}
3417 %
3418 % \begin{macro}{\suit}\MacroDef{suit}[\oarg{suit symbol}\marg{cards}]
3419 % Command for displaying the cards of a suit. With the optional argument
3420 % one can add a suit symbol to the suit.
3421 %
3422 % \begin{macrocode}
3423 \newcommand\suit[2][]{%
3424 % \end{macrocode}
3425 % |\suit[suit]{cards}|\\
3426 % | 1 2 |
3427 % \begin{macrocode}
3428 \ODw@ChkNrOfCards{#2}{suit}%
3429 \ODw@ChkSameCards{#2}{#1}%
3430 \bgroup% keep font change local
3431 %JW
3432 \ODw@GameSize%
3433 #1\ODw@Cards{#2}%
3434 \egroup%
3435 \xspace%
3436 }% suit
3437 % \end{macrocode}
3438 % \end{macro}
3439 %
3440 % \begin{macro}{\ODw@Cards}\MacroDef{ODw@Cards}[\marg{cards}]
3441 % This macro gets called by |\suit| and all commands that process hands. It
3442 % processes the ranks of the cards. Between ranks some space is typeset.
3443 % Care is taken that |T| becomes \suit{T} and honor cards are
3444 % translated into the active language.
3445 % \begin{macrocode}
3446 \newcommand{\ODw@Cards}[1]{%
3447 % \end{macrocode}
3448 % \par\vspace{0.3\baselineskip}\noindent
3449 % We enable the cardskip and call |\ODw@Xfer| to do the job
3450 % \begin{macrocode}
3451 \OdW@CardSkiptrue%
3452 \ODw@Xfer{#1}%
3453 }% ODw@Cards
3454 % \end{macrocode}
3455 % \end{macro}
3456 %
3457 % \subsubsection{Card Diagrams}
3458 %
3459 % Next we define several diagrams with hands around the compass.
3460 % |\ODw@GameSize| sets the size of the compass, the directions and the
3461 % hands, according to the actual font or font-size.
3462 % |\ODw@LeftUpperText| etc.\ displays extra text, that appear in the left
3463 % upper, etc.\ corner of the diagram. If |\headlinetext| (|\footlinetext|)
3464 % is the empty string, we set boolean |ODw@EmptyHeader| (|ODw@EmptyFooter|)
3465 % to true\footnote{see page \pageref{Empty}, last paragraph why this is
3466 % necessary}. This value is used in
3467 % |\ODw@ProcessHeader| to conditionally span the 3 columns with the
3468 % headline- (footline)text. We first store the diagram in a box, so we can
3469 % calculate its width and use that as a size to limit the header/footer
3470 % texts.
3471 %
3472 % \begin{macro}{\showAll}\MacroDef{showAll}[\Oarg{*+}\oarg{pos}]
3473 % Define the diagram, showing the cards for \textbf{All} hands.
3474 %
3475 % \begin{macrocode}
3476 \NewDocumentCommand\showAll{s t+ O{c}}{%
3477 % \end{macrocode}
3478 % |showAll* + [pos]|\\
3479 % | 1 2 3|\\
3480 % |Display the NS--EW diagram, defined by \northhand, etc|\\
3481 % |* Version: Display the diagram centered|\\
3482 % |+ Version: Also display a bidding diagram|\\
3483 % |pos: aligning, default= c|
3484 % \par\noindent
3485 % First, for all suits we store all cards of all sides together. Next we
3486 % check the consistency of all complete suits. The individual suits of each
3487 % player have already been checked as we defined the hands. Finally we
3488 % print the hands around the compass using a |tabular|, taking care of the
3489 % additions above, below and in the corners of the diagram. Before we write
3490 % the diagram, we store it in an sbox to calulate its width, so we can use
3491 % that in other places.
3492 %
3493 % \begin{macrocode}
3494 \gdef\ODw@Spades{% store all Spades together
3495 \ODw@NSpades\ODw@ESpades\ODw@SSpades\ODw@WSpades%
3496 }%
3497 \gdef\ODw@Hearts{% store all Hearts together
3498 \ODw@NHearts\ODw@EHearts\ODw@SHearts\ODw@WHearts%
3499 }%
3500 \gdef\ODw@Diamonds{% store all Diamonds together
3501 \ODw@NDiamonds\ODw@EDiamonds\ODw@SDiamonds\ODw@WDiamonds%
3502 }%
3503 \gdef\ODw@Clubs{% store all Clubs together
3504 \ODw@NClubs\ODw@EClubs\ODw@SClubs\ODw@WClubs%
3505 }%
3506 % check for multiple and nr. of cards
3507 \ODw@ChkNrOfCards{\ODw@Spades}{\Sp}%
3508 \ODw@ChkSameCards{\ODw@Spades}{\Sp}%
3509 \ODw@ChkNrOfCards{\ODw@Hearts}{\He}%
3510 \ODw@ChkSameCards{\ODw@Hearts}{\He}%
3511 \ODw@ChkNrOfCards{\ODw@Diamonds}{\Di}%
3512 \ODw@ChkSameCards{\ODw@Diamonds}{\Di}%
3513 \ODw@ChkNrOfCards{\ODw@Clubs}{\Cl}%
3514 \ODw@ChkSameCards{\ODw@Clubs}{\Cl}%
3515 \IfBooleanTF#1{\begin{center}}{}%
3516 \bgroup%
3517 \setlength\tabcolsep{0em}%
3518 \ODw@GameSize%
3519 \ODw@TestIfEmpty{\ODw@HeaderText}{ODw@EmptyHeader}%
3520 \ODw@TestIfEmpty{\ODw@FooterText}{ODw@EmptyFooter}%
3521 % sbox1 necessary to calc. |Compasssize| for |Nhand|
3522 \sbox1{\ODw@Compass}%
3523 \sbox0{%
3524 \begin{tabular}[#3]{@{}r@{}c@{}l@{}}%
3525 \ODw@LeftUpperText & \ODw@Nhand & \ODw@RightUpperText\\
3526 \ODw@Whand & \usebox{1} & \ODw@Ehand\\
3527 \ODw@LeftLowerText & \ODw@Shand & \ODw@RightLowerText\\
3528 \end{tabular}%
3529 }% sbox
3530 \ODw@gsetlength{\ODw@Diagram@Width}{\wd0}%
3531 \begin{tabular}[#3]{@{}r@{}c@{}l@{}}%
3532 \ODw@ProcessHeader{3}% span 3 columns
3533 \ODw@LeftUpperText & \ODw@Nhand & \ODw@RightUpperText\\
3534 \ODw@Whand & \usebox{1} & \ODw@Ehand\\
3535 \ODw@LeftLowerText & \ODw@Shand & \ODw@RightLowerText\\
3536 \ODw@ProcessFooter{3}% span 3 columns
3537 \end{tabular}%
3538 \IfBooleanTF#2{%
3539 % needed for \ODw@CondNewLine
3540 \setlength{\ODw@Bid@Width}{\wd\ODw@BidBox}%
3541 \ODw@CondNewLine%
3542 \usebox{\ODw@BidBox}%
3543 }{}%
3544 \egroup%
3545 \IfBooleanTF#1{\end{center}}{}%
3546 }% showAll
3547 % \end{macrocode}
3548 % \end{macro}
3549 %
3550 % \DeleteShortVerb{\|}
3551 % \begin{macro}{\showNS}\MacroDef{showNS}[\Oarg{*+}\oarg{pos}\parg{N|S}]
3552 % \MakeShortVerb{\|}
3553 % Define the diagram, showing the cards for the \NorthSouth*! hands.
3554 %
3555 % \begin{macrocode}
3556 \NewDocumentCommand\showNS{s t+ O{c} d()}{%
3557 % \end{macrocode}
3558 % |showNS* +[pos] (N/S)|\\
3559 % | 1 2 3 4|\\
3560 % |Display the NS diagram, defined by \northhand, etc|\\
3561 % |* Version: Display the diagram centered|\\
3562 % |+ Version: Also display a bidding diagram|\\
3563 % |pos: aligning, default c|\\
3564 % |N/S: only N-hand (or S-hand) is to be displayed|\\
3565 % \par\noindent
3566 % Description: similar to |\showAll|
3567 % \begin{macrocode}
3568 % For all suits store all cards of north and south together
3569 \gdef\ODw@Spades{\ODw@NSpades\ODw@SSpades}%
3570 \gdef\ODw@Hearts{\ODw@NHearts\ODw@SHearts}%
3571 \gdef\ODw@Diamonds{\ODw@NDiamonds\ODw@SDiamonds}%
3572 \gdef\ODw@Clubs{\ODw@NClubs\ODw@SClubs}%
3573 \ODw@ChkSameCards{\ODw@Spades}{\Sp}%
3574 \ODw@ChkSameCards{\ODw@Hearts}{\He}%
3575 \ODw@ChkSameCards{\ODw@Diamonds}{\Di}%
3576 \ODw@ChkSameCards{\ODw@Clubs}{\Cl}%
3577 \IfBooleanTF#1{\begin{center}}{}%
3578 \bgroup%
3579 \setlength\tabcolsep{0em}%
3580 \ODw@GameSize%
3581 \ODw@TestIfEmpty{\ODw@HeaderText}{ODw@EmptyHeader}%
3582 \ODw@TestIfEmpty{\ODw@FooterText}{ODw@EmptyFooter}%
3583 % \end{macrocode}
3584 % Here we store the width of the diagram \textbf{without} the header and
3585 % footer. So we can limit their width to the diagramwidth.
3586 % \begin{macrocode}
3587 % sbox1 necessary to calc. |Compasssize| for |Nhand|
3588 \sbox1{\ODw@Compass}%
3589 \sbox0{%
3590 \begin{tabular}[#3]{@{}r@{}c@{}l@{}}%
3591 % Display the N-hand only with token 'N', or no token at all
3592 & \IfNoValueTF{#4}{\ODw@Nhand}{\ifthenelse{\equal{#4}{N}}{\ODw@Nhand}{}} & \\
3593 & \usebox{1} & \\
3594 % Display the S-hand only with token 'S', or no token at all
3595 & \IfNoValueTF{#4}{\ODw@Shand}{\ifthenelse{\equal{#4}{S}}{\ODw@Shand}{}} & \\
3596 \end{tabular}%
3597 }% sbox0
3598 \ODw@gsetlength\ODw@Diagram@Width{\wd0}%
3599 \begin{tabular}[#3]{@{}r@{}c@{}l@{}}%
3600 \ODw@ProcessHeader{3}% span 3 columns
3601 % Display the N-hand only with token 'N', or no token at all
3602 & \IfNoValueTF{#4}{\ODw@Nhand}{\ifthenelse{\equal{#4}{N}}{\ODw@Nhand}{}} & \\
3603 & \usebox{1} & \\
3604 % Display the S-hand only with token 'S', or no token at all
3605 & \IfNoValueTF{#4}{\ODw@Shand}{\ifthenelse{\equal{#4}{S}}{\ODw@Shand}{}} & \\
3606 \ODw@ProcessFooter{3}% span 3 columns
3607 \end{tabular}%
3608 \IfBooleanTF#2{%
3609 % necessary for \ODw@CondNewLine
3610 \setlength{\ODw@Bid@Width}{\wd\ODw@BidBox}%
3611 \ODw@CondNewLine%
3612 \usebox{\ODw@BidBox}%
3613 }{}%
3614 \egroup%
3615 \IfBooleanTF#1{\end{center}}{}%
3616 }% showNS
3617 % \end{macrocode}
3618 % \end{macro}
3619 %
3620 % \DeleteShortVerb{\|}
3621 % \begin{macro}{\showEW}\MacroDef{showEW}[\Oarg{*+}\oarg{pos}\parg{E|W}]
3622 % \MakeShortVerb{\|}
3623 % Define the diagram, showing the cards for the \EastWest*! hands.
3624 % \begin{macrocode}
3625 \NewDocumentCommand\showEW{s t+ O{c} d()}{%
3626 % \end{macrocode}
3627 % |showEW* + [pos] (E/W)|\\
3628 % | 1 2 3 4|\\
3629 % |Display the EW diagram, defined by \easthand, etc|\\
3630 % |* Version: Display the diagram centered|\\
3631 % |+ Version: Also display a bidding diagram|\\
3632 % |pos: aligning, default c|\\
3633 % |E/W: only E-hand (or W-hand) is to be displayed|\\
3634 % \par\noindent
3635 % Description: similar to |\showAll|
3636 % \begin{macrocode}
3637 % For all suits put all cards of east and west together
3638 \gdef\ODw@Spades{\ODw@ESpades\ODw@WSpades}%
3639 \gdef\ODw@Hearts{\ODw@EHearts\ODw@WHearts}%
3640 \gdef\ODw@Diamonds{\ODw@EDiamonds\ODw@WDiamonds}%
3641 \gdef\ODw@Clubs{\ODw@EClubs\ODw@WClubs}%
3642 \ODw@ChkSameCards{\ODw@Spades}{\Sp}%
3643 \ODw@ChkSameCards{\ODw@Hearts}{\He}%
3644 \ODw@ChkSameCards{\ODw@Diamonds}{\Di}%
3645 \ODw@ChkSameCards{\ODw@Clubs}{\Cl}%
3646 \IfBooleanTF#1{\begin{center}}{}%
3647 \bgroup%
3648 \setlength\tabcolsep{0em}%
3649 \ODw@GameSize%
3650 \ODw@TestIfEmpty{\ODw@HeaderText}{ODw@EmptyHeader}%
3651 \ODw@TestIfEmpty{\ODw@FooterText}{ODw@EmptyFooter}%
3652 \sbox0{%
3653 \begin{tabular}[#3]{@{}r@{}c@{}l@{}}%
3654 % Display the W-hand only with token 'W', or no token at all
3655 \IfNoValueTF{#4}{\ODw@Whand}{\ifthenelse{\equal{#4}{W}}{\ODw@Whand}{}}
3656 & \ODw@Compass &
3657 % Display the E-hand only with token 'E', or no token at all
3658 \IfNoValueTF{#4}{\ODw@Ehand}{\ifthenelse{\equal{#4}{E}}{\ODw@Ehand}{}} \\
3659 \end{tabular}%
3660 }% sbox
3661 \ODw@gsetlength{\ODw@Diagram@Width}{\wd0}%
3662 \begin{tabular}[#3]{@{}r@{}c@{}l@{}}%
3663 \ODw@ProcessHeader{3}% span 3 columns
3664 & & \\
3665 % Display the W-hand only with token 'W', or no token at all
3666 \IfNoValueTF{#4}{\ODw@Whand}{\ifthenelse{\equal{#4}{W}}{\ODw@Whand}{}}
3667 & \ODw@Compass &
3668 % Display the E-hand only with token 'E', or no token at all
3669 \IfNoValueTF{#4}{\ODw@Ehand}{\ifthenelse{\equal{#4}{E}}{\ODw@Ehand}{}} \\
3670 \ODw@ProcessFooter{3}% span 3 columns
3671 \end{tabular}%
3672 \IfBooleanTF#2{%
3673 % necessary for \ODw@CondNewLine
3674 \setlength{\ODw@Bid@Width}{\wd\ODw@BidBox}%
3675 \ODw@CondNewLine%
3676 \usebox{\ODw@BidBox}%
3677 }{}%
3678 \egroup%
3679 \IfBooleanTF#1{\end{center}}{}%
3680 }% showEW
3681 % \end{macrocode}
3682 % \end{macro}
3683 %
3684 %
3685 % \begin{macro}{\showNE}\MacroDef{showNE}[\Oarg{*+}\oarg{pos}]
3686 % Define the diagram, showing the cards for the
3687 % \North*!{}\textbf{--}\East*! hands.
3688 % \begin{macrocode}
3689 \NewDocumentCommand\showNE{s t+ O{c}}{%
3690 % \end{macrocode}
3691 % |showNE* +[pos]|\\
3692 % | 1 2 3|\\
3693 % |Display the NE diagram, defined by \northhand, etc|\\
3694 % |* Version: Display the diagram centered|\\
3695 % |+ Version: Also display a bidding diagram|\\
3696 % |pos: aligning, default c|\\
3697 % Description: similar to |\showAll|
3698 % \begin{macrocode}
3699 % For all suits put all cards of north and east together
3700 \gdef\ODw@Spades{\ODw@NSpades\ODw@ESpades}%
3701 \gdef\ODw@Hearts{\ODw@NHearts\ODw@EHearts}%
3702 \gdef\ODw@Diamonds{\ODw@NDiamonds\ODw@EDiamonds}%
3703 \gdef\ODw@Clubs{\ODw@NClubs\ODw@EClubs}%
3704 \ODw@ChkSameCards{\ODw@Spades}{\Sp}%
3705 \ODw@ChkSameCards{\ODw@Hearts}{\He}%
3706 \ODw@ChkSameCards{\ODw@Diamonds}{\Di}%
3707 \ODw@ChkSameCards{\ODw@Clubs}{\Cl}%
3708 \IfBooleanTF#1{\begin{center}}{}%
3709 \bgroup%
3710 \setlength\tabcolsep{0em}%
3711 \ODw@GameSize%
3712 \ODw@TestIfEmpty{\ODw@HeaderText}{ODw@EmptyHeader}%
3713 \ODw@TestIfEmpty{\ODw@FooterText}{ODw@EmptyFooter}%
3714 % sbox1 necessary to calc. |Compasssize| for |Nhand|
3715 \sbox1{\ODw@Compass}%
3716 \sbox0{%
3717 \begin{tabular}[#3]{@{}c@{}l@{}}%
3718 \ODw@Nhand & \ODw@RightUpperText\\
3719 \usebox{1} & \ODw@Ehand\\
3720 \end{tabular}%
3721 }% sbox
3722 \ODw@gsetlength{\ODw@Diagram@Width}{\wd0}%
3723 \begin{tabular}[#3]{@{}c@{}l@{}}%
3724 \ODw@ProcessHeader{2}% span 2 columns
3725 \ODw@Nhand & \ODw@RightUpperText\\
3726 \usebox{1} & \ODw@Ehand\\
3727 \ODw@ProcessFooter{2}% span 2 columns
3728 \end{tabular}%
3729 \IfBooleanTF#2{%
3730 % necessary for \ODw@CondNewLine
3731 \setlength{\ODw@Bid@Width}{\wd\ODw@BidBox}%
3732 \ODw@CondNewLine%
3733 \usebox{\ODw@BidBox}%
3734 }{}%
3735 \egroup%
3736 \IfBooleanTF#1{\end{center}}{}%
3737 }% showNE
3738 % \end{macrocode}
3739 % \end{macro}
3740 %
3741 %
3742 % \begin{macro}{\showNW}\MacroDef{showNW}[\Oarg{*+}\oarg{pos}]
3743 % Define the diagram, showing the cards for the
3744 % \North*!{}\textbf{--}\West*! hands.
3745 % \begin{macrocode}
3746 \NewDocumentCommand\showNW{s t+ O{c}}{%
3747 % \end{macrocode}
3748 % |showNW* +[pos]|\\
3749 % | 1 2 3|\\
3750 % |Display the NW diagram, defined by \northhand, etc|\\
3751 % |* Version: Display the diagram centered|\\
3752 % |+ Version: Also display a bidding diagram|\\
3753 % |pos: aligning, default c|\\
3754 % Description: similar to |\showAll|
3755 % \begin{macrocode}
3756 % For all suits put all cards of north and west together
3757 \gdef\ODw@Spades{\ODw@NSpades\ODw@WSpades}%
3758 \gdef\ODw@Hearts{\ODw@NHearts\ODw@WHearts}%
3759 \gdef\ODw@Diamonds{\ODw@NDiamonds\ODw@WDiamonds}%
3760 \gdef\ODw@Clubs{\ODw@NClubs\ODw@WClubs}%
3761 \ODw@ChkSameCards{\ODw@Spades}{\Sp}%
3762 \ODw@ChkSameCards{\ODw@Hearts}{\He}%
3763 \ODw@ChkSameCards{\ODw@Diamonds}{\Di}%
3764 \ODw@ChkSameCards{\ODw@Clubs}{\Cl}%
3765 \IfBooleanTF#1{\begin{center}}{}%
3766 \bgroup%
3767 \setlength\tabcolsep{0em}%
3768 \ODw@GameSize%
3769 \ODw@TestIfEmpty{\ODw@HeaderText}{ODw@EmptyHeader}%
3770 \ODw@TestIfEmpty{\ODw@FooterText}{ODw@EmptyFooter}%
3771 % sbox1 necessary to calc. |Compasssize| for |Nhand|
3772 \sbox1{\ODw@Compass}%
3773 \sbox0{%
3774 \begin{tabular}[#3]{@{}c@{}l@{}}%
3775 \ODw@LeftUpperText & \ODw@Nhand\\
3776 \ODw@Whand & \usebox{1}\\
3777 \end{tabular}%
3778 }% sbox
3779 \ODw@gsetlength{\ODw@Diagram@Width}{\wd0}%
3780 \begin{tabular}[#3]{@{}r@{}c@{}}%
3781 \ODw@ProcessHeader{2}% span 2 columns
3782 \ODw@LeftUpperText & \ODw@Nhand\\
3783 \ODw@Whand & \usebox{1}\\
3784 \ODw@ProcessFooter{2}% span 2 columns
3785 \end{tabular}%
3786 \IfBooleanTF#2{%
3787 % necessary for \ODw@CondNewLine
3788 \setlength{\ODw@Bid@Width}{\wd\ODw@BidBox}%
3789 \ODw@CondNewLine%
3790 \usebox{\ODw@BidBox}%
3791 }{}%
3792 \egroup%
3793 \IfBooleanTF#1{\end{center}}{}%
3794 }% showNW
3795 % \end{macrocode}
3796 % \end{macro}
3797 %
3798 % \subsubsection{The Compass}
3799 %
3800 % When displaying the compass, the square with |N-S| and |E-W| axes, we try
3801 % to achieve several things:
3802 % \begin{enumerate}[itemsep=0em]
3803 % \item Making the size font-size dependent
3804 % \item Put both |N| and |S| horizontally centered
3805 % \item Put both |E| and |W| vertically centered
3806 % \item Print the vulnerable side in red if in colored mode
3807 % \item Underline the dealer (we \emph{over}line |S| for better clarity)
3808 % \end{enumerate}
3809 % We use the mapping as shown in the tables below. The |U| stands for
3810 % undefined. This reflects the situation where neither |\vulner| nor
3811 % |\dealer| have been called, and also there is no board number known.\\
3812 %
3813 % \hfill
3814 % \begin{tabular}{|c|c|}\hline
3815 % \multicolumn{2}{|c|}{Player} \\\hline
3816 % N & 0 \\
3817 % E & 1 \\
3818 % S & 2 \\
3819 % W & 3 \\\hline
3820 % \end{tabular}
3821 % \hfill\hfill
3822 % \begin{tabular}{|c|c|}\hline
3823 % \multicolumn{2}{|c|}{Vulner} \\\hline
3824 % none & 0 \\
3825 % all & 1 \\
3826 % N-S & 2 \\
3827 % E-W & 3 \\\hline
3828 % U & -1 \\\hline
3829 % \end{tabular}
3830 % \hfill\hfill
3831 % \begin{tabular}{|c|c|}\hline
3832 % \multicolumn{2}{|c|}{Dealer} \\\hline
3833 % N & 0 \\
3834 % E & 1 \\
3835 % S & 2 \\
3836 % W & 3 \\\hline
3837 % U & -1 \\\hline
3838 % \end{tabular}
3839 % \hfill\hfill
3840 %
3841 % \begin{macro}{\ODw@Compass}\MacroDef{ODw@Compass}
3842 % \begin{macrocode}
3843 \newcommand{\ODw@Compass}{%
3844 % \end{macrocode}
3845 % The codes for dealership (|\ODw@D|) and vulnerability (|\ODw@V|) are used
3846 % in |\ODw@Print|. We initialize them with the value |-1| to denote the
3847 % undefined state. |\@ODw| acts as a local temp variable in oder to make a
3848 % smooth comparison.
3849 % \begin{macrocode}
3850 \begingroup
3851 \def\ODw@V{-1}\def\ODw@D{-1}%
3852 %
3853 % Set the code for vulnerability
3854 %
3855 \def\@ODw{\none}\ifx\ODw@Vulner\@ODw\def\ODw@V{0}\fi%
3856 \def\@ODw{\none*}\ifx\ODw@Vulner\@ODw\def\ODw@V{0}\fi%
3857 \def\@ODw{\none!}\ifx\ODw@Vulner\@ODw\def\ODw@V{0}\fi%
3858 \def\@ODw{\none*!}\ifx\ODw@Vulner\@ODw\def\ODw@V{0}\fi%
3859 \def\@ODw{\all}\ifx\ODw@Vulner\@ODw\def\ODw@V{1}\fi%
3860 \def\@ODw{\all*}\ifx\ODw@Vulner\@ODw\def\ODw@V{1}\fi%
3861 \def\@ODw{\all!}\ifx\ODw@Vulner\@ODw\def\ODw@V{1}\fi%
3862 \def\@ODw{\all*!}\ifx\ODw@Vulner\@ODw\def\ODw@V{1}\fi%
3863 \def\@ODw{\NorthSouth}\ifx\ODw@Vulner\@ODw\def\ODw@V{2}\fi%
3864 \def\@ODw{\NorthSouth*}\ifx\ODw@Vulner\@ODw\def\ODw@V{2}\fi%
3865 \def\@ODw{\NorthSouth!}\ifx\ODw@Vulner\@ODw\def\ODw@V{2}\fi%
3866 \def\@ODw{\NorthSouth*!}\ifx\ODw@Vulner\@ODw\def\ODw@V{2}\fi%
3867 \def\@ODw{\EastWest}\ifx\ODw@Vulner\@ODw\def\ODw@V{3}\fi%
3868 \def\@ODw{\EastWest*}\ifx\ODw@Vulner\@ODw\def\ODw@V{3}\fi%
3869 \def\@ODw{\EastWest!}\ifx\ODw@Vulner\@ODw\def\ODw@V{3}\fi%
3870 \def\@ODw{\EastWest*!}\ifx\ODw@Vulner\@ODw\def\ODw@V{3}\fi%
3871 %
3872 % Set the code for dealership
3873 %
3874 \def\@ODw{\North}\ifx\ODw@Dealer\@ODw\def\ODw@D{0}\fi%
3875 \def\@ODw{\North*}\ifx\ODw@Dealer\@ODw\def\ODw@D{0}\fi%
3876 \def\@ODw{\North!}\ifx\ODw@Dealer\@ODw\def\ODw@D{0}\fi%
3877 \def\@ODw{\North*!}\ifx\ODw@Dealer\@ODw\def\ODw@D{0}\fi%
3878 \def\@ODw{\East}\ifx\ODw@Dealer\@ODw\def\ODw@D{1}\fi%
3879 \def\@ODw{\East*}\ifx\ODw@Dealer\@ODw\def\ODw@D{1}\fi%
3880 \def\@ODw{\East!}\ifx\ODw@Dealer\@ODw\def\ODw@D{1}\fi%
3881 \def\@ODw{\East*!}\ifx\ODw@Dealer\@ODw\def\ODw@D{1}\fi%
3882 \def\@ODw{\South}\ifx\ODw@Dealer\@ODw\def\ODw@D{2}\fi%
3883 \def\@ODw{\South*}\ifx\ODw@Dealer\@ODw\def\ODw@D{2}\fi%
3884 \def\@ODw{\South!}\ifx\ODw@Dealer\@ODw\def\ODw@D{2}\fi%
3885 \def\@ODw{\South*!}\ifx\ODw@Dealer\@ODw\def\ODw@D{2}\fi%
3886 \def\@ODw{\West}\ifx\ODw@Dealer\@ODw\def\ODw@D{3}\fi%
3887 \def\@ODw{\West*}\ifx\ODw@Dealer\@ODw\def\ODw@D{3}\fi%
3888 \def\@ODw{\West!}\ifx\ODw@Dealer\@ODw\def\ODw@D{3}\fi%
3889 \def\@ODw{\West*!}\ifx\ODw@Dealer\@ODw\def\ODw@D{3}\fi%
3890 %
3891 % \end{macrocode}
3892 % We use a |picture| environment and set its size to
3893 % $\mbox{|2.5em|} \times \mbox{|2.5em|}$
3894 % by setting the |\PicSize| to 500 and the unitlength to |0.005em|. Doing this
3895 % enables us the avoid floating point arithmetic in the calculations of
3896 % positions. Both |\PicSize| and |\MidSize| are local to |\ODw@Compass| and
3897 % skipped from indexing. The same goes for |\Hoffset| and |\Voffset|.
3898 % \begin{macrocode}
3899 \ODw@CompassDefault% use the compass font
3900 \def\PicSize{500}%
3901 \def\MidSize{250}%
3902 % Multiply unitlength=0.005em with CompSize (default= 1)
3903 \setlength\unitlength{0.005em * \real{\ODw@CompSize}}%
3904 \ODw@gsetlength\ODw@Compasssize{\unitlength * \PicSize + 2ex}%
3905 \def\Hoffset{30}% distance between W (E) and frame
3906 \def\Voffset{30}% distance between N (S) and frame
3907 \setlength\ODw@Tmp@Width{0.1em * \real{\ODw@CompLine}}%
3908 \linethickness{\ODw@Tmp@Width}%
3909 % leave 1ex space on all sides
3910 \parbox[c][\ODw@Compasssize]{\ODw@Compasssize}{%
3911 \centering%
3912 \begin{picture}(\PicSize,\PicSize)%
3913 \ifODw@CompShow%
3914 % the frame
3915 \moveto(0,0)
3916 \if\ODw@CompLine0% must do it this way, because
3917 \else% linethickness zero does not suppress the line
3918 \lineto(0,\PicSize)\lineto(\PicSize,\PicSize)
3919 \lineto(\PicSize,0)\closepath\strokepath
3920 \fi%
3921 % the cardinal points
3922 \put(\MidSize,\the\numexpr \PicSize - \Voffset)%
3923 {\makebox[0pt]{\raisebox{-\height}{\ODw@Print{0}}}}% N
3924 \put(\MidSize,\Voffset){\makebox[0pt]{\ODw@Print{2}}}% S
3925 \put(\Hoffset,\MidSize){%
3926 \makebox[0pt][l]{%
3927 \ifODw@CompTurn%
3928 \raisebox{-0.5\height}{%
3929 \rotatebox[origin=t]{90}{\ODw@Print{3}}%
3930 }%
3931 \else%
3932 \raisebox{-0.5\height}{\ODw@Print{3}}%
3933 \fi%
3934 }% makebox
3935 }% W
3936 \put(\the\numexpr \PicSize - \Hoffset,\MidSize)%
3937 {\makebox[0pt][r]{%
3938 \raisebox{-0.5\height}{%
3939 \ifODw@CompTurn%
3940 \rotatebox[origin=c]{90}{\ODw@Print{1}}%
3941 \else%
3942 \ODw@Print{1}%
3943 \fi%
3944 }%
3945 }% makebox
3946 }% E
3947 % the center
3948 \put(\MidSize,\MidSize){\makebox(0,0){\ODw@mid}}
3949 \fi%
3950 \end{picture}%
3951 }% parbox
3952 \endgroup
3953 }% ODw@Compass
3954 % \end{macrocode}
3955 % \end{macro}
3956 %
3957 % \begin{macro}{\ODw@Print}\MacroDef{ODw@Print}[\marg{player-code}]
3958 % |\ODw@Print| prints |N|, |E|, |S| and |W| in the compass. The side that
3959 % is vulnerable is printed in red (or italics if we are monochrome),
3960 % otherwise in black. The dealer is under- or overlined.
3961 % \par\noindent
3962 % The |\ifcase| distinguishes between the players. Then dealership and
3963 % vulnerability are tested. |\ODw@PrintColor| is called to actually print
3964 % the player.
3965 % \begin{macrocode}
3966 \newcommand\ODw@Print[1]{%
3967 % \end{macrocode}
3968 % |\ODw@Print{player-code}|\\
3969 % | 1 (player-code=0-3)|
3970 % \begin{macrocode}
3971 \bgroup
3972 \smaller\smaller%
3973 \ifcase#1% #1=0: print N
3974 \ifboolexpr{ test {\ifnumcomp{\ODw@D}{=}{0}}}%
3975 {% dealer = N
3976 \ifboolexpr{ test {\ifnumcomp{\ODw@V}{=}{1}} or%
3977 test {\ifnumcomp{\ODw@V}{=}{2}} }%
3978 {\ODw@PrintColor{\underline{\ODw@N*}}}% Vul
3979 {\underline{\ODw@N*}}% not Vul
3980 }{% dealer <> N
3981 \ifboolexpr{ test {\ifnumcomp{\ODw@V}{=}{1}} or%
3982 test {\ifnumcomp{\ODw@V}{=}{2}} }%
3983 {\ODw@PrintColor{\ODw@N*}}% Vul
3984 {\ODw@N*}% not Vul
3985 }%
3986 \or% #1=1: print E
3987 \ifboolexpr{ test {\ifnumcomp{\ODw@D}{=}{1}}}%
3988 {% dealer E
3989 \ifboolexpr{ test {\ifnumcomp{\ODw@V}{=}{1}} or%
3990 test {\ifnumcomp{\ODw@V}{=}{3}} }%
3991 {\ODw@PrintColor{\underline{\ODw@E*}}}% Vul
3992 {\underline{\ODw@E*}}% not Vul
3993 }{% dealer <> E
3994 \ifboolexpr{ test {\ifnumcomp{\ODw@V}{=}{1}} or%
3995 test {\ifnumcomp{\ODw@V}{=}{3}} }%
3996 {\ODw@PrintColor{\ODw@E*}}% Vul
3997 {\ODw@E*}% not Vul
3998 }%
3999 \or% #1=2: print S
4000 \ifboolexpr{ test {\ifnumcomp{\ODw@D}{=}{2}}}%
4001 {% dealer S
4002 \ifboolexpr{ test {\ifnumcomp{\ODw@V}{=}{1}} or%
4003 test {\ifnumcomp{\ODw@V}{=}{2}} }%
4004 {\ODw@PrintColor{%
4005 \ensuremath{\overline{\mbox{\ODw@S*}}}}%
4006 }% Vul
4007 {\ensuremath{\overline{\mbox{\ODw@S*}}}}% not Vul
4008 }{% dealer <> S
4009 \ifboolexpr{ test {\ifnumcomp{\ODw@V}{=}{1}} or%
4010 test {\ifnumcomp{\ODw@V}{=}{2}} }%
4011 {\ODw@PrintColor{\ODw@S*}}% Vul
4012 {\ODw@S*}% not Vul
4013 }%
4014 \or% #1=3: print W
4015 \ifboolexpr{ test {\ifnumcomp{\ODw@D}{=}{3}}}%
4016 {% dealer W
4017 \ifboolexpr{ test {\ifnumcomp{\ODw@V}{=}{1}} or%
4018 test {\ifnumcomp{\ODw@V}{=}{3}} }%
4019 {\ODw@PrintColor{\underline{\ODw@W*}}}% Vul
4020 {\underline{\ODw@W*}}% not Vul
4021 }{% dealer <> W
4022 \ifboolexpr{ test {\ifnumcomp{\ODw@V}{=}{1}} or%
4023 test {\ifnumcomp{\ODw@V}{=}{3}} }%
4024 {\ODw@PrintColor{\ODw@W*}}% Vul
4025 {\ODw@W*}% not Vul
4026 }%
4027 \fi% (ifcase#1)
4028 \egroup%
4029 }% ODw@Print
4030 % \end{macrocode}
4031 % \end{macro}
4032 %
4033 % \DeleteShortVerb{\|}
4034 % \begin{macro}{\ODw@PrintColor}\MacroDef{ODw@PrintColor}[\{|N|E|S|W\}]
4035 % \MakeShortVerb{\|}
4036 % |\ODw@PrintColor| checks if we are in monochrome mode. If that is the
4037 % case we print |N|, |E|, |S| or |W| in italics, otherwise in color.
4038 %
4039 % \begin{macrocode}
4040 \newcommand\ODw@PrintColor[1]{%
4041 \ifODw@monochrome\textit{#1}\else\textcolor{red}{#1}\fi%
4042 }% ODw@PrintColor
4043 % \end{macrocode}
4044 % \end{macro}
4045 %
4046 % \begin{macro}{\ODw@mid}
4047 % Hook to write something in the middle of the compass. We write what is
4048 % stored in |\ODw@CompMid| a bit smaller than the |N-S| and |E-W| letters.
4049 % |\ODw@mid| writes the contents of |\ODw@CompMid| in the middle of the
4050 % compass. As there is only very limited room, this text should be very
4051 % short. It is primarily meant to write just a board number in the
4052 % compass.
4053 % \begin{macro}{\ODw@CompMid}
4054 % \begin{macrocode}
4055 \def\ODw@CompMid{}
4056 \def\ODw@mid{{\smaller\smaller\smaller\ODw@CompMid}}
4057 % \end{macrocode}
4058 % \end{macro}
4059 % \end{macro}
4060 %
4061 % \begin{macro}{\ODw@Box}
4062 % Displays a \ODwBox
4063 % \begin{macrocode}
4064 \newcommand{\ODw@Box}{%
4065 \bgroup
4066 \setlength{\fboxsep}{0pt}%
4067 \setlength{\fboxrule}{0.1em}%
4068 \fbox{\rule{0mm}{0.7em}\rule{0.7em}{0mm}}%
4069 \egroup
4070 }% ODw@Box
4071 % \end{macrocode}
4072 % \end{macro}
4073 %
4074 %
4075 % \subsubsection{Diagram Conditions}
4076 %
4077 % Here we implement several macros that add some board information to the
4078 % card diagram. |\ODw@BoardText| serves as a variable to store the
4079 % user-defined or (by means of the board number) auto-generated text,
4080 % concerning the board. The macro |\boardnr| has 1 mandatory argument. If
4081 % it is a number, it is considered to be the board number.
4082 % The dealer and which side is vulnerable is then
4083 % calculated from it and stored by calling |\dealer| resp. |\vulner|. If
4084 % it is not a positive integer, it is considered user-defined text which is
4085 % stored 'as is' in |\ODw@BoardText|. The contents can be retrieved by the
4086 % user by calling |\boardtext| to actually print the board information.
4087 % \begin{macro}{\ODw@BoardText}
4088 % \begin{macrocode}
4089 \def\ODw@BoardText{}
4090 % \end{macrocode}
4091 % \end{macro}
4092 % \begin{macro}{\boardtext}\MacroDef{boardtext}[\Oarg{*}]
4093 % \noindent
4094 % |\boardtext| has only 1 token and no arguments. The unstarred form
4095 % outputs only the text stored in |\ODw@BoardText|, this is normally a
4096 % board number. |\boardtext*| outputs something like 'Board:~23'.
4097 % \begin{macrocode}
4098 \NewDocumentCommand\boardtext{s}{%
4099 \IfBooleanTF#1{\translate{Board-(ODw)}:\,\ODw@BoardText}%
4100 {\ODw@BoardText}%
4101 }% boardtext
4102 % \end{macrocode}
4103 % \end{macro}
4104 % \begin{macro}{\boardnr}\MacroDef{boardnr}[\marg{Nr}]
4105 % |\boardnr{Nr}| sets the dealership and vulnerability according to |Nr|.
4106 % As the system repeats itself after the 16th board, we canonize |Nr| to
4107 % the range of 1--16. We also set |\ODw@BoardText| accordingly. For the
4108 % association between boardnumber and dealer/vulner, see file
4109 % \emph{Compass} of the |onedown-example| collection.
4110 % \begin{macrocode}
4111 \newcommand{\boardnr}[1]{%
4112 \IfInteger{#1}{%
4113 \gdef\ODw@BoardText{%
4114 \bgroup%
4115 \ODw@OtherFont%
4116 % \translate{Board-(ODw)} #1%
4117 #1%
4118 \egroup%
4119 }%
4120 \setcounter{ODw@Cnt}{#1}%
4121 \whiledo{\theODw@Cnt > 16}{%
4122 \addtocounter{ODw@Cnt}{-16}%
4123 }% whiledo, now 1 <= Cnt <= 16
4124 \IfEqCase{\theODw@Cnt}{% set dealer/vulner
4125 % Board 0 = no board: mark dealer and vulner undefined
4126 {0}{\gdef\ODw@BoardText{}\vulner[-1]\dealer[-1]}
4127 {1}{\vulner[\none]\dealer[\North*!]}
4128 {2}{\vulner[\NorthSouth*!]\dealer[\East*!]}
4129 {3}{\vulner[\EastWest*!]\dealer[\South*!]}
4130 {4}{\vulner[\all]\dealer[\West*!]}
4131 {5}{\vulner[\NorthSouth*!]\dealer[\North*!]}
4132 {6}{\vulner[\EastWest*!]\dealer[\East*!]}
4133 {7}{\vulner[\all]\dealer[\South*!]}
4134 {8}{\vulner[\none]\dealer[\West*!]}
4135 {9}{\vulner[\EastWest*!]\dealer[\North*!]}
4136 {10}{\vulner[\all]\dealer[\East*!]}
4137 {11}{\vulner[\none]\dealer[\South*!]}
4138 {12}{\vulner[\NorthSouth*!]\dealer[\West*!]}
4139 {13}{\vulner[\all]\dealer[\North*!]}
4140 {14}{\vulner[\none]\dealer[\East*!]}
4141 {15}{\vulner[\NorthSouth*!]\dealer[\South*!]}
4142 {16}{\vulner[\EastWest*!]\dealer[\West*!]}
4143 }% IfEqCase
4144 }{\gdef\ODw@BoardText{#1}}% otherwise take #1
4145 }% boardnr
4146 % \end{macrocode}
4147 % \end{macro}
4148 %
4149 % The next macros are used to add some game information above resp. below
4150 % the card diagram. |\ODw@HeaderText| and |\ODw@FooterText| are used as
4151 % variables to store the user-defined text.
4152 % \begin{macro}{\headlinetext}\MacroDef{headlinetext}[\marg{text}]
4153 % \begin{macro}{\ODw@HeaderText}
4154 % \begin{macrocode}
4155 \newcommand\headlinetext[1]{\gdef\ODw@HeaderText{#1}}
4156 \headlinetext{}
4157 % \end{macrocode}
4158 % \end{macro}
4159 % \end{macro}
4160 %
4161 % \begin{macro}{\footlinetext}\MacroDef{footlinetext}[\marg{text}]
4162 % \begin{macro}{\ODw@FooterText}
4163 % \begin{macrocode}
4164 \newcommand\footlinetext[1]{\gdef\ODw@FooterText{#1}}
4165 \footlinetext{}
4166 % \end{macrocode}
4167 % \end{macro}
4168 % \end{macro}
4169 %
4170 % The next macros are used to add some game information in the corners of
4171 % the card diagram. We use a |tabular| with 1 column and 3 lines to do so.
4172 %
4173 % We redefine the (originally empty) |Left[Upper/Lower]|- and\\
4174 % |Right[Upper/Lower]Text|, and set it to the wanted value. The
4175 % first (optional) parameter defines some horizontal extra space if the
4176 % hand and a condition text collide. The commands have 3 mandatory
4177 % arguments, each for 1 of the 3 condition lines, which may be empty.
4178 % \begin{macro}{\leftupper}\MacroDef{leftupper}[\oarg{h-offset}\marg{line1}\marg{line2}\marg{line3}]
4179 % \begin{macro}{\ODw@LeftUpperText}
4180 % \begin{macrocode}
4181 \def\ODw@LeftUpperText{}
4182 \newcommand\leftupper[4][0pt]{%
4183 \gdef\ODw@LeftUpperText{%
4184 \hspace{-#1}%
4185 \begin{tabular}[t]{l}#2\\#3\\#4\\\end{tabular}
4186 }%
4187 }% leftupper
4188 % \end{macrocode}
4189 % \end{macro}
4190 % \end{macro}
4191 %
4192 % \begin{macro}{\leftlower}\MacroDef{leftlower}[\oarg{h-offset}\marg{line1}\marg{line2}\marg{line3}]
4193 % \begin{macro}{\ODw@LeftLowerText}
4194 % \begin{macrocode}
4195 \def\ODw@LeftLowerText{}
4196 \newcommand\leftlower[4][0pt]{%
4197 \gdef\ODw@LeftLowerText{%
4198 \hspace{-#1}%
4199 \begin{tabular}[b]{l}#2\\#3\\#4\\\end{tabular}
4200 }%
4201 }% leftlower
4202 % \end{macrocode}
4203 % \end{macro}
4204 % \end{macro}
4205 %
4206 % \begin{macro}{\rightupper}\MacroDef{rightupper}[\oarg{h-offset}\marg{line1}\marg{line2}\marg{line3}]
4207 % \begin{macro}{\ODw@RightUpperText}
4208 % \begin{macrocode}
4209 \def\ODw@RightUpperText{}
4210 \newcommand\rightupper[4][0pt]{%
4211 \gdef\ODw@RightUpperText{%
4212 \hspace{#1}%
4213 \begin{tabular}[t]{l}#2\\#3\\#4\\\end{tabular}
4214 }%
4215 }% rightupper
4216 % \end{macrocode}
4217 % \end{macro}
4218 % \end{macro}
4219 %
4220 % \begin{macro}{\rightlower}\MacroDef{rightlower}[\oarg{h-offset}\marg{line1}\marg{line2}\marg{line3}]
4221 % \begin{macro}{\ODw@RightLowerText}
4222 % \begin{macrocode}
4223 \def\ODw@RightLowerText{}
4224 \newcommand\rightlower[4][0pt]{%
4225 \gdef\ODw@RightLowerText{%
4226 \hspace{#1}%
4227 \begin{tabular}[b]{l}#2\\#3\\#4\\\end{tabular}
4228 }%
4229 }% rightlower
4230 % \end{macrocode}
4231 % \end{macro}
4232 % \end{macro}
4233 %
4234 %
4235 %
4236 % \begin{macro}{\ODw@ProcessHeader}\MacroDef{ODw@ProcessHeader}[\marg{N}]
4237 % |\ODw@ProcessHeader[N]| puts |HeaderText| in a multicolumn which spans N
4238 % columns.
4239 % \begin{macrocode}
4240 \newcommand{\ODw@ProcessHeader}[1]{%
4241 % \end{macrocode}
4242 % Programmers note:\\
4243 % |\ODw@TestIfEmpty| cannot be called in here. The |\ifthenelse| called within
4244 % the tabular environment leads to the error:\\
4245 % \example{|! Misplaced |\bs|omit. |\bs|multispan ->|\bs|omit |\bs|@multispan|}
4246 % \par\vspace{0.5\baselineskip}\noindent
4247 % So the test of the emptiness of |Header-| and |FooterText| is done out of
4248 % the tabular. Why is (La)TeX always causing unexpected problems?:-(
4249 % \par\noindent
4250 % We set the headline/footline text to the width of the diagram with a
4251 % solution found at:\\
4252 % \url{https://tex.stackexchange.com/questions/125005/how-to-create-a-table-where-one-cell-spans-all-the-columns-and-the-text-wraps-pr}
4253 %
4254 % \begin{macrocode}
4255 \ifODw@EmptyHeader% Must be this way (StackExchange)
4256 \else% |\ifthenelse| bites |\multicolumn|!
4257 \multicolumn{#1}{%
4258 p{\dimexpr\ODw@Diagram@Width-%
4259 2\tabcolsep-2\arrayrulewidth}%
4260 }{{\ODw@LegendFont\ODw@HeaderText}}\\
4261 \fi%
4262 }% ODw@ProcessHeader
4263 % \end{macrocode}
4264 % \end{macro}
4265 %
4266 % \begin{macro}{\ODw@TestIfEmpty}\MacroDef{ODw@TestIfEmpty}[\marg{Str}\marg{Bool}]
4267 % Tests the emptiness of a string.
4268 % \begin{macrocode}
4269 \newcommand{\ODw@TestIfEmpty}[2]{%
4270 % \end{macrocode}
4271 % |\ODw@TestIfEmpty{Str}{Bool}|\\
4272 % | sets boolean Bool to true if string Str is empty|
4273 % \begin{macrocode}
4274 \ifthenelse{\equal{#1}{}}{%
4275 \setboolean{#2}{true}}{%
4276 \setboolean{#2}{false}%
4277 }%
4278 }% ODw@TestIfEmpty
4279 % \end{macrocode}
4280 % \end{macro}
4281 %
4282 %
4283 % \begin{macro}{\ODw@ProcessFooter}\MacroDef{ODw@ProcessFooter}[\marg{N}]
4284 % |\ODw@ProcessFooter[N]| puts |FooterText| in a multicolumn which spans
4285 % |N| columns.
4286 % \begin{macrocode}
4287 \newcommand{\ODw@ProcessFooter}[1]{%
4288 \ifODw@EmptyFooter% Must be this way (StackExchange)
4289 \else% |\ifthenelse| bites |\multicolumn|!
4290 \multicolumn{#1}{%
4291 p{\dimexpr\ODw@Diagram@Width%
4292 -2\tabcolsep-2\arrayrulewidth}%
4293 }{{\ODw@LegendFont\ODw@FooterText}}\\
4294 \fi%
4295 }% ODw@ProcessFooter
4296 % \end{macrocode}
4297 % \end{macro}
4298 %
4299 % \begin{macro}{\handskip}\MacroDef{handskip}[\marg{length}]
4300 % |\handskip| adds |<length>| to |SkipWidth|, i.e.\ the distance between
4301 % the card diagram (with or without the east hand) and the |bidding|
4302 % diagram.
4303 % \begin{macrocode}
4304 \newcommand\handskip[1]{%
4305 \def\ODw@Skipwidth{1em + #1}% recalculate the new Skipwidth
4306 \setlength\ODw@Skip@Width{\ODw@Skipwidth}%
4307 }% handskip
4308 % \end{macrocode}
4309 % \end{macro}
4310 %
4311 % \begin{macro}{\ODw@DealerText}
4312 % Typesets the string \emph{Dealer}.
4313 % \begin{macrocode}
4314 \def\ODw@DealerText{%
4315 \bgroup%
4316 \ODw@OtherFont\translate{Dealer-(ODw)}%
4317 \egroup%
4318 }% ODw@DealerText
4319 % \end{macrocode}
4320 % \end{macro}
4321 % \par\noindent\needspace{2\baselineskip}
4322 % \begin{macro}{\ODw@VulnerText}
4323 % \makeatletter
4324 % \MacroDef{ODw@VulnerText}[\Oarg{*!}\hfill \ODw@VulnerText (\ODw@VulnerText*,
4325 % \ODw@VulnerText!, \ODw@VulnerText*!)]
4326 % \makeatother
4327 % Typesets the string \emph{vulnerable} or \emph{Vul}.
4328 % \begin{macrocode}
4329 \NewDocumentCommand\ODw@VulnerText{s t!}{%
4330 \bgroup%
4331 \ODw@OtherFont%
4332 \IfBooleanTF#1{%
4333 \IfBooleanTF#2{\translate{Vul-(ODw)}}%
4334 {\translate{Vulnerable-(ODw)}}%
4335 }{%
4336 \IfBooleanTF#2{\translate{vul-(ODw)}}%
4337 {\translate{vulnerable-(ODw)}}%
4338 }%
4339 \egroup%
4340 \xspace%
4341 }% ODw@VulnerText
4342 % \end{macrocode}
4343 % \end{macro}
4344 %
4345 % \begin{macro}{\ODw@AwardText} Typesets the text to be put as 'title' in
4346 % the \emph{award} part of a expert quiz.
4347 % \begin{macrocode}
4348 \def\ODw@AwardText{\textsf{\translate{Award-(ODw)}}}
4349 % \end{macrocode}
4350 % \end{macro}
4351 %
4352 % \begin{macro}{\dealer}\MacroDef{dealer}[\oarg{dealer}]
4353 % If |#1 = empty| then set |\ODw@Dealer| to |#1| else output |\ODw@Dealer|
4354 % \begin{macrocode}
4355 \newcommand\dealer[1][]{%
4356 \ifthenelse{\equal{#1}{}}%
4357 {\ODw@Dealer}%
4358 {\gdef\ODw@Dealer{#1}}%
4359 }% dealer
4360 % \end{macrocode}
4361 % \end{macro}
4362 % \begin{macro}{\ODw@Dealer}
4363 % set \north as default
4364 % \begin{macrocode}
4365 \def\ODw@Dealer{\North*}
4366 % \end{macrocode}
4367 % \end{macro}
4368 %
4369 % \begin{macro}{\vulner}\MacroDef{vulner}[\oarg{vulner}]
4370 % If |#1 = empty| then set |\ODw@Vulner| to |#1| else output |\ODw@Vulner|
4371 % \begin{macrocode}
4372 \newcommand\vulner[1][]{%
4373 \ifthenelse{\equal{#1}{}}%
4374 {\ODw@Vulner}%
4375 {\gdef\ODw@Vulner{#1}}%
4376 }% vulner
4377 % \end{macrocode}
4378 % \end{macro}
4379 % \begin{macro}{\ODw@Vulner}
4380 % set \NorthSouth as default
4381 % \begin{macrocode}
4382 \def\ODw@Vulner{\NorthSouth}
4383 % \end{macrocode}
4384 % \end{macro}
4385 %
4386 % \begin{macro}{\dealertext}
4387 % \begin{macrocode}
4388 \newcommand\dealertext[1][\ODw@Dealer]{\ODw@DealerText:\,#1}
4389 % \end{macrocode}
4390 % \end{macro}
4391 %
4392 % \begin{macro}{\vulnertext}
4393 % \begin{macrocode}
4394 \newcommand\vulnertext[1][\ODw@Vulner]{%
4395 \ifODw@LongCalls%
4396 \ODw@VulnerText*%
4397 \else%
4398 \ODw@VulnerText*!%
4399 \fi%
4400 :\,#1%
4401 }
4402 % \end{macrocode}
4403 % \end{macro}
4404 %
4405 % \begin{macro}{\alert}
4406 % \begin{macrocode}
4407 \newcommand{\alert}{{}\ensuremath{^\textbf{\textasteriskcentered}}}
4408 % \end{macrocode}
4409 % \end{macro}
4410 %
4411 % \begin{macro}{\announce}
4412 % \begin{macrocode}
4413 \newcommand{\announce}{{}\ensuremath{^\textbf{\smaller A}}}
4414 % \end{macrocode}
4415 % \end{macro}
4416 %
4417 % \begin{macro}{\markit}\MacroDef{markit}
4418 % \begin{macrocode}
4419 \newcommand\markit{%
4420 % \end{macrocode}
4421 % Sets markers \emph{a, b} etc. To be used only in |bidding| diagrams.
4422 % \begin{macrocode}
4423 \stepcounter{ODw@Nr}%
4424 \footnotemark[\theODw@Nr]%
4425 }% markit
4426 % \end{macrocode}
4427 % \end{macro}
4428 %
4429 % \begin{macro}{\explainit}\MacroDef{explainit}[\marg{text}]
4430 % \begin{macrocode}
4431 \newcommand\explainit[1]{%
4432 % \end{macrocode}
4433 % Explains the marked items. To be used only in |bidding| diagrams. The
4434 % counter |ODw@Nr| associates the marker with the explanation.
4435 % \begin{macrocode}
4436 \stepcounter{ODw@Nr}%
4437 \ensuremath{{}^\textrm{\smaller\alph{ODw@Nr}}}\,#1%
4438 }% explainit
4439 % \end{macrocode}
4440 % \end{macro}
4441 %
4442 % \subsection{The Bidding Environments}
4443 %
4444 % \subsubsection{Special Columntypes}
4445 %
4446 % \begin{macro}{\newcolumntype}
4447 % In order to automatically apply a macro call on all cell contents of a
4448 % column (translate/convert; step a counter) in |bidding| and |play| diagrams,
4449 % we define newcolumntypes, made possible by loading package
4450 % \packname{collectcell}. We define next columntypes:
4451 % \begin{description}[topsep=2mm,itemsep=-2mm]
4452 % \item{B:} Transfers suits and cards (|bidding| and |play|)
4453 % \item{F:} sets First column in |play| diagrams
4454 % \item{P:} Transfers suits and cards, accumulates won tricks (|play|)
4455 % \end{description}
4456 %
4457 % \begin{macrocode}
4458 \newcolumntype{B}{% for Biddings
4459 >{\collectcell\ODw@BTfer}c<{\endcollectcell}}
4460 \newcolumntype{F}{% for First column in |play| diagrams
4461 >{\collectcell\ODw@FTfer}c<{\endcollectcell}}
4462 \newcolumntype{P}{% for |Play| diagrams (2nd--4th column)
4463 >{\collectcell\ODw@PTfer}c<{\endcollectcell}}
4464 % \end{macrocode}
4465 % \end{macro}
4466 %
4467 % \subsubsection{The Hidden Implementation}
4468 %
4469 % As explained before, in the |bidding| diagrams we convert |S| to the spade
4470 % symbol \Sp, etc. We do need packages \packname{array} and
4471 % \packname{collectcell} for this and define the columntype |B|. In order
4472 % to avoid these convertions in the top row, where names are displayed, we
4473 % use the |\cci|-trick to suppress expansion of the cell macro. Curiously
4474 % the command |\cci| (from \packname{collcell}, v0.5, 2011/02/27) sometimes
4475 % produces unwanted characters. The reason is unknown to me.
4476 % We use a space ("| |") as first character in |\cci| to avoid this.
4477 % \par\noindent
4478 % We store the |bidding| diagram without the explanations in a box, so we can
4479 % calculate the width of the |bidding| diagram and make our explanation part
4480 % exactly as wide. In the first row we write the bidders: |North| etc.\ (or
4481 % |N|, if it has to be short). In the second row we write the real world
4482 % names of the bidders, if given. If any description is given, we make a
4483 % multicolumn over the 4 rows with the previously stored width to write the
4484 % explanations. We also use this width to calculate whether the bidding
4485 % diagram will fit on the actual line. If not, we put it on a new line.
4486 % \begin{environment}{ODw@Bidding}\MacroDef{ODw@Bidding}[\oarg{pos}\parg{description}\ldots\bs endODw@Bidding]
4487 % \begin{macrocode}
4488 \NewEnviron{ODw@Bidding}[2][t]{%
4489 \def\xspace{}%
4490 \setlength\tabcolsep{0.2em}%
4491 \sbox{0}{%
4492 \begin{tabular}[#1]{BBBB}% 1st column
4493 \ifODw@Bidders%
4494 \cci{ % there MUST be a ' ' (space)
4495 \ODw@BidderFont%
4496 \ifODw@short\ODw@BidderI%
4497 \else\ODw@BidderI*%
4498 \fi%
4499 } &% 2nd column
4500 \cci{ % there MUST be a ' ' (space)
4501 \ODw@BidderFont%
4502 \ifODw@short\ODw@BidderII%
4503 \else\ODw@BidderII*%
4504 \fi%
4505 } &% 3rd column
4506 \cci{ % there MUST be a ' ' (space)
4507 \ODw@BidderFont%
4508 \ifODw@short\ODw@BidderIII%
4509 \else\ODw@BidderIII*%
4510 \fi%
4511 } &% 4th column
4512 \cci{ % there MUST be a ' ' (space)
4513 \ODw@BidderFont%
4514 \ifODw@short\ODw@BidderIV%
4515 \else\ODw@BidderIV*%
4516 \fi%
4517 } \\% end of 1st row
4518 \if\ODw@All@Names\empty%
4519 \else% 2nd row
4520 \cci{ \ODw@NameFont\ODw@NameI} &% please
4521 \cci{ \ODw@NameFont\ODw@NameII} &% mind
4522 \cci{ \ODw@NameFont\ODw@NameIII} &% the
4523 \cci{ \ODw@NameFont\ODw@NameIV} \\% spaces!
4524 \fi%
4525 \ifODw@BidLine\hline\fi%
4526 \fi%
4527 \BODY%
4528 %%%%%%
4529 \end{tabular}%
4530 }% sbox0
4531 \setcounter{ODw@Nr}{0}%
4532 \setlength{\ODw@Bid@Width}{\wd0}%
4533 \global\sbox\ODw@BidBox{%
4534 \begin{tabular}[#1]{BBBB}% 1st column
4535 \ifODw@Bidders%
4536 \cci{ % there MUST be a ' ' (space)
4537 \ODw@BidderFont%
4538 \ifODw@short\ODw@BidderI%
4539 \else\ODw@BidderI*%
4540 \fi%
4541 } &% 2nd column
4542 \cci{ % there MUST be a ' ' (space)
4543 \ODw@BidderFont%
4544 \ifODw@short\ODw@BidderII%
4545 \else\ODw@BidderII*%
4546 \fi%
4547 } &% 3rd column
4548 \cci{ % there MUST be a ' ' (space)
4549 \ODw@BidderFont%
4550 \ifODw@short\ODw@BidderIII%
4551 \else\ODw@BidderIII*%
4552 \fi%
4553 } &% 4th column
4554 \cci{ % there MUST be a ' ' (space)
4555 \ODw@BidderFont%
4556 \ifODw@short\ODw@BidderIV%
4557 \else\ODw@BidderIV*%
4558 \fi%
4559 } \\% end of 1st row
4560 \if\ODw@All@Names\empty%
4561 \else% 2nd row
4562 \cci{ \ODw@NameFont\ODw@NameI} &% please
4563 \cci{ \ODw@NameFont\ODw@NameII} &% mind
4564 \cci{ \ODw@NameFont\ODw@NameIII} &% the
4565 \cci{ \ODw@NameFont\ODw@NameIV} \\% spaces!
4566 \fi%
4567 \ifODw@BidLine\hline\fi%
4568 \fi
4569 \BODY%
4570 %%%%% Until here the same code as in the sbox!
4571 \ifODw@description%
4572 % Add the description, if not empty
4573 \hline%
4574 \multicolumn{4}{% span explanations over 4 cols...
4575 p{\dimexpr\ODw@Bid@Width-2\tabcolsep}%
4576 }{% ...with the right width
4577 \setcounter{ODw@Nr}{0}%
4578 \raggedright%
4579 \smaller\smaller#2%
4580 }\\%
4581 \fi%
4582 \end{tabular}%
4583 }% sbox ODw@BidBox
4584 }% ODw@Bidding
4585 % \end{macrocode}
4586 % \end{environment}
4587 %
4588 % \begin{environment}{ODw@Biddingpair}\MacroDef{ODw@Biddingpair}[\oarg{pos}\parg{description}\ldots\bs endODw@Biddingpair]
4589 % Decription: Similar to |ODw@Bidding|
4590 % \begin{macrocode}
4591 \NewEnviron{ODw@Biddingpair}[2][t]{%
4592 \def\xspace{}%
4593 \setlength\tabcolsep{0.2em}%
4594 \sbox{0}{%
4595 \begin{tabular}[#1]{BB}% 1st column
4596 \ifODw@Bidders%
4597 \cci{ % there MUST be a ' ' (space)
4598 \ODw@BidderFont%
4599 \ifODw@short\ODw@BidderI%
4600 \else\ODw@BidderI*%
4601 \fi%
4602 } &% 2nd column
4603 \cci{ % there MUST be a ' ' (space)
4604 \ODw@BidderFont%
4605 \ifODw@short\ODw@BidderIII%
4606 \else\ODw@BidderIII*%
4607 \fi%
4608 } \\% end of 1st row
4609 \if\ODw@All@Names\empty%
4610 \else% 2nd row
4611 \cci{ \ODw@NameFont\ODw@NameI} &% please mind
4612 \cci{ \ODw@NameFont\ODw@NameIII} \\% the spaces!
4613 \fi%
4614 \ifODw@BidLine\hline\fi%
4615 \fi%
4616 \BODY%
4617 %%%%%%%
4618 \end{tabular}%
4619 }% sbox0
4620 \setcounter{ODw@Nr}{0}%
4621 \setlength{\ODw@Bid@Width}{\wd0}%
4622 \global\sbox\ODw@BidBox{%
4623 \begin{tabular}[#1]{BB}% 1st column
4624 \ifODw@Bidders%
4625 \cci{ % there MUST be a ' ' (space)
4626 \ODw@BidderFont%
4627 \ifODw@short\ODw@BidderI%
4628 \else\ODw@BidderI*%
4629 \fi%
4630 } &% 2nd column
4631 \cci{ % there MUST be a ' ' (space)
4632 \ODw@BidderFont%
4633 \ifODw@short\ODw@BidderIII%
4634 \else\ODw@BidderIII*%
4635 \fi%
4636 } \\% end of 1st row
4637 \if\ODw@All@Names\empty%
4638 \else% 2nd row
4639 \cci{ \ODw@NameFont\ODw@NameI} &% please mind
4640 \cci{ \ODw@NameFont\ODw@NameIII} \\% the spaces!
4641 \fi%
4642 \ifODw@BidLine\hline\fi%
4643 \fi%
4644 \BODY%
4645 %%%%%% Until here the same code as in the sbox!
4646 \ifODw@description%
4647 % Add the description, if not empty
4648 \hline%
4649 \multicolumn{2}{%
4650 p{\dimexpr\ODw@Bid@Width-2\tabcolsep}%
4651 }{%
4652 \setcounter{ODw@Nr}{0}%
4653 \raggedright%
4654 \smaller\smaller#2%
4655 }\\%
4656 \fi%
4657 \end{tabular}%
4658 }% sbox ODw@BidBox
4659 }% ODw@Biddingpair
4660 % \end{macrocode}
4661 % \end{environment}
4662 %
4663 % \subsection{The User Environments}
4664 %
4665 % \subsubsection{Bidding}
4666 %
4667 % The |bidding| environments have 2 optional arguments: an alignment
4668 % \oarg{pos} and an annotation \parg{description}. There are also 3 tokens:
4669 % the |*| centers the |bidding| diagram, the |+| forces the short notation,
4670 % i.e. \North*! rather than \North* and the |-| suppresses all output.
4671 % \par\noindent
4672 % |\ODw@GameSize| takes care of the font dependent sizing of the diagram.
4673 % We locally redefine |\thefootnote| and reset the (general) counter
4674 % |ODw@Nr|, which is stepped in |\markit| and |\explainit| to make the
4675 % annotations correspond. In the end code we define a multicolumn over all
4676 % 4 (2) columns and write the annotation given in argument |#2|. With
4677 % |p{...\ODw@Bid@Width...}| care is taken to limit this text to the width
4678 % of the diagram.
4679 %
4680 % \begin{environment}{bidding}\EnvDef{bidding}[\Oarg{*!-}\oarg{pos}\parg{description}]
4681 % \begin{macrocode}
4682 \NewDocumentEnvironment{bidding}{s t! t- O{c}d()}{%
4683 % \end{macrocode}
4684 % |\begin{bidding}* ! -[pos](description)|\\
4685 % | 1 2 3 4 5|\\
4686 % The 1st token (|*|) centers the environment; the 2nd token (|!|) switches to the short
4687 % notation in the table header; the 3rd token (|-|) suppresses the output.
4688 % Argument 4 regulates the alignment of the table (default is \textbf{c}
4689 % and the 5th argument contains the annotations of the bidding.
4690 % \begin{macrocode}
4691 \ODw@GameSize%
4692 \renewcommand{\thefootnote}{\alph{footnote}}%
4693 \setcounter{ODw@Nr}{0}%
4694 \IfBooleanTF#1{\center}{}% "*" detected
4695 \IfBooleanTF{#2}{\ODw@shorttrue}{}% "!" detected
4696 \IfValueTF{#5}{\ODw@descriptiontrue}{\ODw@descriptionfalse}%
4697 \ODw@Bidding[#4]{#5}%
4698 }{%
4699 \endODw@Bidding%
4700 \IfBooleanTF{#3}%
4701 {\rule{0pt}{0pt}}%
4702 % +---without this, pdflatex aborts compilation!
4703 {\usebox{\ODw@BidBox}}% "-" detected
4704 \IfBooleanTF#1{\endcenter}{}%
4705 }% bidding
4706 % \end{macrocode}
4707 % \end{environment}
4708 %
4709 % \begin{environment}{biddingpair}\EnvDef{biddingpair}[\Oarg{*!-}\oarg{pos}\parg{description}]
4710 % \begin{macrocode}
4711 \NewDocumentEnvironment{biddingpair}{s t! t- O{c}d()}{%
4712 % \end{macrocode}
4713 % |\begin{biddingpair}* ! -[pos](description)|\\
4714 % | 1 2 3 4 5|\\
4715 % The same as with environment |bidding|, only with 2 columns instead of 4.
4716 % \begin{macrocode}
4717 \def\xspace{}%
4718 \ODw@GameSize%
4719 \renewcommand{\thefootnote}{\alph{footnote}}%
4720 \setcounter{ODw@Nr}{0}%
4721 \IfBooleanTF#1{\center}{}% "*" detected
4722 \IfBooleanTF{#2}{\ODw@shorttrue}{}% "+" detected
4723 \IfValueTF{#5}{\ODw@descriptiontrue}{\ODw@descriptionfalse}%
4724 \ODw@Biddingpair[#4]{#5}%
4725 }{%
4726 \endODw@Biddingpair%
4727 \IfBooleanTF{#3}%
4728 {\rule{0pt}{0pt}}%
4729 % +---without this, pdflatex aborts compilation!
4730 {\usebox{\ODw@BidBox}}% "-" detected
4731 \IfBooleanTF#1{\endcenter}{}%
4732 }% biddingpair
4733 % \end{macrocode}
4734 % \end{environment}
4735 %
4736 %
4737 % \subsubsection{Play}
4738 %
4739 % Environment |play| displays the sequence of playing tricks. It uses
4740 % 2 |newcolumntype|s:
4741 % \begin{itemize}[itemsep=0em]
4742 % \item[|F|] to increment and display the current row.
4743 % \item[|P|] to translate an convert suits/ranks.
4744 % \end{itemize}
4745 %
4746 % \begin{macro}{\ODw@AccTricks}
4747 % |\ODw@AccTricks| calculates and shows the accumulated tricks in
4748 % |play| that |N-S| and |E-W| has won. The winning card is detected
4749 % automatically and |\ODw@LastTrick| is called to process the winning trick
4750 % for whichever side won it (|N-S| or |E-W|) by stepping the counter for the
4751 % winning side. The counter |ODw@Player| denotes the player who won the
4752 % trick. From the player who leads and the position that wins we calculate
4753 % the winning player and step the counter for his side.
4754 % \begin{macrocode}
4755 \def\ODw@AccTricks{%
4756 \ODw@LastTrick{\ODw@Last}{\theODw@WinningNr}%
4757 \ODw@append{\theODw@NSCnt,\theODw@EWCnt,}% store counters
4758 \setcounter{ODw@Highest}{0}% reset for next trick
4759 }% ODw@AccTricks
4760 % \end{macrocode}
4761 % \end{macro}
4762 %
4763 % \begin{macro}{\ODw@Tricks}\MacroDef{ODw@Tricks}
4764 % \begin{macro}{\ODw@Last}\label{Last}
4765 % This macro is automatically called in TableII for column 1.
4766 % This column displays the player who had the lead.
4767 % It essentially 1) resets the |ODw@PlayerNr| which will be
4768 % stepped for each next column in search for the winning card 2)
4769 % remembers in |\ODw@Last| who had the lead. From these two values we can
4770 % later calculate who won this trick. The stepping of |ODw@PlayerNr| occurs
4771 % in |\ODw@Tfer|.
4772 % \begin{macrocode}
4773 \def\ODw@Tricks{%
4774 \setcounter{ODw@PlayerNr}{0}%
4775 \gdef\ODw@Last{\ODw@NextLead}%
4776 \expandafter\translate%
4777 \expandafter{\ODw@NextLead-(ODw)}:\,%
4778 % write a colon and a thin space in the table,
4779 % as separator between lead player and lead card.
4780 }% ODw@Tricks
4781 % \end{macrocode}
4782 % \end{macro}
4783 % \end{macro}
4784 %
4785 % \begin{macro}{\ODw@LastTrick}\MacroDef{ODw@LastTrick}[\marg{Player}\marg{Pos}]
4786 % This macro is called by |\ODw@AccTricks|.
4787 % It computes who won the last trick and steps the corresponding counter.
4788 % \begin{macrocode}
4789 \newcommand\ODw@LastTrick[2]{%
4790 % \end{macrocode}
4791 % |\ODw@LastTrick{Player}{Pos}|\\
4792 % | 1 2--- Seat Nr that won the trick|\\
4793 % | +---------- Player (N,E,S,W) who has led|
4794 % \par\vspace{0.5\baselineskip}\noindent
4795 % Consider the following table, where the seats are in horizontal
4796 % direction, starting with the player who leads in seat 1. Vertically, in
4797 % the first column, we have an initial value, stored in |ODw@Cnt| which is
4798 % associated with the leading player.
4799 %
4800 % \begin{tabular}{c|cccc}
4801 % & 1 & 2 & 3 & 4 \\\hline
4802 % 0 & W$^1$ & N$^2$ & E$^3$ & S$^4$ \\
4803 % 1 & N$^2$ & E$^3$ & S$^4$ & W$^5$ \\
4804 % 2 & E$^3$ & S$^4$ & W$^5$ & N$^6$ \\
4805 % 3 & S$^4$ & W$^5$ & N$^6$ & E$^7$ \\
4806 % \end{tabular}
4807 % \par\noindent
4808 % If we add this initial value to the
4809 % \emph{seat} where the trick is won, then the result gives us the
4810 % \emph{player} who won the trick. Suppose that e.g.\ |S| had the lead,
4811 % so |ODw@Cnt| $=$ 3. Suppose also that seat number 3 wins the trick. The
4812 % sum equals 6 and this is the seat of |N|. For clarity these sums are
4813 % displayed in the table as superscripts to the players
4814 % \par\vspace{0.5\baselineskip}\noindent
4815 % First we set the counter |ODw@Cnt| to the player who has the lead and add
4816 % the seat number (|#2|) to it. We then store who has the next lead in
4817 % |\ODw@NextLead| and increment the counter of the winning side.
4818 %
4819 % \begin{macrocode}
4820 \IfEqCase{#1}{%
4821 {W}{\setcounter{ODw@Cnt}{0}}%
4822 {N}{\setcounter{ODw@Cnt}{1}}%
4823 {E}{\setcounter{ODw@Cnt}{2}}%
4824 {S}{\setcounter{ODw@Cnt}{3}}%
4825 }% IfEqCase
4826 \addtocounter{ODw@Cnt}{#2}%
4827 \IfEqCase{\theODw@Cnt}{%
4828 {1}{\gdef\ODw@NextLead{W}\stepcounter{ODw@EWCnt}}
4829 {2}{\gdef\ODw@NextLead{N}\stepcounter{ODw@NSCnt}}
4830 {3}{\gdef\ODw@NextLead{E}\stepcounter{ODw@EWCnt}}
4831 {4}{\gdef\ODw@NextLead{S}\stepcounter{ODw@NSCnt}}
4832 {5}{\gdef\ODw@NextLead{W}\stepcounter{ODw@EWCnt}}
4833 {6}{\gdef\ODw@NextLead{N}\stepcounter{ODw@NSCnt}}
4834 {7}{\gdef\ODw@NextLead{E}\stepcounter{ODw@EWCnt}}
4835 }% IfEqCase
4836 }% ODw@LastTrick
4837 % \end{macrocode}
4838 % \end{macro}
4839 %
4840 % \begin{environment}{play}\EnvDef{play}[*\marg{Lead}\oarg{Trump}]
4841 % \label{Play}
4842 % \changes{v0.3}{2018/02/24}{\\
4843 % - In order to avoid empty columns in environment \texttt{playtricks} we
4844 % reorganized it. Rather than just 1 table we use 3 tables. The middle one
4845 % typesets the relevant tricks, stored in an \texttt{lrbox}, while
4846 % generating on the fly a string with the winning tricks. Finally we put
4847 % the running trick-number in TableI, we 'use' TableII and contruct
4848 % TableIII from the string with the winning tricks.}
4849 %
4850 % Finally we define environment |play|. It consists primarily of
4851 % these 3 tables, the middle one with the special newcolumntype
4852 % \textbf{P}. We reset the
4853 % counter for the running line (=trick) |ODw@Nr| and the winning trick
4854 % counters for |N|--|S| and |E|--|W|: |ODw@NSCnt| and |ODw@EWCnt|. As usual
4855 % |\ODw@GameSize| takes care for the correct sizing. The first row (the
4856 % title row) is displayed using the |\cci| method. The 3th table gets a
4857 % stacked |N/S| and |E/W| title.
4858 % \begin{macrocode}
4859 \NewDocumentEnvironment{play}{s mO{N}}{%
4860 % #1 --> s center
4861 % #2 --> m lead
4862 % #3 --> O trumpsuit (default NoTrump)
4863 \def\ODw@TrumpSuit{#3}
4864 \gdef\ODw@NextLead{#2}%
4865 \setcounter{ODw@Nr}{0}%
4866 \setcounter{ODw@NSCnt}{0}
4867 \setcounter{ODw@EWCnt}{0}%
4868 \ODw@GameSize%
4869 \ODw@Scratch{}% make empty
4870 \let\ODw@Clubs\empty%
4871 \let\ODw@Diamonds\empty%
4872 \let\ODw@Hearts\empty%
4873 \let\ODw@Spades\empty%
4874 %
4875 % We need some data which is calculated in TableII
4876 % to create TableI and TableIII. So we put TableII in a
4877 % box and display it later at due time
4878 %
4879 \def\ODw@EXtra{0.9em}% white space in title
4880 %
4881 \provideenvironment{TableII}{%
4882 \begin{tabular}[b]{FPPP}%
4883 \multicolumn{1}{c}{\translate{Lead!-(ODw)}} &%
4884 \cci{\translate{2nd-(ODw)}} &%
4885 \cci{\translate{3rd-(ODw)}} &%
4886 \cci{\translate{4th-(ODw)}} \\[0.3em]\hline%
4887 \multicolumn{4}{c}{}\\[-\ODw@EXtra]%
4888 }{%
4889 \end{tabular}%
4890 }% TableII
4891 %
4892 \begin{lrbox}{0}% save TableII for later
4893 \begin{TableII}
4894 }{%
4895 \end{TableII}
4896 \end{lrbox}%
4897 % Check consistency of the played cards
4898 \ODw@ChkSameCards{\ODw@Spades}{\Sp}%
4899 \ODw@ChkSameCards{\ODw@Hearts}{\He}%
4900 \ODw@ChkSameCards{\ODw@Diamonds}{\Di}%
4901 \ODw@ChkSameCards{\ODw@Clubs}{\Cl}%
4902 %
4903 \setcounter{ODw@Cnt}{0}%
4904 \IfBooleanTF#1{\begin{center}}{}%
4905 %
4906 % \end{macrocode}
4907 % We need TableI to show the running trick number. When constructing Table
4908 % II, the total number of tricks that were actually displayed is available
4909 % in counter |ODw@Nr|. So we just need to loop |\theODw@Nr| times and write
4910 % the local counter value |\theODw@Cnt|. To avoid \emph{the extra line
4911 % problem} we use the solution from:\\
4912 % \url{https://tex.stackexchange.com/questions/50296/problem-with-using-loop-inside-the-tabular-environment/142562#142562}
4913 % \begin{macrocode}
4914 %
4915 \begin{tabular}[b]{r}% TableI
4916 \cci{\translate{Nr-(ODw)}}\\[0.3em]
4917 \hline\\[-\ODw@EXtra]%
4918 \setcounter{ODw@Cnt}{1}%
4919 \whiledo{\theODw@Cnt<\theODw@Nr}{%
4920 \theODw@Cnt\\
4921 \stepcounter{ODw@Cnt}%
4922 }%
4923 \theODw@Cnt\\% MUST be outside the loop
4924 % (the extra line problem]!
4925 \end{tabular}%
4926 %
4927 % TableII showing the cards played in the tricks
4928 %
4929 \usebox{0}%
4930 %
4931 % \end{macrocode}
4932 % We use TableIII to show the winning trick counts. These are already stored
4933 % in a CSV-list |\ODw@Scratch|, implemented as a token register. To process
4934 % this list we use |\docsvlist| and must only define our |\do|. As this
4935 % table has 2 columns, we check with |ODw@Nr| that after an item is read,
4936 % we put an \& and after the next item a |\\|.
4937 % \begin{macrocode}
4938 %
4939 \setcounter{ODw@Nr}{0}%
4940 \renewcommand*{\do}[1]{%
4941 \ifnumequal{\value{ODw@Nr}}{2}{\\\setcounter{ODw@Nr}{0}}{}%
4942 \stepcounter{ODw@Nr}%
4943 ##1
4944 \ifnumequal{\value{ODw@Nr}}{2}{}{&}%
4945 }%
4946 \begin{tabular}[b]{|cc}% TableIII
4947 \multicolumn{1}{|c}{%
4948 \cci{\scriptsize\shortstack[c]{\North*!\\\South*!}}} &%
4949 \multicolumn{1}{c}{%
4950 \cci{\scriptsize\shortstack[c]{\East*!\\\West*!}}%
4951 }\\\hline\\[-\ODw@EXtra]%
4952 \expandafter\docsvlist\expandafter{\the\ODw@Scratch}%
4953 \end{tabular}%
4954 \IfBooleanTF#1{\end{center}}{}%
4955 %
4956 }% play
4957 % \end{macrocode}
4958 % \end{environment}
4959 %
4960 % \subsection{Card Diagrams with Bidding}
4961 %
4962 % \begin{macro}{\ODw@CondNewLine}\MacroDef{ODw@CondNewLine}[\oarg{offset}]
4963 % \begin{macrocode}
4964 \NewDocumentCommand\ODw@CondNewLine{O{0em}}{%
4965 % \end{macrocode}
4966 % |\ODw@CondNewLine| forces a newline if the |bidding| diagram does not fit on
4967 % the line, taking into account the width of the card diagram and the width
4968 % of the |bidding| diagram.
4969 % Otherwise the |bidding| diagram appears to the right of the card diagram at
4970 % distance |\ODw@Skip@Width|. We call the global macro
4971 % |\ODw@Diagram@Width| that contains the width of the card diagram. The
4972 % optional parameter of |\ODw@CondNewLine| is used to add some extra
4973 % offset if needed.
4974 %
4975 % \begin{macrocode}
4976 {\ODw@GameFont% needed to relate skips to the font-size
4977 % :\the\ODw@Skip@Width:% JW XXX
4978 \setlength{\ODw@Tmp@Len}{\ODw@Bid@Width}%
4979 \addtolength{\ODw@Tmp@Len}{\ODw@Diagram@Width}%
4980 \addtolength{\ODw@Tmp@Len}{#1}%
4981 \addtolength{\ODw@Tmp@Len}{\ODw@Skip@Width}%
4982 \ifthenelse{\lengthtest{\ODw@Tmp@Len > \textwidth}}{%
4983 \\[1em]}{%
4984 \hspace{\ODw@Skip@Width}%
4985 }%
4986 }%
4987 }% ODw@CondNewLine
4988 % \end{macrocode}
4989 % \end{macro}
4990 %
4991 % \subsection{The Expert Quiz}
4992 %
4993 % \begin{macro}{\expertquiz}\MacroDef{expertquiz}[\Oarg{*!}\oarg{comment}\marg{award}]
4994 % The macro |\expertquiz| displays a hand, a |bidding| diagram and the award
4995 % for the answers. Optionally a description can be added. The hand and the
4996 % bidding have to be defined before. This is done to avoid having 4 more
4997 % arguments, needed for specifying the hand. The token '|*|' centers the
4998 % whole and the token '|!|' forces that the |bidding| diagram appears on a
4999 % new line and that the hand shifts a bit to the right. The last parameter
5000 % defines the award. In order to limit the width of the award we use the
5001 % known widths of the |bidding| diagram and the hand and set the parbox
5002 % accordingly to display the award.
5003 %
5004 % \begin{macrocode}
5005 \NewDocumentCommand\expertquiz{st! O{}m}{%
5006 % 12 3 4
5007 % \end{macrocode}
5008 % |\expertquiz* ![comment]{award}|\\
5009 % | 1 2 3 4 |\\
5010
5011 % \begin{macrocode}
5012 \noindent%
5013 \IfBooleanTF#1{\begin{center}}% "*" detected
5014 {\par\vspace{0.5\baselineskip}}%
5015 \bgroup% keep font changes local (e.g. "\smaller").
5016 \ODw@LegendFont%
5017 \ifx#3\empty\else#3\par\fi%
5018 \egroup%
5019 \IfBooleanTF{#2}{~\hspace*{2em}}{}% "!" detected
5020 \usebox{\ODw@Hand@Box}% display the saved hand
5021 \IfBooleanTF{#2}{}{\quad}% no "!" detected
5022 \setlength\ODw@Tmp@Width{\wd\ODw@BidBox + 1em}%
5023 \IfBooleanTF{#2}%
5024 {\\}%
5025 {\addtolength\ODw@Tmp@Width{\wd\ODw@Hand@Box}}%
5026 \usebox{\ODw@BidBox}% display the saved bidding
5027 \par\vspace{0.3em}%\noindent%
5028 {% keep legendfont and "smaller" local
5029 \ODw@LegendFont%
5030 \smaller%
5031 \IfBooleanTF#1{\bgroup\centering}{}%
5032 \parbox[t]{\ODw@Tmp@Width}{%
5033 \textbf{\ODw@AwardText: }%
5034 \raggedright#4%
5035 }% parbox
5036 \IfBooleanTF#1{\egroup}{}%
5037 }%
5038 % \fi%
5039 \IfBooleanTF#1{\end{center}}{}%
5040 }% expertquiz
5041 % \end{macrocode}
5042 % \end{macro}
5043 %
5044 % \subsection{Resetting the Game}
5045 %
5046 % We use \packname{pgfkeys} with its |<key>=<val>| system to
5047 %specify the fonts and other things that we want to have as defaults,
5048 %rather than the intitial \OneDown values. Therefore we first define the
5049 %keys and the store for it.
5050 %
5051 % \begin{macrocode}
5052 \pgfkeys{%
5053 /ODw/.is family, /ODw,
5054 % fonts
5055 bidder/.store in = \ODw@BidderDefault,
5056 compass/.store in = \ODw@CompassDefault,
5057 game/.store in = \ODw@GameDefault,
5058 legend/.store in = \ODw@LegendDefault,
5059 name/.store in = \ODw@NameDefault,
5060 other/.store in = \ODw@OtherDefault,
5061 % compass
5062 compline/.store in = \ODw@CompLine,
5063 compmid/.store in = \ODw@CompMid,
5064 compsize/.store in = \ODw@CompSize,
5065 }
5066 % compass
5067 \ODw@set{compshow/.is choice}
5068 \ODw@set{compshow/off/.code={\ODw@CompShowfalse}}
5069 \ODw@set{compshow/on/.code={\ODw@CompShowtrue}}
5070 \ODw@set{compturn/.is choice}
5071 \ODw@set{compturn/off/.code={\ODw@CompTurnfalse}}
5072 \ODw@set{compturn/on/.code={\ODw@CompTurntrue}}
5073 % bídding
5074 \ODw@set{bidders/.is choice}
5075 \ODw@set{bidders/off/.code={\ODw@Biddersfalse}}
5076 \ODw@set{bidders/on/.code={\ODw@Bidderstrue}}
5077 \ODw@set{bidfirst/.is choice}
5078 \ODw@set{bidfirst/N/.code=\ODw@FirstBidCol{N}}
5079 \ODw@set{bidfirst/E/.code=\ODw@FirstBidCol{E}}
5080 \ODw@set{bidfirst/S/.code=\ODw@FirstBidCol{S}}
5081 \ODw@set{bidfirst/W/.code=\ODw@FirstBidCol{W}}
5082 \ODw@set{bidline/.is choice}
5083 \ODw@set{bidline/off/.code={\ODw@BidLinefalse}}
5084 \ODw@set{bidline/on/.code={\ODw@BidLinetrue}}
5085 \ODw@set{bidlong/.is choice}
5086 \ODw@set{bidlong/off/.code={\ODw@LongCallsfalse}}
5087 \ODw@set{bidlong/on/.code={\ODw@LongCallstrue}}
5088 % synonyms
5089 \ODw@set{compshow/1/.code={\pgfkeys{/ODw/compshow=on}}}
5090 \ODw@set{compshow/true/.code={\pgfkeys{/ODw/compshow=on}}}
5091 \ODw@set{compturn/1/.code={\pgfkeys{/ODw/compturn=on}}}
5092 \ODw@set{compturn/true/.code={\pgfkeys{/ODw/compturn=on}}}
5093 \ODw@set{bidline/1/.code={\pgfkeys{/ODw/bidline=on}}}
5094 \ODw@set{bidders/true/.code={\pgfkeys{/ODw/bidders=on}}}
5095 \ODw@set{bidders/1/.code={\pgfkeys{/ODw/bidders=on}}}
5096 \ODw@set{bidline/true/.code={\pgfkeys{/ODw/bidline=on}}}
5097 \ODw@set{bidlong/1/.code={\pgfkeys{/ODw/bidlong=on}}}
5098 \ODw@set{bidlong/true/.code={\pgfkeys{/ODw/bidlong=on}}}
5099 %
5100 \ODw@set{compshow/0/.code={\pgfkeys{/ODw/compshow=off}}}
5101 \ODw@set{compshow/false/.code={\pgfkeys{/ODw/compshow=off}}}
5102 \ODw@set{compturn/0/.code={\pgfkeys{/ODw/compturn=off}}}
5103 \ODw@set{compturn/false/.code={\pgfkeys{/ODw/compturn=off}}}
5104 \ODw@set{bidders/0/.code={\pgfkeys{/ODw/bidders=off}}}
5105 \ODw@set{bidders/false/.code={\pgfkeys{/ODw/bidders=off}}}
5106 \ODw@set{bidline/0/.code={\pgfkeys{/ODw/bidline=off}}}
5107 \ODw@set{bidline/false/.code={\pgfkeys{/ODw/bidline=off}}}
5108 \ODw@set{bidlong/0/.code={\pgfkeys{/ODw/bidlong=off}}}
5109 \ODw@set{bidlong/false/.code={\pgfkeys{/ODw/bidlong=off}}}
5110 % \end{macrocode}
5111 %
5112 % \begin{macro}{\resetfonts}\MacroDef{resetfonts}
5113 % \begin{macrocode}
5114 \newcommand\resetfonts{%
5115 \bidderfont{\ODw@BidderDefault}%
5116 \compassfont{\ODw@CompassDefault}%
5117 \gamefont{\ODw@GameDefault}%
5118 \legendfont{\ODw@LegendDefault}%
5119 \namefont{\ODw@NameDefault}%
5120 \otherfont{\ODw@OtherDefault}%
5121 }% resetfonts
5122 % \end{macrocode}
5123 % \end{macro}
5124 %
5125 % \begin{macro}{\setdefaults}\MacroDef{setdefaults}[\Oarg{*}\string{\meta{key1=val1},\meta{key2=val2},\ldots\string}]
5126 % The available keys are those defined in |\pgfkeys| some lines up from
5127 % here. For the fonts they are: |bidder|, |compass|, |game|, |legend|,
5128 % |name| and |other|. They store the new default value in the corresponding
5129 % variable. In order to make the new default active, we must use
5130 % |\setdefaults*| which will also call |\resetfonts|.
5131 %
5132 % The keys for the compass are: |compline|, |compmid|, |compshow|,
5133 % |compsize| and |compturn|. They control the thickness of the frame, the
5134 % mid-text, the visibility of the compass, its size and the angle of the
5135 % compass E--W letters.
5136 %
5137 % For the |bidding| diagram we have: |bidders|, |bidfirst|, |bidline| and
5138 % |bidlong|. They control if bidders are to be displayed at all, which
5139 % bidder appears in the first column, draw a |\hline| below the header and
5140 % showing long calls.
5141 %
5142 % Furthermore defined elsewhere are the keys to control errors |err| and
5143 % warnings |warn|, as well as the key to control the color e.g. of the
5144 % symbols |colors|. Refer to section~\ref{Options}
5145 %
5146 % \begin{macrocode}
5147 \NewDocumentCommand\setdefaults{s m}{%
5148 \pgfkeys{/ODw,#2}%
5149 \IfBooleanTF{#1}{\resetfonts}{}%
5150 }% setdefaults
5151 %
5152 % \end{macrocode}
5153 % \end{macro}
5154 %
5155 % \begin{macro}{\newgame}\MacroDef{newgame}
5156 % |\newgame| resets and clears the stored game information to be ready for
5157 % a new game. We do not reset the option for warn- and err-messages, nor
5158 % any selected font. Setting |\boardnr{0}| executes also:\\
5159 % |\ODw@BoardText{}\vulner[-1]\dealer[-1]}|.
5160 %
5161 % \begin{macrocode}
5162 \newcommand\newgame{%
5163 \boardnr{0}%
5164 \headlinetext{}%
5165 \footlinetext{}%
5166 % clear the left/right upper/lower stuff
5167 \gdef\ODw@LeftUpperText{}%
5168 \gdef\ODw@LeftLowerText{}%
5169 \gdef\ODw@RightUpperText{}%
5170 \gdef\ODw@RightLowerText{}%
5171 % clear the hands
5172 \gdef\ODw@Nhand{\ODw@hand{t}{}{}{}{}}%
5173 \gdef\ODw@Ehand{\ODw@hand{c}{}{}{}{}}%
5174 \gdef\ODw@Shand{\ODw@hand{b}{}{}{}{}}%
5175 \gdef\ODw@Whand{\ODw@hand{c}{}{}{}{}}%
5176 %
5177 % set default for real bidders names: no names
5178 % we print only the symbolic names North, East, etc.
5179 %
5180 \namesNS{}{}\namesEW{}{}%
5181 %
5182 % reset consistency check stuff
5183 %
5184 \gdef\ODw@Spades{}%
5185 \gdef\ODw@Hearts{}%
5186 \gdef\ODw@Diamonds{}%
5187 \gdef\ODw@Clubs{}%
5188 %
5189 \gdef\ODw@NSpades{}\gdef\ODw@ESpades{}%
5190 \gdef\ODw@SSpades{}\gdef\ODw@WSpades{}%
5191 \gdef\ODw@NHearts{}\gdef\ODw@EHearts{}%
5192 \gdef\ODw@SHearts{}\gdef\ODw@WHearts{}%
5193 \gdef\ODw@NDiamonds{}\gdef\ODw@EDiamonds{}%
5194 \gdef\ODw@SDiamonds{}\gdef\ODw@WDiamonds{}%
5195 \gdef\ODw@NClubs{}\gdef\ODw@EClubs{}%
5196 \gdef\ODw@SClubs{}\gdef\ODw@WClubs{}%
5197 %
5198 }% newgame
5199 % \end{macrocode}
5200 % \end{macro}
5201 %
5202 % \subsection{Error Handling}
5203 %
5204 % \subsubsection{Consistency Checks}
5205 %
5206 % We perform different checks on consistency of the cards entered:
5207 % \begin{enumerate}[itemsep=-2mm]
5208 % \item Check that a hand not has more than 13 cards (E)
5209 % \item Check that a hand doesn't contain multiple cards (E)
5210 % \item Check that a deal doesn't contain multiple cards (E)
5211 % \item Check that a hand has less than 13 cards (W)
5212 % \item check that a suit of a deal has more than 13 cards (E)
5213 % \item check that a suit of a deal has less than 13 cards (W)
5214 % \item In |play| diagrams: check that a card is played only once (E)
5215 % \end{enumerate}
5216 % The checks marked with (E) raise an error, those marked with (W) raise
5217 % a warning. They can be controlled with the package options |err| and
5218 % |warn|.
5219 %
5220 % \begin{macro}{\ODw@ChkNrOfCards}\MacroDef{ODw@ChkNrOfCards}[\marg{cards}\marg{hand}]
5221 % \begin{macrocode}
5222 \newcommand\ODw@ChkNrOfCards[2]{%
5223 % \end{macrocode}
5224 % |\ODw@ChkNrOfCards{cards}{hand}|\\
5225 % | 1 2|\\
5226 % |#1 = a string with all cards of all suits of the hand denoted by #2|\\
5227 % |step 1: remove all "-" (that denotes an empty suit)|\\
5228 % |step 2: warn if StrLen < 13 ; Err if StrLen > 13|
5229 %
5230 % \begin{macrocode}
5231 \StrDel{#1}{-}[\ODw@CardStr]% remove voids
5232 \StrLen{\ODw@CardStr}[\ODw@CardLen]%
5233 \ifthenelse{\ODw@CardLen > 13}{%
5234 \ODw@Error{#2 has \ODw@CardLen{} cards}%
5235 }{%
5236 \ifthenelse{\ODw@CardLen < 13}{%
5237 \ODw@Warning{#2 has \ODw@CardLen{} cards}%
5238 }{}%
5239 }%
5240 }% ODw@ChkNrOfCards
5241 % \end{macrocode}
5242 % \end{macro}
5243 %
5244 % \begin{macro}{\ODw@PrErr}\MacroDef{ODw@PrErr}[\marg{rank}\marg{count}\marg{suit}]
5245 % \begin{macrocode}
5246 \newcommand\ODw@PrErr[3]{%
5247 % \end{macrocode}
5248 % |\ODw@PrErr{rank}{count}{suit}|\\
5249 % | 1 2 3|\\
5250 % This macro only outputs the warning/error if the card specified by rank
5251 % (\#1) and suit (\#3) does not occur (denoted by \#2) exactly $1 \times$.
5252 % An exception for spotcards must not be made, because in
5253 % |\ODw@ChkSameCards| they are not taken into account. (In fact they are
5254 % already filtered out by |ODw@translate|).
5255 %
5256 % \begin{macrocode}
5257 \bgroup%
5258 \if#1T\def\ODw@T{10}\else\def\ODw@T{#1}\fi%
5259 \ifthenelse{#2 > 1}{%
5260 \ODw@Error{Card #3\,\ODw@T{} occurs #2 times}%
5261 }{%
5262 \ifthenelse{#2 = 0}{%
5263 \ODw@Warning{Card #3\,\ODw@T{} fails}}{}%
5264 }%
5265 \egroup%
5266 }% ODw@PrErr
5267 % \end{macrocode}
5268 % \end{macro}
5269 %
5270 % \begin{macro}{\ODw@ChkSameCards}\MacroDef{ODw@ChkSameCards}[\marg{cards}\marg{suit}]
5271 % \begin{macrocode}
5272 \newcommand\ODw@ChkSameCards[2]{%
5273 % \end{macrocode}
5274 % |#1 = a string with all cards of 1 suit (denoted by #2) of all hands|\\
5275 % |step 1: remove all "-" |\\
5276 % |step 2: we count the frequency of all ranks 2--9,T,J,Q,K,A| (|ODw@CCnt|)\\
5277 % |step 3: Warn if Freq(card) = 0 ; Err if Freq(card) > 1| (|ODw@PrErr|)\\
5278 %
5279 % \begin{macrocode}
5280 \StrDel{#1}{-}[\ODw@CardStr]%
5281 \StrCount{\ODw@CardStr}{2}[\ODw@CCnt]\ODw@PrErr{2}{\ODw@CCnt}{#2}%
5282 \StrCount{\ODw@CardStr}{3}[\ODw@CCnt]\ODw@PrErr{3}{\ODw@CCnt}{#2}%
5283 \StrCount{\ODw@CardStr}{4}[\ODw@CCnt]\ODw@PrErr{4}{\ODw@CCnt}{#2}%
5284 \StrCount{\ODw@CardStr}{5}[\ODw@CCnt]\ODw@PrErr{5}{\ODw@CCnt}{#2}%
5285 \StrCount{\ODw@CardStr}{6}[\ODw@CCnt]\ODw@PrErr{6}{\ODw@CCnt}{#2}%
5286 \StrCount{\ODw@CardStr}{7}[\ODw@CCnt]\ODw@PrErr{7}{\ODw@CCnt}{#2}%
5287 \StrCount{\ODw@CardStr}{8}[\ODw@CCnt]\ODw@PrErr{8}{\ODw@CCnt}{#2}%
5288 \StrCount{\ODw@CardStr}{9}[\ODw@CCnt]\ODw@PrErr{9}{\ODw@CCnt}{#2}%
5289 \StrCount{\ODw@CardStr}{T}[\ODw@CCnt]\ODw@PrErr{T}{\ODw@CCnt}{#2}%
5290 \StrCount{\ODw@CardStr}{J}[\ODw@CCnt]\ODw@PrErr{J}{\ODw@CCnt}{#2}%
5291 \StrCount{\ODw@CardStr}{Q}[\ODw@CCnt]\ODw@PrErr{Q}{\ODw@CCnt}{#2}%
5292 \StrCount{\ODw@CardStr}{K}[\ODw@CCnt]\ODw@PrErr{K}{\ODw@CCnt}{#2}%
5293 \StrCount{\ODw@CardStr}{A}[\ODw@CCnt]\ODw@PrErr{A}{\ODw@CCnt}{#2}%
5294 }% ODw@ChkSameCards
5295 % \end{macrocode}
5296 % \end{macro}
5297 %
5298 % \subsubsection{Controlling Messages}
5299 %
5300 % \label{Messages}
5301 % \begin{macrocode}
5302 \newbool{ODw@Warnings}
5303 \newbool{ODw@Errors}
5304 %
5305 \ODw@set{warn/off/.code={%
5306 \global\setbool{ODw@Warnings}{false}}}
5307 \ODw@set{warn/on/.code={%
5308 \global\setbool{ODw@Warnings}{true}}}
5309 \ODw@set{err/off/.code={%
5310 \global\setbool{ODw@Errors}{false}}}
5311 \ODw@set{err/on/.code={%
5312 \global\setbool{ODw@Errors}{true}}}
5313 \ODw@set{warn=off}
5314 \ODw@set{err=on}
5315
5316 \ProcessPgfOptions{/ODw}
5317 % \end{macrocode}
5318
5319 % \begin{macro}{\ODw@Error}
5320 % \begin{macrocode}
5321 \newcommand\ODw@Error[1]{%
5322 \ifbool{ODw@Errors}{%
5323 \par\textcolor{red}{Error: #1}\par}{}%
5324 }% ODw@Error
5325 % \end{macrocode}
5326 % \end{macro}
5327 %
5328 % \begin{macro}{\ODw@Warning}
5329 % \begin{macrocode}
5330 \newcommand\ODw@Warning[1]{%
5331 \ifbool{ODw@Warnings}{%
5332 \par\textcolor{blue}{Warning: #1}\par}{}%
5333 }% ODw@Warning
5334 % \end{macrocode}
5335 % \end{macro}
5336 %
5337 % \subsection{Misc Bridge Terms}
5338 %
5339 % \subsubsection{Honour Cards}
5340 %
5341 % These macros retrieve the translations of the 4 alternative forms of the
5342 % honour cards from the |ODw|-dictionary of the active language.
5343 % \noindent
5344 % \begin{macro}{\Ace}
5345 % \begin{macro}{\ace}
5346 % \begin{macrocode}
5347 \NewDocumentCommand{\Ace}{s t!}{%
5348 \bgroup%
5349 %JW \ODw@GameFont%
5350 \IfBooleanTF{#1}{%
5351 \IfBooleanTF{#2}%
5352 {\translate{A-(ODw)}}%
5353 {\translate{Ace-(ODw)}}%
5354 }{%
5355 \IfBooleanTF{#2}%
5356 {\translate{a-(ODw)}}%
5357 {\translate{ace-(ODw)}}%
5358 }%
5359 \egroup%
5360 \xspace%
5361 }% Ace
5362 %
5363 \def\ace{\Ace*!}
5364 % \end{macrocode}
5365 % \end{macro}
5366 % \end{macro}
5367 %
5368 % \begin{macro}{\King}
5369 % \begin{macro}{\king}
5370 % \begin{macrocode}
5371 \NewDocumentCommand{\King}{s t!}{%
5372 \bgroup%
5373 %JW \ODw@GameFont%
5374 \IfBooleanTF{#1}{%
5375 \IfBooleanTF{#2}%
5376 {\translate{K-(ODw)}}%
5377 {\translate{King-(ODw)}}%
5378 }{%
5379 \IfBooleanTF{#2}%
5380 {\translate{k-(ODw)}}%
5381 {\translate{king-(ODw)}}%
5382 }%
5383 \egroup%
5384 \xspace%
5385 }% King
5386 %
5387 \def\king{\King*!}
5388 % \end{macrocode}
5389 % \end{macro}
5390 % \end{macro}
5391 %
5392 % \begin{macro}{\Queen}
5393 % \begin{macro}{\queen}
5394 % \begin{macrocode}
5395 \NewDocumentCommand{\Queen}{s t!}{%
5396 \bgroup%
5397 %JW \ODw@GameFont%
5398 \IfBooleanTF{#1}{%
5399 \IfBooleanTF{#2}%
5400 {\translate{Q-(ODw)}}%
5401 {\translate{Queen-(ODw)}}%
5402 }{%
5403 \IfBooleanTF{#2}%
5404 {\translate{q-(ODw)}}%
5405 {\translate{queen-(ODw)}}%
5406 }%
5407 \egroup%
5408 \xspace%
5409 }% Queen
5410 %
5411 \def\queen{\Queen*!}
5412 % \end{macrocode}
5413 % \end{macro}
5414 % \end{macro}
5415 %
5416 % \begin{macro}{\Jack}
5417 % \begin{macro}{\jack}
5418 % \begin{macrocode}
5419 \NewDocumentCommand{\Jack}{s t!}{%
5420 \bgroup%
5421 %JW \ODw@GameFont%
5422 \IfBooleanTF{#1}{%
5423 \IfBooleanTF{#2}%
5424 {\translate{J-(ODw)}}%
5425 {\translate{Jack-(ODw)}}%
5426 }{%
5427 \IfBooleanTF{#2}%
5428 {\translate{j-(ODw)}}%
5429 {\translate{jack-(ODw)}}%
5430 }%
5431 \egroup%
5432 \xspace%
5433 }% Jack
5434 %
5435 \def\jack{\Jack*!}
5436 % \end{macrocode}
5437 % \end{macro}
5438 % \end{macro}
5439 %
5440 % \begin{macro}{\Ten}
5441 % \begin{macrocode}
5442 \newcommand{\Ten}{%
5443 \bgroup%
5444 %JW \ODw@GameFont%
5445 10%
5446 \egroup%
5447 \xspace%
5448 }% Ten
5449 % \end{macrocode}
5450 % \end{macro}
5451
5452 %
5453 % \subsubsection{Vulnerability}
5454 %
5455 % These macros retrieve the translations of the 4 alternative forms of the
5456 % commands |\All| and |\None| from the |ODw|-dictionary of the active
5457 % language. As there is no short form for them in the English language, we
5458 % just code these entries in the |ODw|-dictionaries with an exclamation
5459 % mark~'|!|'.
5460
5461 % \begin{macro}{\All}
5462 % \begin{macro}{\all}
5463 % \begin{macrocode}
5464 \NewDocumentCommand{\All}{s t!}{%
5465 \bgroup%
5466 \ODw@OtherFont%
5467 \IfBooleanTF{#1}{%
5468 \IfBooleanTF{#2}%
5469 {\translate{All!-(ODw)}}%
5470 {\translate{All-(ODw)}}%
5471 }{%
5472 \IfBooleanTF{#2}%
5473 {\translate{all!-(ODw)}}%
5474 {\translate{all-(ODw)}}%
5475 }%
5476 \egroup%
5477 \xspace%
5478 }% All
5479 %
5480 \def\all{\All*}
5481 % \end{macrocode}
5482 % \end{macro}
5483 % \end{macro}
5484
5485 % \begin{macro}{\None}
5486 % \begin{macro}{\none}
5487 % \begin{macrocode}
5488 \NewDocumentCommand{\None}{s t!}{%
5489 \bgroup%
5490 \ODw@OtherFont%
5491 \IfBooleanTF{#1}{%
5492 \IfBooleanTF{#2}%
5493 {\translate{None!-(ODw)}}%
5494 {\translate{None-(ODw)}}%
5495 }{%
5496 \IfBooleanTF{#2}%
5497 {\translate{none!-(ODw)}}%
5498 {\translate{none-(ODw)}}%
5499 }%
5500 \egroup%
5501 \xspace%
5502 }% None
5503 %
5504 \def\none{\None*}
5505 %% \end{macrocode}
5506 % \end{macro}
5507 % \end{macro}
5508 %
5509 % \subsubsection{Diagram Annotations}
5510 %
5511 % These macros retrieve the translations of the 4 alternative forms of the
5512 % commands |\Contract|, |\Lead|, |\Declarer|, |\Board| and |\Deal| from the
5513 % |ODw|-dictionary of the active language.
5514 %
5515 % \begin{macro}{\Contract}
5516 % \begin{macro}{\contract}
5517 % \begin{macrocode}
5518 \NewDocumentCommand{\Contract}{s t!}{%
5519 \bgroup%
5520 \ODw@OtherFont%
5521 \IfBooleanTF{#1}{%
5522 \IfBooleanTF{#2}%
5523 {\translate{Contr-(ODw)}}%
5524 {\translate{Contract-(ODw)}}%
5525 }{%
5526 \IfBooleanTF{#2}%
5527 {\translate{contr-(ODw)}}%
5528 {\translate{contract-(ODw)}}%
5529 }%
5530 \egroup%
5531 \xspace%
5532 }% Contract
5533 %
5534 \def\contract{\Contract*}
5535 %% \end{macrocode}
5536 % \end{macro}
5537 % \end{macro}
5538 %
5539 % \begin{macro}{\Lead}
5540 % \begin{macro}{\lead}
5541 % \begin{macrocode}
5542 \NewDocumentCommand{\Lead}{s t!}{%
5543 \bgroup%
5544 \ODw@OtherFont%
5545 \IfBooleanTF{#1}{%
5546 \IfBooleanTF{#2}%
5547 {\translate{Lead!-(ODw)}}%
5548 {\translate{Lead-(ODw)}}%
5549 }{% else #1
5550 \IfBooleanTF{#2}%
5551 {\translate{lead!-(ODw)}}%
5552 {\translate{lead-(ODw)}}%
5553 }% #1
5554 \egroup%
5555 \xspace%
5556 }% Lead
5557 %
5558 \def\lead{\Lead*}
5559 %% \end{macrocode}
5560 % \end{macro}
5561 % \end{macro}
5562 %
5563 % \begin{macro}{\Declarer}
5564 % \begin{macro}{\declarer}
5565 % \begin{macrocode}
5566 \NewDocumentCommand{\Declarer}{s t!}{%
5567 \bgroup%
5568 \ODw@OtherFont%
5569 \IfBooleanTF{#1}{%
5570 \IfBooleanTF{#2}%
5571 {\translate{Decl-(ODw)}}%
5572 {\translate{Declarer-(ODw)}}%
5573 }{%
5574 \IfBooleanTF{#2}%
5575 {\translate{decl-(ODw)}}%
5576 {\translate{declarer-(ODw)}}%
5577 }%
5578 \egroup%
5579 \xspace%
5580 }% Declarer
5581 %
5582 \def\declarer{\Declarer*}
5583 %% \end{macrocode}
5584 % \end{macro}
5585 % \end{macro}
5586 %
5587 % \begin{macro}{\by}
5588 % \begin{macrocode}
5589 \newcommand\by{%
5590 \bgroup%
5591 \ODw@OtherFont%
5592 \translate{by-(ODw)}%
5593 \egroup%
5594 \xspace%
5595 }% by
5596 % \end{macrocode}
5597 % \end{macro}
5598 %
5599 % \begin{macro}{\Board}
5600 % \begin{macro}{\board}
5601 % \begin{macrocode}
5602 \NewDocumentCommand{\Board}{s t!}{%
5603 \bgroup%
5604 \ODw@OtherFont%
5605 \IfBooleanTF{#1}{%
5606 \IfBooleanTF{#2}%
5607 {\translate{Brd-(ODw)}}%
5608 {\translate{Board-(ODw)}}%
5609 }{%
5610 \IfBooleanTF{#2}%
5611 {\translate{brd-(ODw)}}%
5612 {\translate{board-(ODw)}}%
5613 }%
5614 \egroup%
5615 \xspace%
5616 }% Board
5617 %
5618 \def\board{\Board*}
5619 %% \end{macrocode}
5620 % \end{macro}
5621 % \end{macro}
5622 %
5623 % \begin{macro}{\Deal}
5624 % \begin{macro}{\deal}
5625 % \begin{macrocode}
5626 \NewDocumentCommand{\Deal}{s t!}{%
5627 \bgroup%
5628 \ODw@OtherFont%
5629 \IfBooleanTF{#1}{%
5630 \IfBooleanTF{#2}%
5631 {\translate{Deal!-(ODw)}}%
5632 {\translate{Deal-(ODw)}}%
5633 }{%
5634 \IfBooleanTF{#2}%
5635 {\translate{deal!-(ODw)}}%
5636 {\translate{deal-(ODw)}}%
5637 }%
5638 \egroup%
5639 \xspace%
5640 }% Deal
5641 %
5642 \def\deal{\Deal*}
5643 %% \end{macrocode}
5644 % \end{macro}
5645 % \end{macro}
5646 % \begin{macro}{\doubled}
5647 % The commands |\doubled| and |\redoubled| do not have a short form.
5648 % \begin{macrocode}
5649 \NewDocumentCommand{\doubled}{s}{%
5650 \bgroup%
5651 \ODw@OtherFont%
5652 \IfBooleanTF{#1}{%
5653 \translate{Doubled-(ODw)}}{%
5654 \translate{doubled-(ODw)}%
5655 }%
5656 \egroup%
5657 \xspace%
5658 }% doubled
5659 % \end{macrocode}
5660 % \end{macro}
5661 %
5662 % \begin{macro}{\redoubled}
5663 % \begin{macrocode}
5664 \NewDocumentCommand{\redoubled}{s}{%
5665 \bgroup%
5666 \ODw@OtherFont%
5667 \IfBooleanTF{#1}{%
5668 \translate{Redoubled-(ODw)}}{%
5669 \translate{redoubled-(ODw)}%
5670 }%
5671 \egroup%
5672 \xspace%
5673 }% redoubled
5674 % \end{macrocode}
5675 % \end{macro}
5676 %
5677 % \subsubsection{Point Units}
5678 %
5679 % These macros retrieve the translations of the commands |\hpts|, |\lpts|,
5680 % |\dpts| and |\tpts| from the |ODw|-dictionary of the active language.
5681 % \begin{macro}{\hpts}
5682 % \begin{macro}{\HCP}
5683 % \begin{macrocode}
5684 \NewDocumentCommand{\hpts}{s t!}{%
5685 \bgroup%
5686 \ODw@OtherFont%
5687 \IfBooleanTF{#1}{%
5688 \IfBooleanTF{#2}%
5689 {\translate{HCP-(ODw)}}%
5690 {\translate{High Card Points-(ODw)}}%
5691 }{%
5692 \IfBooleanTF{#2}%
5693 {\translate{hcp-(ODw)}}%
5694 {\translate{high card points-(ODw)}}%
5695 }%
5696 \egroup%
5697 \xspace%
5698 }% High Card Points
5699 %
5700 \def\HCP{\,\hpts*!}
5701 % \end{macrocode}
5702 % \end{macro}
5703 % \end{macro}
5704 %
5705 % \begin{macro}{\lpts}
5706 % \begin{macro}{\LP}
5707 % \begin{macro}{\HLP}
5708 % \begin{macrocode}
5709 \NewDocumentCommand{\lpts}{s t!}{%
5710 \bgroup%
5711 \ODw@OtherFont%
5712 \IfBooleanTF{#1}{%
5713 \IfBooleanTF{#2}%
5714 {\translate{LP-(ODw)}}%
5715 {\translate{Length Points-(ODw)}}%
5716 }{%
5717 \IfBooleanTF{#2}%
5718 {\translate{lp-(ODw)}}%
5719 {\translate{length points-(ODw)}}%
5720 }%
5721 \egroup%
5722 \xspace%
5723 }% Length Points
5724 %
5725 \def\LP{\,\lpts*!}
5726 \def\HLP{\,\bgroup\ODw@OtherFont\translate{HLP-(ODw)}\egroup\xspace}
5727 % \end{macrocode}
5728 % \end{macro}
5729 % \end{macro}
5730 % \end{macro}
5731 %
5732 % \begin{macro}{\dpts}
5733 % \begin{macro}{\DP}
5734 % \begin{macrocode}
5735 \NewDocumentCommand{\dpts}{s t!}{%
5736 \bgroup%
5737 \ODw@OtherFont%
5738 \IfBooleanTF{#1}{%
5739 \IfBooleanTF{#2}%
5740 {\translate{DP-(ODw)}}%
5741 {\translate{Distribution Points-(ODw)}}%
5742 }{%
5743 \IfBooleanTF{#2}%
5744 {\translate{dp-(ODw)}}%
5745 {\translate{distribution points-(ODw)}}%
5746 }%
5747 \egroup%
5748 \xspace%
5749 }% Distribution Points
5750 %
5751 \def\DP{\,\dpts*!}
5752 % \end{macrocode}
5753 % \end{macro}
5754 % \end{macro}
5755 %
5756 % \begin{macro}{\tpts}
5757 % \begin{macro}{\TP}
5758 % \begin{macrocode}
5759 \NewDocumentCommand{\tpts}{s t!}{%
5760 \bgroup%
5761 \ODw@OtherFont%
5762 \IfBooleanTF{#1}{%
5763 \IfBooleanTF{#2}%
5764 {\translate{TP-(ODw)}}%
5765 {\translate{Total Points-(ODw)}}%
5766 }{%
5767 \IfBooleanTF{#2}%
5768 {\translate{tp-(ODw)}}%
5769 {\translate{total points-(ODw)}}%
5770 }%
5771 \egroup%
5772 \xspace%
5773 }% Total Points
5774 %
5775 \def\TP{\,\tpts*!}
5776 % \end{macrocode}
5777 % \end{macro}
5778 % \end{macro}
5779 %
5780 % \subsubsection{Forcings}
5781 %
5782 % These macros retrieve the translations of the commands |\gforce|,
5783 % |\sforce|, |\nmforce|, |\tsforce| and |\fsforce| from the
5784 % |ODw|-dictionary of the active language.
5785 % \begin{macro}{\gforce}
5786 % \begin{macro}{\GF}
5787 % \begin{macrocode}
5788 \NewDocumentCommand{\gforce}{s t!}{%
5789 \bgroup%
5790 \ODw@OtherFont%
5791 \IfBooleanTF{#1}{%
5792 \IfBooleanTF{#2}%
5793 {\translate{GF-(ODw)}}%
5794 {\translate{Game Forcing-(ODw)}}%
5795 }{%
5796 \IfBooleanTF{#2}%
5797 {\translate{gf-(ODw)}}%
5798 {\translate{game forcing-(ODw)}}%
5799 }%
5800 \egroup%
5801 \xspace%
5802 }% Game Forcing
5803 %
5804 \def\GF{\gforce*!}
5805 % \end{macrocode}
5806 % \end{macro}
5807 % \end{macro}
5808 %
5809 % \begin{macro}{\sforce}
5810 % \begin{macro}{\SF}
5811 % \begin{macrocode}
5812 \NewDocumentCommand{\sforce}{s t!}{%
5813 \bgroup%
5814 \ODw@OtherFont%
5815 \IfBooleanTF{#1}{%
5816 \IfBooleanTF{#2}%
5817 {\translate{SF-(ODw)}}%
5818 {\translate{Semi Forcing-(ODw)}}%
5819 }{%
5820 \IfBooleanTF{#2}%
5821 {\translate{sf-(ODw)}}%
5822 {\translate{semi forcing-(ODw)}}%
5823 }%
5824 \egroup%
5825 \xspace%
5826 }% Semi Forcing
5827 %
5828 \def\SF{\sforce*!}
5829 % \end{macrocode}
5830 % \end{macro}
5831 % \end{macro}
5832 %
5833 % \begin{macro}{\nmforce}
5834 % \begin{macro}{\NMF}
5835 % \begin{macrocode}
5836 \NewDocumentCommand{\nmforce}{s t!}{%
5837 \bgroup%
5838 \ODw@OtherFont%
5839 \IfBooleanTF{#1}{%
5840 \IfBooleanTF{#2}%
5841 {\translate{NMF-(ODw)}}%
5842 {\translate{New Minor Forcing-(ODw)}}%
5843 }{%
5844 \IfBooleanTF{#2}%
5845 {\translate{nmf-(ODw)}}%
5846 {\translate{new minor forcing-(ODw)}}%
5847 }%
5848 \egroup%
5849 \xspace%
5850 }% New Minor Forcing
5851 %
5852 \def\NMF{\nmforce*!}
5853 % \end{macrocode}
5854 % \end{macro}
5855 % \end{macro}
5856 %
5857 % \begin{macro}{\tsforce}
5858 % \begin{macro}{\TSF}
5859 % \begin{macrocode}
5860 \NewDocumentCommand{\tsforce}{s t!}{%
5861 \bgroup%
5862 \ODw@OtherFont%
5863 \IfBooleanTF{#1}{%
5864 \IfBooleanTF{#2}%
5865 {\translate{TSF-(ODw)}}%
5866 {\translate{Third Suit Forcing-(ODw)}}%
5867 }{%
5868 \IfBooleanTF{#2}%
5869 {\translate{tsf-(ODw)}}%
5870 {\translate{third suit forcing-(ODw)}}%
5871 }%
5872 \egroup%
5873 \xspace%
5874 }% Third Suit Forcing
5875 %
5876 \def\TSF{\tsforce*!}
5877 % \end{macrocode}
5878 % \end{macro}
5879 % \end{macro}
5880 %
5881 % \begin{macro}{\fsforce}
5882 % \begin{macro}{\FSF}
5883 % \begin{macrocode}
5884 \NewDocumentCommand{\fsforce}{s t!}{%
5885 \bgroup%
5886 \ODw@OtherFont%
5887 \IfBooleanTF{#1}{%
5888 \IfBooleanTF{#2}%
5889 {\translate{FSF-(ODw)}}%
5890 {\translate{Fourth Suit Forcing-(ODw)}}%
5891 }{%
5892 \IfBooleanTF{#2}%
5893 {\translate{fsf-(ODw)}}%
5894 {\translate{fourth suit forcing-(ODw)}}%
5895 }%
5896 \egroup%
5897 \xspace%
5898 }% Fourth Suit Forcing
5899 %
5900 \def\FSF{\fsforce*!}
5901 % \end{macrocode}
5902 % \end{macro}
5903 % \end{macro}
5904 %
5905 % \subsection{Initialization}\label{Init}
5906 %
5907 % It's time to prepare everything. We clear the game and set the defaults.
5908 % \begin{macrocode}
5909 \newgame
5910 % \end{macrocode}
5911 % Set the default fonts
5912 % \begin{macrocode}
5913 \setdefaults{bidder=\mdseries\sffamily}
5914 \setdefaults{compass=\mdseries\sffamily}
5915 \setdefaults{game=\bfseries\sffamily}
5916 \setdefaults{legend=\mdseries\rmfamily}
5917 \setdefaults{name=\mdseries\slshape}
5918 \setdefaults*{other=\bfseries\sffamily}
5919 % \end{macrocode}
5920 %
5921 % Set default coloring to black and red
5922 % \begin{macrocode}
5923 \setdefaults{colors=b+r}
5924 % \end{macrocode}
5925 %
5926 % Set the compass
5927 % \begin{macrocode}
5928 \setdefaults{compshow=on,compturn=off}
5929 % \end{macrocode}
5930 % set the start column for bidding (West is recommended) and the long form.
5931 % \begin{macrocode}
5932 \setdefaults{bidfirst=W,bidders=on,bidlong=on}
5933 % \end{macrocode}
5934 % Now we load the dictionaries for the languages that are to be used in
5935 % the document. We use \packname{tracklang} to iterate over all the
5936 % document languages and load the corresponding |ODw|-dictionaries.
5937 % \iffalse
5938 % Due to
5939 % an inconsistency between \packname{babel} and \packname{translations}
5940 % with respect to the Norwegian language (\packname{babel} calls this
5941 % language \emph{norsk} whereas \packname{translations} insist on using
5942 % \emph{norwegian}, we redefine |\thislang| to the latter if it happens to
5943 % be \emph{norsk}.
5944 % \fi
5945 % \begin{macrocode}
5946 %\AtBeginDocument{%
5947 \usedictionary{ODw}
5948 %%%%
5949 \ForEachTrackedLanguage{\thislang}{%
5950 \PackageInfo{ODw}{Language \thislang\ detected}%
5951 %
5952 % Commented out due to translator
5953 % \ifthenelse{\equal{\thislang}{norsk}}%
5954 % {\def\thislang{norwegian}}{}%
5955 %
5956 \IfEqCase{\thislang}{%
5957 {danish}{\IfFileExists{ODw-Danish.dict}%
5958 {\uselanguage{Danish}%
5959 \PackageInfo{ODw}{Dictionary ODw-Danish.dict loaded}
5960 }{\PackageWarning{ODw}{Dictionary ODw-Danish.dict missing}}}%
5961 %
5962 {dutch}{\IfFileExists{ODw-Dutch.dict}%
5963 {\uselanguage{Dutch}%
5964 \PackageInfo{ODw}{Dictionary ODw-Dutch.dict loaded}
5965 }{\PackageWarning{ODw}{Dictionary ODw-Dutch.dict missing}}}%
5966 %
5967 {english}{\IfFileExists{ODw-English.dict}%
5968 {\uselanguage{English}%
5969 \PackageInfo{ODw}{Dictionary ODw-English.dict loaded}
5970 }{\PackageWarning{ODw}{Dictionary ODw-English.dict missing}}}%
5971 %
5972 {french}{\IfFileExists{ODw-French.dict}%
5973 {\uselanguage{French}%
5974 \PackageInfo{ODw}{Dictionary ODw-French.dict loaded}
5975 }{\PackageWarning{ODw}{Dictionary ODw-French.dict missing}}}%
5976 %
5977 {german}{\IfFileExists{ODw-German.dict}%
5978 {\uselanguage{German}%
5979 \PackageInfo{ODw}{Dictionary ODw-German.dict loaded}
5980 }{\PackageWarning{ODw}{Dictionary ODw-German.dict missing}}}%
5981 %
5982 {italian}{\IfFileExists{ODw-Italian.dict}%
5983 {\uselanguage{Italian}%
5984 \PackageInfo{ODw}{Dictionary ODw-Italian.dict loaded}
5985 }{\PackageWarning{ODw}{Dictionary ODw-Italian.dict missing}}}%
5986 %
5987 {norsk}{\IfFileExists{ODw-Norsk.dict}%
5988 {\uselanguage{Norsk}%
5989 \PackageInfo{ODw}{Dictionary ODw-Norsk.dict loaded}
5990 }{\PackageWarning{ODw}{Dictionary ODw-Norsk.dict missing}}}%
5991 %
5992 {spanish}{\IfFileExists{ODw-Spanish.dict}%
5993 {\uselanguage{Spanish}%
5994 \PackageInfo{ODw}{Dictionary ODw-Spanish.dict loaded}
5995 }{\PackageWarning{ODw}{Dictionary ODw-Spanish.dict missing}}}%
5996 %
5997 {swedish}{\IfFileExists{ODw-Swedish.dict}%
5998 {\uselanguage{Swedish}%
5999 \PackageInfo{ODw}{Dictionary ODw-Swedish.dict loaded}
6000 }{\PackageWarning{ODw}{Dictionary ODw-Swedish.dict missing}}}%
6001 %
6002 {turkish}{\IfFileExists{ODw-Turkish.dict}%
6003 {\uselanguage{Turkish}%
6004 \PackageInfo{ODw}{Dictionary ODw-Turkish.dict loaded}
6005 }{\PackageWarning{ODw}{Dictionary ODw-Turkish.dict missing}}}%
6006 %
6007 }[%
6008 \PackageWarning{ODw}%
6009 {Language \thislang\space not supported by OneDown}
6010 ]% IfEqCase
6011 %
6012 }% ForEach
6013 %%%%%
6014 %}% AtBeginDocument
6015 % Look if we can find a file called onedown.symbols somewhere in the \LaTeX-path
6016 % If so, we load it (the code for inputting card symbols directly from keyboard).
6017 % If not, we keep silent about it
6018 \@input{onedown.symbols}
6019 %
6020 % \end{macrocode}
6021 % That's it folks, happy \TeX ing!
6022 % \begin{macrocode}
6023 \endinput% onedown.sty
6024 % \end{macrocode}
6025
6026 %
6027 % \iffalse
6028 %</package>
6029 % \fi
6030 %
6031 % \Finale
6032 % \begin{thebibliography}{Laan}
6033 % \bibitem{Laan} Kees van der Laan:
6034 % \emph{Typsetting Bridge via \TeX},
6035 % TUGboat Vol.~11, No.~2 (1990), p265ff
6036 %
6037 % \bibitem{Pav} Richard Pavlicek:
6038 % \emph{Bridge Writing Style Guide},
6039 % \url{http://www.rpbridge.net/7z69.htm}
6040 % \end{thebibliography}
6041 %
6042 % \PrintChanges
6043 % \newpage
6044 % \PrintIndex
6045 % \ifnumequal{\pdfshellescape}{1}{%
6046 % \newpage
6047 % \enlargethispage{1\baselineskip}
6048 % \immediate\closeout\UCFile
6049 % \begin{multicols}{3}[\section{List of User Commands}]
6050 %
6051 % \IfFileExists{\jobname.odw}
6052 % {\noindent\input{\jobname.odw}}
6053 % {\PackageWarning{ODw}{File \jobname.odw not found}}
6054 % \end{multicols}
6055 % }{}
6056 \endinput