% \iffalse meta-comment
%
% Copyright (C) 2018 by Jacob Wiersma <jack46@online.de>
% ---------------------------------------------------------------------------
% This work may be distributed and/or modified under the
% conditions of the LaTeX Project Public License, either version 1.3
% of this license or (at your option) any later version.
% The latest version of this license is in
%   http://www.latex-project.org/lppl.txt
% and version 1.3 or later is part of all distributions of LaTeX
% version 2005/12/01 or later.
%
% This work has the LPPL maintenance status `maintained'.
%
% The Current Maintainer of this work is Jacob Wiersma.
%
% This work consists of the files onedown.dtx and onedown.ins
% and the derived filebase onedown.sty.
%
% \fi
%
% \iffalse
%<*driver>
\ProvidesFile{onedown.dtx}
%</driver>
%<package>\NeedsTeXFormat{LaTeX2e}[2014/05/01]
%<package>\def\ODwstyleversion{1.4}\def\ODwstyledate{2019/10/15}
%<package>\ProvidesPackage{onedown}
%<package> [\ODwstyledate\space v\ODwstyleversion\space 
%<package> Typeset Bridge Diagrams - Jacob Wiersma (C) 2016-2019]
%
%<*driver>
%\documentclass[a4paper,12pt,draft]{ltxdoc}% with draft no hyperrefs
\documentclass[a4paper,12pt]{ltxdoc}
% the package |shortvrb| is auto-loaded, providing |...| as shorthand 
\usepackage[utf8]{inputenc}
%
\usepackage[T1]{fontenc}
\usepackage[german,dutch,french,swedish,english,shorthands=]{babel}
\usepackage{onedown}[2019/10/15]
\usepackage[normalem]{ulem}%   for strikeout todos that are done
\usepackage{needspace}%        keep contiguous lines on one page
\usepackage[inline]{enumitem}% Control various parameters of lists
\usepackage{titlesec}
\usepackage{verbatimbox}%      For env. verbnobox (set font)
%\usepackage[hyphens]{url}%    for typesetting URLs
\setcounter{secnumdepth}{4}
\titleformat{\paragraph}{\normalfont\normalsize\bfseries}{\theparagraph}{1em}{}
\titlespacing*{\paragraph}{0pt}{3.25ex plus 1ex minus .2ex}{1.5ex plus .2ex}
\usepackage[numbered]{hypdoc}
%
% add '-' and '/' to the list of URL break characters
% '/' won't work!
%
\expandafter\def\expandafter\UrlBreaks\expandafter{\UrlBreaks\do\-\do/\do\/}
%
% Set a nice color for \MacroDef and \EnvDef.
% But not if we want a printout on a monochrome printer
%

\newboolean{NoColor}% to suppress all colors

\AtBeginDocument{%
\ifNoColor
  \setdefaults{colors=b+w}
  \hypersetup{linkcolor=black,urlcolor=black}
  \def\ODwcolor{black}
  \definecolor{defbackgr}{rgb}{1,1,1}
  \definecolor{optbackgr}{named}{lightgray}
\else
  \def\ODwcolor{red}
  \definecolor{defbackgr}{rgb}{1,1,0.75}
  \definecolor{optbackgr}{named}{lime}
\fi
}%
%
\newlength\defwidth
%
% We need to typeset optional args without \meta too!
%\newcommand\Oarg[1]{{\ttfamily[}#1{\ttfamily]}}
\newcommand\Oarg[1]{\colorbox{optbackgr}{\textbf{#1}}}
%
\NewDocumentCommand\MacroDef{st+mO{}}{%
% \MacroDef* + {macroname}[args]
%          1 2      3       4
% #1 flags if macroname is multi-lingual
% #2 flags if macroname is put in the list of user commands
% #3 is the macroname that we describe
% #4 are the possible args of macroname
%
 \bgroup
  \IfBooleanTF#2{\usercom{#3}}{}%
  \setlength{\fboxsep}{4pt}\setlength{\fboxrule}{1.25pt}%
  \setlength\defwidth\linewidth%
  \addtolength\defwidth{-2\fboxrule}%
  \addtolength\defwidth{-2\fboxsep}%
  \fcolorbox{black}{defbackgr}{%
     \makebox[\defwidth][l]{%
       \IfBooleanTF#1{\ML}{}%
       \texttt{\footnotesize\bs#3#4}%
     }%
  }%
  \par\vspace{0.5\baselineskip}\noindent%
 \egroup
}% MacroDef
%
\NewDocumentCommand\EnvDef{st+mO{}}{%
% \EnvDef*  + {env-name}[args]
%       #1 #2     #3    #4
% #1 flags if env-name is multi-lingual
% #2 flags if env-name is put in the list of user commands
% #3 is the env-name that we describe
% #4 are the possible args of env-name
%
 \bgroup
  \IfBooleanTF#2{\usercom[]{#3 (env)}}{}%
  \setlength{\fboxsep}{4pt}\setlength{\fboxrule}{1.25pt}%
  \setlength\defwidth\linewidth%
  \addtolength\defwidth{-2\fboxrule}%
  \addtolength\defwidth{-2\fboxsep}%
  \fcolorbox{black}{defbackgr}{%
     \makebox[\defwidth][l]{%
       \IfBooleanTF#1{\ML}{}%
       \texttt{\footnotesize\bs begin\string{#3\string}#4\ldots\bs end\string{#3\string}}
     }%
  }%
  \par\vspace{0.5\baselineskip}\noindent%
 \egroup
}% EnvDEf
%
%
% Special processing of user commands
%
% We supply command NAMES, so we must add the \ afterwards, to make it look
% like a real command in the index
%
\newcommand\bs{%
  \texttt{%
    \upshape% the itshape of meta screws the backslash
    \textbackslash%
  }%
}% bs
%
% \usercom gets the NAME of a command (without \), labels the actual
% position and inserts the appropriate hyperref index entry in the UCFile,
% whilst adding the \ before the command name.
%
\newcommand\usercom[2][\noexpand\bs]{%
  \ifnumequal{\pdfshellescape}{1}{%
    % restricted shell enabled
    \label{#2}%
    \immediate\write\UCFile{%
      \noexpand\hyperref[#2]{%
        #1#2, \thepage\noexpand\newline%
      }%
    }%
  }{}%
}% usercom
%
% We write the user commands (on the fly sorted) in file onedown.odw.
% We must disable | first and enable it again afterwards
%
\ifnumequal{\pdfshellescape}{1}{%
  \newwrite\UCFile
  \DeleteShortVerb{\|}
  \immediate\openout\UCFile="| sort -d > \jobname.odw
  \MakeShortVerb{\|}
}{}
%
% Used to mark MultiLingual macros
%
\newcommand\ML{\textcolor{\ODwcolor}{\textsc{\tiny ML}}\xspace}
%
% Typeset package names 
%
\newcommand\packname[1]{\texttt{#1}\xspace}
%
% Write our own package name a bit special
%
\newcommand\OneDown{\textcolor{\ODwcolor}{\smaller\bfseries\textsc{OneDown}}\xspace}
%
% We translate our multilingual examples
%
\NewDocumentCommand\Translate{smO{german}}{%
  \let\xspaceODwold=\xspace%
  \def\xspace{}%
  \foreignlanguage{#3}{%
    \IfBooleanTF#1{\GetTranslation{#2-(ODw)}}{#2}%
  }%
  \let\xspace=\xspaceODwold%
}% Translate
%
% Put a frame surrounding examples
%
\newcommand\example[1]{\fbox{#1}}
%
% End of user-command 
%
\setdefaults*{game=\sffamily\bfseries\footnotesize,%
              other=\sffamily\bfseries\footnotesize}

\AtBeginDocument{\CodelineIndex
  \EnableCrossrefs}
\AtBeginDocument{\RecordChanges}
\extrafloats{100}
\begin{document}
  \DocInput{onedown.dtx}
\end{document}
%</driver>
% \fi
%
% \CheckSum{3771}
%
% \CharacterTable
%  {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
%   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
%   Digits        \0\1\2\3\4\5\6\7\8\9
%   Exclamation   \!     Double quote  \"     Hash (number) \#
%   Dollar        \$     Percent       \%     Ampersand     \&
%   Acute accent  \'     Left paren    \(     Right paren   \)
%   Asterisk      \*     Plus          \+     Comma         \,
%   Minus         \-     Point         \.     Solidus       \/
%   Colon         \:     Semicolon     \;     Less than     \<
%   Equals        \=     Greater than  \>     Question mark \?
%   Commercial at \@     Left bracket  \[     Backslash     \\
%   Right bracket \]     Circumflex    \^     Underscore    \_
%   Grave accent  \`     Left brace    \{     Vertical bar  \|
%   Right brace   \}     Tilde         \~}
%
% ^^A Commands to be used for the documentations only
%
% \makeatletter
%   \def\CP{\ODw@Compass}
%   \def\Xfer#1{\ODw@Xfer{#1}}
% \makeatother

%
% ^^A We are onedown now with new versioning!
%
% \changes{v0.1}{2018/01/28}{\\
% - Reorganized the bzr versioning. bzr will contain only onedown, the
% former bidnplay stuff is archived. The ToDo and Known-Bugs lists are
% cleaned. \\
% - We are version 0.1 now, trying to keep the bzr version number equal to
% the changes minor number.}
%
% \changes{v0.2}{2018/02/12}{\\
% - We finally have a List of User Commands. \\
% - In the compass we can print vulner in red and mark the dealer. We have
% a hook \cmd{\CompassMid} to write something in the middle of the
% compass.\\
% - Added several macros to auto-translate common stuff like 'lead' etc.\\
% - Added the danish language. \\
% - Corrected a bug in \cmd{\dealer} and \cmd{\vulner}.\\
% - Removed pgf-key 'lang': we now load the needed languages on the fly.\\
% - Finally we revised the documentation.}
%
% \changes{v0.4}{2018/03/09}{\\
% - Major change in playtricks: the winner is now determined by the cards
% played, and code is added to check consistency.\\
% - Dirty coded macros like \cmd{\ODw@symbol} and \cmd{\ODw@(@)Card(s)} are
% replaced by neat expl3 code.\\
% - We load necesary dictionaries automatically on the fly and enhanced the
% colors options.\\
% - Corrected some minor bugs and reorganized the documentation. \\
% - One can now also generate the documentation without the list of user
% commands}
%
% \changes{v0.5}{2018/03/14}{\\
% - Associated the names and bidders in a fixed way.\\
% - Added checks to onesuitNS/EW.\\
% - Made ODw@OtherFont local where necessary.\\
% - Redefined columntypes.\\
% - Made 'T' a code for '10'.\\
% - Adapted the 'translate' macro to enable both 1H and 1\cmd{\He} etc. \\
% - Enhanced the documentation.}
%
% \changes{v0.6}{2018/03/14}{\\
% - Made all internal names hidden by adding 'ODw@' to it.\\
% - Changed \cmd{\ODw@AccTricksN} in \cmd{\ODw@AccTricks}.\\
% - Some minor adaptions of the documentation}
%
% \changes{v0.7}{2018/03/20}{\\
% - Final(?) edits of the documentation: Consequent use of 'card diagram',
% 'bidding' diagram and 'play diagram'. \\
% - Corrected some minor bugs. \\
% - Changed the name of the 'playtricks' environment into 'play'.\\
% - Can now disable all colors in the manual for monochrome printing.\\
% - Changed signature of \cmd{\expertquiz} and \cmd{\boardtext}.}
%
% \changes{v0.7a}{2018/03/24}{\\
% - Major change: Removed all \cmd{\bidXX} and \cmd{\bidXXpair} commands.\\
% - The biddings can now be shown with \cmd{\showXX+} (with token '\texttt{+}').\\
% - The macros \cmd{\hand-} and the bidding environments suppress their
% output with token '\texttt{-}'}
%
% \changes{v0.8}{2018/04/11}{\\
% - Added package \packname{verbatimbox} to adjust verbatim font easily.\\
% - Added \cmd{\setdefaults} with keys for fonts, compass and bidding
% diagrams.\\
% - Made \cmd{\FirstBidCol} internally hidden.\\
% - Removed \cmd{\longcalls}, \cmd{\CompassMid}, added \cmd{\compassfont}.\\
% - Changed the order of the hands in \cmd{\onesuitAll}.\\
% - Renewed the implementation of the compass and added extra features.}
%
% \changes{v0.9}{2018/04/15}{\\
% - Adapted \cmd{\ODwset} and \cmd{\setdefaults}.\\
% - Separated key \emph{messages} into keys \emph{warn} and \emph{err}.\\
% - Adapted \cmd{\ODw@Compass}. \\
% - Removed legends from \cmd{\showNS}.\\
% - Added \cmd{\sbox1} to all \cmd{\showXX} macros with a N-hand.\\
% - Changed ODw@[No]Warnings and ODw@[No]Errors.\\
% - Corrected some minor bugs and adapted the documentation accordingly.}
%
% \changes{v1.0}{2018/05/23}{\\
% - Adapted the urls, the directories and some filenames to conform to the
% CTAN-standard and made the bundle ready for upload. \\
% - Corrected a small bug in \cmd{\ODw@Compass} that was introduced in
% v0.9.\\
% - Made all relevant text-writing macros in 4 versions with/without tokens
% '*' and '^^21'.\\
% - Corrected a sizing/font bug.\\
% - Added 4 variants of many other text-writing macros, onesuit-NE/NW/.\\
% - Adapted \cmd{\handskip}. \\
% - Added code to work-around a \packname{babel}-\packname{translations}
% inconsistency w.r.t.  norsk/norwegian.}
%
% \changes{v1.1}{2018/09/22}{\\
% - Corrected onedown-ref.tex\\
%    . Added the missing rows in lines 419-422.\\
%    . and the explanational text on line 457.\\
% - Changed in all ODw*.trsl files: The translation of 'pass!' into 'p' and
% 'Pass!' into 'P'.\\
% - Corrected some typos in ShowAll.tex:\\
%    . \cmd{\contract*} into \cmd{\contract},\\
%    . \cmd{\declarer*} into \cmd{\declarer} and\\
%    . \cmd{\lead*} into \cmd{\lead}.\\
% - Removed some illegal chars from changes entries.}
% \changes{v1.2a}{2018/10/10}{\\
% - Enhanced the documention (both onedown.dtx and onedown-ref.tex: The
%   command tokens are no longer shown as '[*^^21]', but as '*^^21' with a
%   different background color.\\
% - Added a thinspace ('\cmd{\,}') before all points counts (HCP, LP, DP
% and TP)\\
% - Improved \cmd{\alert} by using \cmd{\textasteriskcentered} rather than
% just a '*'\\
% - The changes history has a better layout now \\
% - \cmd{\showNS} and \cmd{\showEW} now can selectively display only the N-
% or S-hand, resp the E- or W-hand.}
% \changes{v1.2b}{2018/10/31}{\\
% - Corrected a bug: Added \cmd{\ODw@monochromefalse} in all
% initializations of multi colors in \cmd{\ODw@set}\\
% - Made all relevant setdefaults settings (like bidfirst) non-global\\
% - Made all \cmd{\ODw@BidderX} and \cmd{\ODw@NameX} non-global\\
% - Removed '\cmd{\global}' from \cmd{\ODw@CompShow} (false and true),
% \cmd{\ODw@CompTurn}, \cmd{\ODw@Bidders}, \cmd{\ODw@BidLine} and
% \cmd{\ODw@LongCalls}\\
% - In command \cmd{\suit} changed 'JW   \cmd{\ODw@GameSize}' into
% '\cmd{\ODw@GameSize}'}
% \changes{v1.3a}{2019/02/21}{\\
% - Added \cmd{\HLP} \\
% - Changed/Added in all relevant ODw-lang.trsl: \\
%    - 'V0.4' into 'V0.4-2018/12/01' \\
%    - 'FP' into 'F' , 'fp' into 'f' (entry HCP/hcp) \\
%    - 'Figuren-Punkte' into 'Figurenpunkte' , 'figuren-punkte' into 'figurenpunkte' \\
%    - 'FL' into 'L' , 'f{}l' into 'l' \\
%    - \cmd{\NewDictTranslation\\ \{HLP-(ODw)\}\{FL\}} (german)
% }
% \changes{v1.3b}{2019/03/16}{\\
% - Added setdefaults to the list of User Commands \\
% - Corrected \cmd{\setdefaults} in onedown-examples: \\
%   - changed  [~] into \{\} \\
%   - Adapted/corrected onedown-ref and onedown-examples \\
% - Added color 'gray' for special effects
% }
% \changes{v1.4}{2019/10/12}{\\
% - Made \emph{onedown-ref} independent of \emph{onedown-examples} and \emph{subfiles} \\
% - Corrected some mistakes ODw-*.trsl files, all \texttt{V0.51-2019/10/15} \\
% - Added macro \cmd{\Ten} to get rid of the extra enlargment by 'scalefnt' in \cmd{\gamefont}
% - Added support for the spanish language \\
% - Made onedown-ref.tex and onedown-examples.tex multilangual. We can output the onedown
% commands in all supported languages. \\
% - \cmd{\DeclareSymbolFont \\ \{symbols\}\{OMS\} \{txsy\}\{m\}\{n\}} interferes with package \packname{newtxmath}.
% I renamed \emph{symbols} into \textbf{ODw@symbols} and \emph{symbolsC} into \textbf{ODw@symbolsC}
% to solve this. 
% }
% ^^A Note: ^^21 denotes the exclamation mark (!)
% ^^A Note: Char ' is not allowed within changes
%
% \DoNotIndex{\newcommand,\newenvironment,\BODY,\boolean,\IfEqCase,\IfInteger,
%              \DeclareFontSubstitution,\dimexpr,\ifcat,\ifmmode,\IfValueT,
%              \fontencoding,\fontfamily,\fontseries,\fontshape,\makebox,\StrChar,\StrLen,
%              \mathord,\mdseries,\NewEnviron,\newif,\mskip,\edef,\rotatebox,\width,
%              \newsavebox,\noexpand,\rmfamily,\rule,\sbox,\scshape,\put,\real,
%              \selectfont,\SetSymbolFont,\slshape,\tabcolsep,\color,\cs,\do,\docsvlist,
%              \thinspace,\usebox,\AtBeginDocument,\begingroup,\endgroup,\unitlength,
%              \bgroup,\egroup,\IfValueTF,\newcolumntype,\renewrobustcmd}
% \DoNotIndex{\@ifstar,\\,\,}
% \DoNotIndex{\addtolength,\advance,\alph,\baselineskip,\begin,\bfseries,\macro,
%             \group,\center,\centering,\clubsuit,\collectcell,\count,\def,\ ,\let,
%             \diamondsuit,\dimen,\divide,\dpts,\egroup,\else,\empty,\end,\expandafter,
%             \endcenter,\endcollectcell,\endinput,\ensuremath,\equal,\everypar,
%             \extracolsep,\fbox,\fboxrule,\fboxsep,\fi,\gdef,\global,\ExplSyntaxOff,
%             \hangafter,\hangindent,\hbadness,\hbox,\heartsuit,\hfill,\ExplSyntaxOn,
%             \hline,\hsize,\hskip,\hspace,\hss,\ht,\HUGE,\if,\IfBooleanTF,\moveto,
%             \ifthenelse,\ifx,\itemsep,\kern,\labelsep,\labelwidth,\large,
%             \leftmargin,\leftskip,\lengthtest,\LoadDictionaryFor,\lower,
%             \mathbf,\medskip,\multicolumn,\NeedsTeXFormat,\newboolean,\numexpr,
%             \newcounter,\newdimen,\NewDocumentCommand,\strokepath,\closepath,
%             \NewDocumentEnvironment,\newlength,\noindent,\p@,\par,\whiledo,
%             \parbox,\parfillskip,\parindent,\parsep,\parskip,\partopsep,\lineto,
%             \phantom,\ProvidesPackage,\quad,\raggedright,\raisebox,\linethickness,
%             \relax,\renewcommand,\RequirePackage,\rightmargin,\PackageWarning,
%             \rightskip,\rlap,\setboolean,\setbox,\setcounter,\setlength,
%             \settowidth,\sffamily,\smaller,\larger,\space,\spadesuit,\skip@,
%             \ssmall,\stackbox,\stepcounter,\styledate,\styleversion,\textbf,
%             \textrm,\textsc,\textsf,\textsl,\textwidth,\thefootnote,\ifnumequal,
%             \thinspace,\topsep,\typeout,\vspace,\vtop,\wd,\widthof,\IfFileExists,
%             \xspace,\xspaceaddexceptions,\z@,\PackageWarning,\ForEachTrackedLanguage,
%             \newtoks,\PackageInfo,\provideenvironment,\str,\textit,\Hoffset,\Voffset,
%             \the,\thinmuskip,\thislang,\tl,\tmp,\xdef,\PicSize,\MidSize,
% }
% \DoNotIndex{%
%   \\,\arrayrulewidth,\addtocounter,\cci,\DeclareMathSymbol,\skip@,
%   \DeclareSymbolFont,\footnotemark,\footnotesize,\footnotetext,\isodd,
%   \mathalpha,\pgfkeys,\pgfqkeys,\ProcessPgfOptions,\scriptsize,
%   \shortstack,\superscript,\textcolor,\thinspace,\tiny,\underline,\value}
% \DoNotIndex{\GetTranslation,\ifpdf,\iflanguage,\iffalse,\AfterPackage,
% \ifbool,\setbool,\newbool,\StrSubstitute,\StrCount,\StrDel,\ifcase,
% \ifboolexpr,\ifnumcomp,\or,\overline,\mbox,\@ODw}
% \setcounter{IndexColumns}{2}
% ^^A \providecommand*{\url}{\texttt}
% ^^A\newcommand{\tasc}{\textbf{\raisebox{-0.7ex}[1ex][0pt]{*}}}
% \newcommand{\tasc}{\textbf{\textasteriskcentered}}
% ^^A \newcommand{\plus}{\texttt{\larger{\raisebox{-0.25ex}[1ex][0pt]{+}}}}
% \newcommand{\plus}{\texttt{\larger{\raisebox{-0.25ex}[1ex][0pt]{+}}}}
%^^A set the font for the macros in the margin
% \renewcommand{\MacroFont}{\ttfamily\scriptsize}
%
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% ^^A We must redefine \verb (from doc.sty),
% ^^A because there is no font-changing hook to add \footnotesize
% ^^A This is only for the document, not the style file
%
% \makeatletter
% \def\verb{\relax\ifmmode\hbox\else\leavevmode\null\fi
%   \bgroup \let\do\do@noligs \verbatim@nolig@list
%     \ttfamily\footnotesize \verb@eol@error \let\do\@makeother \dospecials
%     \@ifstar{\@sverb}{\@vobeyspaces \frenchspacing \@sverb}}
%
%  \newcommand\ODwBox{\ODw@Box\xspace}
%
% \makeatother
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% \GetFileInfo{onedown.sty}
% \title{The \OneDown package\\[0.5em]
% \normalsize\url{www.ctan.org/pkg/onedown}
% ^^A The frustrating ltxdoc also obfuscates this simple thing!
% \thispagestyle{empty}
% }
% \author{Jacob Wiersma \\ \url{jack@schuli-wirsi.de}}
% \date{v\ODwstyleversion~from \ODwstyledate}
%
% \maketitle
% {
% \gamefont{\sffamily\bfseries\large}
% \otherfont{\rmfamily\bfseries\normalsize}
% \setdefaults{bidfirst=S,bidlong=on,err=on,warn=on}
% \hfill
% \frame{
%   \setdefaults{bidlong=off}
%   \parbox{22em}{
%     \northhand{A32}{QJT}{KQJT9}{QJ}
%     \southhand{KQJT}{9876}{A8}{AK2}
%     \westhand{8765}{AK}{732}{T987}
%     \easthand{94}{5432}{654}{6543}
%     \dealer[\South*!]\vulner[\NorthSouth*!]
%     \leftupper{\dealertext}{\vulnertext}{}
%     \showAll*
%
%     \begin{bidding}*(\explainit{15--17}\\\explainit{quantitative})
%       1N\markit & p & 4N\markit & p \\
%       6N        & X & {\Allpass*} \\
%     \end{bidding}
%
% \setdefaults{warn=off}
%
%     \begin{play}*{W}
%       HK & T & 2 & 6 \\
%       HA & J & 3 & 7 \\
%     \end{play}
%   }
% }
% \hfill
% }
% \setdefaults*{}
% \newpage
% \begin{abstract}\noindent
%  This package implements commands and environments to typeset various bridge
%  diagrams, with or without a |bidding| sequence. It offers following
%  features:
% \begin{itemize}
% \item It is possible to use an own font and/or a font-size with which the
% diagrams will be typeset independently from the main font used in the
% document. This also allows an easy production of overhead slides and for
% digital projection. Different fonts can be used for e.g.\ the bidding
% diagram, its header, the compass, the hands etc. Most diagrams can be
% centered both horizontally and vertically.
%
% \item A special feature is the automated check on consistency of suits
% and hands. If a hand holds more than 13 cards an error is printed, if there
% are less then 13 cards a warning. If a suit over the 4 hands has more
% than 13 cards or if a card appears more than once an error like
% \example{\textcolor{\ODwcolor}{Error: Card \Sp\,8 occurs 2 times}} is printed.
% These warnings and error messages are controlled by the |err| and |warn|
% options, e.g.\ when loading the package.
%  
%  \item The output of the implemented bridge terms like \example{\double}
%  (which you get by calling the command |\double|) are multilingual
%  and get translated automatically. When the language |german| is
%  active the command |\double| would produce
%  \example{\Translate{\double}}. Also the basic symbols like A(ce),
%  K(ing), Q(ueen) and J(ack) are multilingual. So
%  \example{\suit[\Di]{AKQJ}} would automatically become
%  \example{\Translate{\suit[\Di\,]{AKQJ}}} in a German text.
%  
%  \item It is possible to add annotations to a card diagram, like the
%  board number, the dealer or the vulnerability etc.\ on several positions
%  in the diagram (if a board number is given, the dealer and vulnerability
%  are computed automatically). One can also add explanations to the
%  |bidding| diagram, as well as the real world names of the bidders.
%
%  \item There are two specials: a command to typeset a quiz with answers,
%  and an environment to typeset the sequence of playing tricks, where also
%  the total number of tricks won by each side is calculated and displayed.
% \end{itemize}
% \end{abstract}
%
% \tableofcontents
%
% \section{Preface}
%
% I am neither a good bridge player nor a good package writer. But I like
% to read about bridge and when I write about bridge (sometimes a funny
% short story, sometimes some training exercises for beginners) I do feel
% the need for an appropriate tool to support that. Surprisingly enough,
% there exists no comprehensive package on |CTAN| for typesetting bridge
% diagrams. For all those people who feel more or less the same as I do,
% there is this package called \OneDown. As some say: \emph{one down is
% good bridge}\footnote{please, don't discuss the truth-value of this
% statement with me}, I hope that \OneDown is a good bridge package.
%
% You can generate this documentation by running
%
% \iffalse
%<*verb>
% \fi
\begin{verbnobox}[\small]
pdflatex --shell-escape onedown.dtx
makeindex -s gind.ist onedown.idx
makeindex -s gglo.ist -o onedown.gls onedown.glo
pdflatex --shell-escape onedown.dtx
pdflatex --shell-escape onedown.dtx
\end{verbnobox}
% \iffalse
%</verb>
% \fi
% Use:\\
% |pdflatex --shell-escape '\AtBeginDocument{\NoColortrue}\input{onedown.dtx}'|
% as last run to get a pdf for printing on a monochrome printer.
% The |--shell-escape| flag is necesary to generate the list of user
% commands. If you think this is too dangerous, then run pdflatex without
% this flag and you will get the docmentation without the list of user
% command (of about 1 page). In any case you'll find a multi-page reference
% overview of all commands in |onedown-ref.pdf|.
%
% \section{Introduction}
%
% There must be a lot of bridge players who also use \LaTeX{} to typeset
% their documents. And it is almost incredible that on |CTAN| there exist
% no modern package with a decent documentation that supports
% this.

% In 1990 Kees van der Laan \cite{Laan} published an article in
% TUGBoat\footnote{\url{http://tug.org/TUGboat/Articles/tb11-2/tb28laan.pdf}}
% in which he describes how well the \TeX-machinery is able to produce
% beautiful bridge diagrams. Based on this article and examples,
% Johannes
% Braams put these commands together in a style file\footnote{%
% \packname{bridge.sty}, last version v1.7c, 1994/12/20} and added more.
% Some time later René Steiner and Thomas Hof produced the
% \packname{bridge-i} and the \packname{kibitzer}\footnote{both v1.0,
% 1995/04/06} style files, in which they made a lot of 
% enhancements.
% Also others made some efforts in this direction.\footnote{Antony Lee
% released his package \packname{bridge} in 2012 and Gordon Bower his
% package \packname{grbbridge} in 2013. Both are very interesting but offer
% only limited features and are not on CTAN at the time of writing. See
% \url{http://www.bridgebase.com/forums/topic/51967-latex-package-for-typesetting-bridge-related-stuff/}}
 
% Around 2005 I used these style files for
% some tiny projects. The quality of the output was splendid. Putting the
% text and diagrams together was not always easy and the documentation was
% poor. In 2015, after a long pause, I had to produce bridge texts again. I
% enhanced some of the existing stuff and made ad hoc changes in the code,
% which led to smaller and greater catastrophes. Summer 2016 I decided to
% write a new package, based on the work of the previously mentioned
% persons. I called it \OneDown. The central goal was to offer a user
% friendly package with detailed documentation. For example you don't need
% to say |\setlength{\handskip}{5mm}| or |\def\handskip{5mm}| but rather
% call the command |\handskip{1em}|. Not only the call is somewhat
% friendlier, more important, setting the width in terms of the
% font used, it will automatically adapt its size accordingly to font and
% font-size changes. \OneDown features:
% \begin{itemize}
% \item Sizing of diagrams relative to font and font-size.
% \item The font-sizes of the diagrams and text are independent.
% \item Automated translation of all important bridge terms.
% \item Diagrams can optionally contain information about the dealer, who
%       is vulnerable etc.
% \end{itemize}
%
% The \OneDown package is designed to be used for typesetting texts that have to
% do with the game of bridge. It provides not only simple commands like
% |\Sp| which produces the spade symbol \example{\Sp}. Also complete
% card diagrams with the hands of the \north, \east, etc.\ player can
% be defined in several ways. One can select which hands are to be shown.
% Bidding diagrams can be shown stand-alone or in connection with one or
% more hands. In |bidding| diagrams annotations are possible.
%
% \section{Usage}
%
% \subsection{Initialization}
%
% \subsubsection{Requirements}
%
% The package \OneDown depends on several other packages, such as
% \packname{ifthen}, \packname{translations} or \packname{xspace}. All
% these packages get loaded automatically if not already used in your
% document. For a complete overview of all required packages, refer to page
% \pageref{RequirePackage}. All the packages are loaded without any option,
% so the risk of an option clash should be low: Just load your package with
% options \emph{before} \OneDown.
%
% Furthermore, for the several languages that \OneDown supports, there are
% the dictionary files with translations of the specific bridge terms.
% These dictionaries follow the naming convention:
% \texttt{ODw-\meta{language}.trsl} and are included in the bundle. The
% name of the \meta{language} is generally the same as the name that you
% use as option for \packname{babel}. There is one exception: the
% Norwegian language uses |norsk| for \packname{babel} and |norwegian| for
% \packname{translations}. But all the same, the |norwegian| dictionary is
% automatically loaded when |norsk| is used.
%
% Should you make a dictionary for a language that is not provided yet, or
% have corrections for an existing one, please send it to the maintainer,
% so it can be added to the bundle.
%
% \subsubsection{Loading the package}
%
% Simply say |\usepackage{onedown}| in the preamble of
% your document if you want to load \OneDown with its default settings.
%
% \textbf{Warning:} \OneDown loads all necessary |ODw|-dictionaries
% automatically at the begin of the document. In order to know which
% languages must be loaded, these must be specified \emph{before} package
% \packname{onedown} is loaded. In general this means that if you use
% \packname{babel} (or \packname{polyglossia}) you must
% load it before package \OneDown. If for some reason you cannot
% or do not want to do that, you can load any |ODw|-dictionary if you put
% the command: |\LoadDictionaryFor{|\marg{language}|}{ODw}| in your
% preamble, provided that the dictionary is in the \TeX-path. For a
% discussion about the caveats of using e.g.\ babel, refer to section%
% \ref{Languages}.
%
% \subsubsection{Options}\label{Options}
%
% To change the behaviour of \OneDown one can load the package with certain
% options: |\usepackage[|\meta{options}|]{onedown}|. Of course this 'option
% loading' takes place in the preamble. But it is also possible to set (or
% change) options within the document by calling the macro |\setdefaults|.
% This macro uses the same \meta{key}=\meta{val} syntax as is used for the
% options and offers some more keys that cannot be used when loading the
% package. Refer to page~\pageref{Defaults} for  details.
%
% As said before, the package loads its options using the
% \meta{key}=\meta{val} syntax. These options deal with:
% \begin{itemize}
% \item[colors] \verb:colors=0|1|2|3|4A|4B:\\
% The color in which the card symbols will
% be printed. The color options are \textbf{0} (black only), \textbf{1}
% (black and white) \textbf{2} (black and red), \textbf{3} (grey (for special effects)),
% \textbf{4A} (green, orange,
% red and blue), \textbf{4B} (black, orange, red and green). We also
% defined some synonyms, as shown in the table below.
% \par
% Thus loading the package with |\usepackage[colors=X]{onedown}| will print
% \begin{itemize}
%   \item[x=0:] {\setdefaults{colors=0} \Cl, \Di, \He and \Sp}
%               (synonyms:  |mono|, |black|) 
%   \item[x=1:] {\setdefaults{colors=1} \Cl, \Di, \He and \Sp}
%               (synonyms:  |b+w|)
%   \item[x=2:] {\setdefaults{colors=2} \Cl, \Di, \He and \Sp}
%               (synonyms:  |b+r|)
%   \item[x=3:] {\setdefaults{colors=3} \Cl, \Di, \He and \Sp}
%               (synonyms:  |gray|, |grey|)
%   \item[x=4A:] {\setdefaults{colors=4A} \Cl, \Di, \He and \Sp}
%               (synonyms:  |4a|, |fourA|)
%   \item[x=4B:] {\setdefaults{colors=4B} \Cl, \Di, \He and \Sp}
%               (synonyms:  |4b|, |fourB|)
% \end{itemize}
% The default is |colors=2| for printing in black and red. Please note, that |colors=3| is not
% meant to typeset the whole document. You can use it if you want e.g. to repeat something and want
% it to be less apparent. 
% \item[err, warn] \verb:err=on|off:\qquad\verb:warn=|on|off:\\
% These options regulate which messages are to be output. These
% messages have to do with the consistency of cards in
% a suit, in a hand or combined hands. It is an error when a hand has more
% that 13 cards, or when the same card occurs twice or more in a hand or a
% deal. With the option |err=on| (which is the default) these error
% messages appear as output. With |err=off| you can suppress that.
% On the other hand when a suit has less than 13 cards, this must not
% necessarily be wrong. Maybe only some cards are to be shown, e.g.\ in an
% example concerning a finesse. Or when only e.g.\ |E-W| hands are
% concerned, not all cards of the deck will be specified. These situations
% will be caught by setting |warn=on|. To suppress these spurious warnings
% use |warn=off|, which is the default.
% Synonyms for |on| are |1| and |true|. Synonyms for |off| are |0| and
% |false|. This also applies for other keys that do not control a package
% option.
% \end{itemize}
%
% \subsubsection{Active Characters: a Warning}\label{Languages}
%
% \OneDown uses the \packname{tranlation} package to automatically
% translate often appearing brigde terms like e.g.\ \emph{declarer}. It does
% so by looking up these terms in the special |ODw|-dictionary for the
% active language. The current \OneDown version supports English, German,
% Dutch, French, most Scadinavian languages and Turkish. Some dictionaries
% may not be complete or may contain errors, please send
% corrections/additions to the maintainer.
%
% \needspace{5\baselineskip}
%
% \paragraph*{\textcolor{red}{\centering Warning for people using active
% characters.}}
%
% Some language packages fiddle around making characters active.
% This can have unexpected influence on \OneDown.
% The |=|~sign is used when loading the package \packname{onedown} to
% specify options.
% It appears also in calls like |\setdefaults{warn=on}|. 
% We also use the following characters as tokens for optional arguments
% with the meaning as shown in this list:
% \begin{itemize}[itemsep=-1mm,topsep=-0em]
% \item[|*|] to center diagrams or print a long or capitalized text 
% \item[|!|] special action like short names of vertical layout
% \item[|-|] to hide what would normally been shown
% \item[|+|] to show what would normally be hidden
% \end{itemize}
% \par\noindent
% To give you an idea what e.g.\ babel can cause we cite from 
% \emph{The Turkish style for babel}:\par
% \begin{quote}
% Turkish typographic rules specify that a little 'white space' should be
% added before the characters ':', '!' and '='. In order to insert this
% white space automatically these characters are made |\active|, so they
% have to be treated in a special way.
% \end{quote}
% So babel-Turkish makes the equal sign and exlamation mark active. This
% leads to errors when you call e.g.\ |\setdefaults{warn=on}| or |\hand!|.
% If you do not need any character to be active, then load this language
% with |\usepackage[turkish,shorthands=]{babel}|. If you do need the
% shorthand then you must disable it every time you have to use e.g.\ the
% |=|~character as a normal character by:
%
% \iffalse
%<*verb>
% \fi
\begin{verbnobox}[\small]
\shorthandoff{=}% Make '=' not active any more
  \setdefaults{warn=on}
\shorthandon{=}% Restore '=' to active again
\end{verbnobox}
% \iffalse
%</verb>
% \fi
%
% \section{User Commands}
%
% \subsection{Overview}
%
% In the next sections we give a short description of all the user commands
% and environments that are defined in \OneDown. The commands marked with
% \ML are multilingual. I.e.\ the text they typeset gets
% translated automatically into the active language.
%
% In order to make sure that the example diagrams do not disturb the
% page layout of this document too much, we scaled them down to
% |footnotesize|.
% \gamefont{\bfseries\sffamily\footnotesize}
% Sometimes the output of a command is shown as an example. This output is
% framed in this document like \example{this}, just to recognize it easily
% as an output example. In an accompanying
% file\footnote{onedown-examples.pdf} with examples one can find in more
% detail how these commands are used and what they produce.
%
% We have loaded the package \OneDown with the default option for colors,
% giving us \textcolor{black}{black} and \textcolor{red}{red}. Furthermore,
% when we descibe macros, we use a colored frame that also shows the output
% of the commend. Some commands have optional tokens that produce an output
% that differs from the naked version. These optional tokens appear in a
% different background color like \Oarg{*!}. If an output of a macro is
% shown, then the output of tokenized calls is shown in parenthesis to
% demonstrate the difference.
%
% \subsubsection{The Compass}
%
% \boardnr{0}
% The compass \CP is not available as a user command itself, but it is used
% in all user commands that draw a card diagram. It has some special
% features. 
% \begin{itemize}[itemsep=0em]
% \item It can mark the dealer (\north) \boardnr{1} \CP 
% \item It can write the vulnerable side  (\northsouth) in red \boardnr{5} \CP
% \item it can put something (a board number) in the middle
% \boardnr{3} \setdefaults{compmid=3} \CP
% \end{itemize}
% The machinery is intelligent enough to calculate the dealer and
% vulnerability from the board number. When only |black| or
% |b+w| is selected as option for colors, then the
% vulnerable side is written in italics rather colorized. Because
% underlining the \South*-hand would interfere with the compass frame, we
% overline it. With the command  |\setdefaults| one can customize the look
% of the compass. In particular, if you want to print the actual board
% number, specified by calling |\boardnr{Nr}|, you can achieve that by
% calling |\setdefaults{compmid=\boardtext}|. In the accompanying file with
% examples you'll find more examples about |\setdefaults|.
% 
% \subsubsection{Hooks}
%
% We use kind of hooks to
% \begin{enumerate}
% \item change the font or the font-size. These are discussed in chapter
% \emph{Sizing and Fonts} on page \pageref{Fonts}.
% \item add commentary information to card diagrams. These are discussed in
% chapter \emph{Conditions in Diagrams} on page \pageref{Conditions}
% \item There is one other hook to enable the user to add something to the
% compass. This is done by calling |\setdefaults{compmid=<Text>}|.
% \end{enumerate}
%
% \subsection{Basic Symbols}\label{BasicSym}
%
% In this section we show the predefined commands that produce terms that
% occur often in bridge text. On page \pageref{ReDefine} an easy way is
% shown to redefine them as to use a different variant of the term in
% question. 
% \par\vspace{0.3\baselineskip}\noindent
% The next 5 macros are shorthands for the suit symbols and \NT:
% \par\vspace{0.5\baselineskip}\noindent
% \needspace{5\baselineskip}\noindent
% \DescribeMacro{\Cl}\MacroDef+{Cl}[\hfill \Cl]
% \par\noindent
% \DescribeMacro{\Di}\MacroDef+{Di}[\hfill \Di]
% \par\noindent
% \DescribeMacro{\He}\MacroDef+{He}[\hfill \He]
% \par\noindent
% \DescribeMacro{\Sp}\MacroDef+{Sp}[\hfill \Sp]
% \par\noindent
% \DescribeMacro{\NT}\MacroDef*+{NT}[\hfill \NT]
% \par\vspace{0.3\baselineskip}\noindent
% The next 4 macros typeset the non-bid calls
% \par\vspace{0.5\baselineskip}\noindent
% \needspace{4\baselineskip}\noindent
% \DescribeMacro{\pass}\MacroDef*+{pass}[\hfill \pass]
% \par\noindent
% \DescribeMacro{\allpass}\MacroDef*+{allpass}[\hfill \allpass]
% \par\noindent
% \DescribeMacro{\double}\MacroDef*+{double}[\hfill \double]
% \par\noindent
% \DescribeMacro{\redouble}\MacroDef*+{redouble}[\hfill \redouble]
% The next 6 macros typeset the directions that identify dealer (or player)
% and the axis that is vulnerable.
% \par\vspace{0.5\baselineskip}\noindent
% \needspace{4\baselineskip}\noindent
% \DescribeMacro{\north}\MacroDef*+{north}[\hfill \north]
% \par\noindent
% \DescribeMacro{\east}\MacroDef*+{east}[\hfill \east]
% \par\noindent
% \DescribeMacro{\south}\MacroDef*+{south}[\hfill \south]
% \par\noindent
% \DescribeMacro{\west}\MacroDef*+{west}[\hfill \west]
% \par\vspace{0.5\baselineskip}\noindent
% \DescribeMacro{\northsouth}\MacroDef*+{northsouth}[\hfill \northsouth]
% \par\noindent
% \DescribeMacro{\eastwest}\MacroDef*+{eastwest}[\hfill \eastwest]
% The next 4 macros typeset the \emph{unit} of the points when valuing a
% bridge hand. If one or more of these items do not appear in your bridge
% world, don't argue them, Just don't use them! They are meant to specify
% \emph{High Card Points}, \emph{High Card + Length Points}, \emph{Length Points},
% \emph{Distribution Points} and \emph{Total Points} respectively.
% \par\vspace{0.5\baselineskip}\noindent
% \DescribeMacro{\HCP}\MacroDef*+{HCP}[\hfill \HCP]
% \par\noindent
% \DescribeMacro{\HLP}\MacroDef*+{HLP}[\hfill \HLP]
% \par\noindent
% \DescribeMacro{\LP}\MacroDef*+{LP}[\hfill \LP]
% \par\noindent
% \DescribeMacro{\DP}\MacroDef*+{DP}[\hfill \DP]
% \par\noindent
% \DescribeMacro{\TP}\MacroDef*+{TP}[\hfill \TP]
% \par\noindent
% The next 5 commands produce the abbreviations for several forcing
% expressions.
% \par\vspace{0.5\baselineskip}\noindent
% \DescribeMacro{\GF}\MacroDef*+{GF}[\hfill \GF]
% \par\noindent
% \DescribeMacro{\SF}\MacroDef*+{SF}[\hfill \SF]
% \par\noindent
% \DescribeMacro{\NMF}\MacroDef*+{NMF}[\hfill \NMF]
% \par\noindent
% \DescribeMacro{\TSF}\MacroDef*+{TSF}[\hfill \TSF]
% \par\noindent
% \DescribeMacro{\FSF}\MacroDef*+{FSF}[\hfill \FSF]
%
% \subsubsection{Header of the Bidding Table}
%
% \par\vspace{0.5\baselineskip}\noindent
% \DescribeMacro{\namesNS}\MacroDef+{namesNS}[\marg{N-name}\marg{S-name}]
% Defines the real world names for the \north and the \south player. If
% they are defined, they appear in the \North*!- and the \South*!-column
% of the |bidding| diagram.
% \par\vspace{0.5\baselineskip}\noindent
% \DescribeMacro{\namesEW}\MacroDef+{namesEW}[\marg{E-name}\marg{W-name}]
% Same as |\namesNS| but now for the \east and the \west player.
%
% \subsection{The Card Diagrams}
%
% \subsubsection{The hands of the players}
% Before a card diagram can be shown, one must specify the cards that
% each player holds. With the various \meta{player}|hand|-commands one can
% do this. The suits they define are only shown when a |show|-command is
% issued after they have been defined. The |show|-commands are discussed on
% page \pageref{ShowCommands}.
% \par\vspace{0.5\baselineskip}\noindent
% \needspace{4\baselineskip}\noindent
% \DescribeMacro{\northhand}\MacroDef+{northhand}[\oarg{v-offset}\marg{Sp}\marg{He}\marg{Di}\marg{Cl}]
% \par\noindent
% \DescribeMacro{\easthand}\MacroDef+{easthand}[\oarg{h-offset}\marg{Sp}\marg{He}\marg{Di}\marg{Cl}]
% \par\noindent
% \DescribeMacro{\southhand}\MacroDef+{southhand}[\oarg{v-offset}\marg{Sp}\marg{He}\marg{Di}\marg{Cl}]
% \par\noindent
% \DescribeMacro{\westhand}\MacroDef+{westhand}[\oarg{h-offset}\marg{Sp}\marg{He}\marg{Di}\marg{Cl}]
% The command |\northhand| defines the cards (all 4 suits) for the
% \North*!-player. |\easthand|, |\southhand| and |\westhand| do that for
% the \East*!-, \South*!- or \West*!-player. These commands have 4
% mandatory arguments in
% which the cards of the 4 suits are specified. In all suit commands where
% card ranks are issued, one must use \textbf{T} to denote the value
% \textbf{10}. On output, some kerning takes care that the output looks
% like \suit{T} and not like a \textbf{1} followed by a \textbf{0}. So
% |\suit{AKJT8}| produces \example{\suit{AKJT8}}.
% It is also possible to use a small 'x' as symbol for a spot card: |\suit{AKxxx}|
% produces \example{\suit{AKxxx}}.
%
% These commands also have an optional argument, an offset which by default
% is 0pt. This offset is meant to finetune the layout of the hands in the
% card diagrams. They change the distance between a hand and the compass.
% |\northhand| and |\southhand| have a \emph{vertical} offset, whereas 
% |\easthand| and |\westhand| have a \emph{horizontal} one. A positive
% value moves away from the compass.
%
% \subsubsection{The single hand}
%
% \noindent
% \DescribeMacro{\hand}\MacroDef+{hand}[\Oarg{*!-}\oarg{pos}\marg{Sp}\marg{He}\marg{Di}\marg{Cl}]
% This macro typesets the cards of one single hand, either vertically or
% horizontally. There are 4 mandatory arguments defining the 4 suits. With
% 2 optional tokens '|*|' resp.\ '|!|' one can typeset the hand with
% some special features:
% \begin{itemize}[itemsep=0em] 
% \item |\hand*| typesets a hand horizontally, centered
% \item |\hand!| typesets a hand vertically, left aligned
% \item |\hand*!| typesets a hand vertically, centered
%\end{itemize}
% For vertical hands the optional argument |pos| (default= \textbf{c})
% controls the horizontal alignment. Without a token, the hand is typeset
% horizontally, left aligned: The call |\hand{AK2}{T85}{AQT6}{A42}|
% typesets the hand horizontally like:
% \par\vspace{0.3\baselineskip}\noindent
% \example{\hand{AK2}{T85}{AQT6}{A42}},
% \par\vspace{0.3\baselineskip}\noindent
% whereas the |\hand!| version produces 
% \shorthandoff{!}
% \example{\hand!{AK2}{T85}{AQT6}{A42}}.
% \shorthandon{!}
% \par\vspace{0.3\baselineskip}\noindent
% The third optional token, a '|-|' suppresses all output and saves the
% stuff for later use. This is used e.g.\ in |\expertquiz|.
%
% \subsubsection{Only one suit}
%
% \noindent
% \DescribeMacro{\onesuitAll}\MacroDef+{onesuitAll}[\Oarg{*!}\marg{N}\marg{S}\marg{E}\marg{W}]
% Typesets the cards of 1 suit for all players. This command has 4
% mandatory arguments defining the cards of the 4 players. There are 2
% optional tokens. With |\onesuitAll*| the output is centered, with
% |onesuitAll!| the cards are placed around a |NESW| compass.
% Without the '|!|'-token a small box (\ODwBox) is used instead. Thus
% the macro call |\onesuitAll{AQ6}{J3}{T54}{K2}| produces
% \example{\onesuitAll{AQ6}{J3}{T54}{K2}}.
% \par\noindent
% Please note the order of the
% players in the arguments: the first 2 denote the \north and \south hand.
% The last 2 denote the \east and \west hand. We choose it this way so you
% can easily cut and paste one pair from the |\onesuitAll|, or extend
% |\onesuitNS| to showing all hands.
% \par\vspace{0.5\baselineskip}\noindent
% \DescribeMacro{\onesuitNS}\MacroDef+{onesuitNS}[\Oarg{*!}\marg{N}\marg{S}]
% \par\noindent
% \DescribeMacro{\onesuitEW}\MacroDef+{onesuitEW}[\Oarg{*!}\marg{E}\marg{W}]
% \par\noindent
% \DescribeMacro{\onesuitNE}\MacroDef+{onesuitNE}[\Oarg{*!}\marg{N}\marg{E}]
% \par\noindent
% \DescribeMacro{\onesuitNW}\MacroDef+{onesuitNW}[\Oarg{*!}\marg{N}\marg{W}]
% These commands are similar to |\onesuitAll| but have only 2 mandatory
% arguments. The command |\onesuitNS{AQ3}{JT9}| typesets
% \example{\onesuitNS{AQ3}{JT9}} and |\onesuitEW{8764}{K2}| will
% produce \example{\onesuitEW{8764}{K2}}. Please note that at the latter the
% cards for the \east hand appear in the first argument. Finally 
% |\onesuitNE{AQ3}{8764}| produces \example{\onesuitNE{AQ3}{8764}} and
% |\onesuitNW{AQ3}{K2}| \example{\onesuitNW{AQ3}{K2}}. 
% \par\vspace{0.5\baselineskip}\noindent
% \DescribeMacro{\suit}\MacroDef+{suit}[\oarg{suit symbol}\marg{cards}]
% This command has 1 optional argument denoting a suit symbol and 1
% mandatory argument, defining the cards of the suit.
% |\suit{AQJ7}| by default produces \example{\suit{AQJ7}}. When the German
% language is active it would produce \example{\Translate{\suit{AQJ7}}}.
% Using the optional argument like in |\suit[\Di]{AQJ7}| will produce:
% \example{\suit[\Di]{AQJ7}}.
%
% \subsubsection{Showing Card Diagrams}\label{ShowCommands}
%
% \noindent
% \DescribeMacro{\showAll}\MacroDef+{showAll}[\Oarg{*+}\oarg{pos}]
% \par\noindent
% \DeleteShortVerb{\|}
% \DescribeMacro{\showNS}\MacroDef+{showNS}[\Oarg{*+}\oarg{pos}\parg{N|S}]
% \par\noindent
% \DescribeMacro{\showEW}\MacroDef+{showEW}[\Oarg{*+}\oarg{pos}\parg{E|W}]
% \MakeShortVerb{\|}
% \par\noindent
% \DescribeMacro{\showNE}\MacroDef+{showNE}[\Oarg{*+}\oarg{pos}]
% \par\noindent
% \DescribeMacro{\showNW}\MacroDef+{showNW}[\Oarg{*+}\oarg{pos}]
% All |show|-commands have two optional tokens, a '|*|' which centers the
% output and a '|+|' which also displays a |bidding| diagram next to the
% card diagram. This |bidding| diagram must have been defined before, see
% page~\pageref{Bidding}.
% They also have one optional argument that defines the aligning. Its
% default is~\textbf{c}.
% |\showAll| typesets a card diagram with the |NESW| compass with \North*! in
% top and the hands of the 4 players surrounding it. These hands must have
% been defined before by calling |\northhand| etc. Hands that are not
% defined are left empty. Optionally some conditions (like the dealer or
% who is vulnerable etc.) can be added to the diagram by using the commands
% described in section \emph{Diagram Conditions}. Please note that when the
% \north or \south hand contains a long suit that extends beyond the
% |NESW| compass, this might collide with these extra texts. You can
% correct that with the optional offset parameter of the condition commands
% (see page \pageref{Legend}).
%
% The other commands are similar to |\showAll| but typeset only the hands
% of the players that are represented in the name of the command:
% \NorthSouth*!, \EastWest*!,  \North*!--\East*! and \North*!--\West*!.
%
% The commands |\showNS| and |\showEW| have an extra optional argument with
% which selectively only one of the two hands can be displayed. E.g.\ 
% |\showNS(S)| will display only the \South*-hand.
% \needspace{6\baselineskip}\noindent
%
% \subsubsection{Showing Card Diagrams with Bidding}\label{PlayCommands}
%
% \subsubsection{Diagram Conditions}
%
% \noindent
% \DescribeMacro{\headlinetext}\MacroDef+{headlinetext}[\marg{text}]
% \par\noindent
% \DescribeMacro{\footlinetext}\MacroDef+{footlinetext}[\marg{text}]
% These commands have 1 mandatory argument: the text that defines the
% annotation that is to be added to a card diagram. The text can be on more
% than one line, just separate them with a |\par| or
% |\newline|\footnote{Using '\bs\bs' instead produces a misleading error:
% \textbf{! Missing \} inserted\ldots}}.
% |\headlinetext| places the annotation above the diagram, |\footlinetext|
% below it.
% \par\vspace{0.5\baselineskip}
% \needspace{4\baselineskip}\noindent
% \DescribeMacro{\leftupper}\MacroDef+{leftupper}[\oarg{h-offset}\marg{line1}\marg{line2}\marg{line3}]\label{Legend}
% \par\noindent
% \DescribeMacro{\leftlower}\MacroDef+{leftlower}[\oarg{h-offset}\marg{line1}\marg{line2}\marg{line3}]
% \par\noindent
% \DescribeMacro{\rightupper}\MacroDef+{rightupper}[\oarg{h-offset}\marg{line1}\marg{line2}\marg{line3}]
% \par\noindent
% \DescribeMacro{\rightlower}\MacroDef+{rightlower}[\oarg{h-offset}\marg{line1}\marg{line2}\marg{line3}]
% These commands have 1 optional argument (default 0pt) with which you can
% add some extra horizontal space if hand and legend collide, and 3
% mandatory arguments: the lines of text that are added as conditions
% to the card diagram. Both |\leftupper| (|\rightupper|) place their
% text in the left- (right-) upper corner of the diagram. The top line
% will be aligned with the (inner) top of the diagram. |\leftlower|
% (|\rightlower|) are similar, but place their text at the lower corner of
% the diagram. The last line is aligned with the (inner) bottom of the
% diagram. For an empty line you must issue an empty argument.
% With a positive offset, |\leftupper| and |\leftlower| shift to the left
% whereas |\rightupper| and |\rightlower| shift to the right. I.e.\ they
% shift away from their neighbouring hand.
% \par\vspace{0.5\baselineskip}\noindent
% \DescribeMacro{\dealer}\MacroDef+{dealer}[\oarg{text}]\label{dealerX}
% \par\noindent
% \DescribeMacro{\vulner}\MacroDef+{vulner}[\oarg{text}]
% Both commands have 1 optional argument. If present it sets (and prints)
% the internal corresponding variable to this value, otherwise it only
% outputs the value of this internal variable.
% \par\vspace{0.5\baselineskip}\noindent
% \DescribeMacro{\dealertext}\MacroDef+{dealertext}[\oarg{text}]
% \par\noindent
% \DescribeMacro{\vulnertext}\MacroDef+{vulnertext}[\oarg{text}]
% These commands have also 1 optional argument. If present e.g.\
% |\dealertext[\North*]| this text is output in the form
% \example{\dealertext[\North*]}. If the German language is active then the
% call |\dealertext[\South*]| produces the text
% \foreignlanguage{german}{\example{\dealertext[\South*]}}. Calling
% |\dealertext| without an argument outputs the predefined text, which can
% be set with |\dealer|.\\
% Example:
% |\dealer[Jacob]\dealertext| produces \example{\dealer[Jacob]\dealertext}.
%
% \par\vspace{0.5\baselineskip}\noindent
% \DescribeMacro{\boardnr}\MacroDef+{boardnr}[\marg{Nr}]
% The macro |\boardnr| has 1 mandatory argument. If it is a number, it is
% considered to be the board number. The dealer and which side is
% vulnerable is then calculated from it and stored in the appropriate
% variables. If it is not a positive integer, it is considered user-defined
% text and will be stored and used \emph{as is}.
% \par\vspace{0.5\baselineskip}\noindent
% \DescribeMacro{\boardtext}\MacroDef*+{boardtext}[\Oarg{*}]
% The macro |\boardtext| has 1 token and no arguments. |\boardtext|
% retrieves only the board number (stored by calling |\boardnr|).
% |\boardtext*| outputs the board number with some additional (multilingual)
% text. |\boardnr{23}\boardtext| produces \example{\boardnr{23}\boardtext}
% whereas |\boardtext*| would produce \example{\boardtext*}.
% Note that |\boardnr| can have a non-integer argument.
% |\boardnr{Fun}\boardtext| produces \example{\boardnr{Fun}\boardtext} and
% with |\boardtext*| it would produce \example{\boardtext*}.
%
% \subsubsection{Sizing and Fonts}\label{Fonts}
%
% \noindent
% \DescribeMacro{\handskip}\MacroDef+{handskip}[\marg{length description}]
% This command has 1 mandatory argument: a \textbf{text} describing a
% length. |\handskip| enlarges the distance (default |1em|) between the
% rightmost hand and the |bidding| diagram. A negative value diminishes the
% distance.
% \par\vspace{0.5\baselineskip}
% \needspace{4\baselineskip}\noindent
% \DescribeMacro{\bidderfont}\MacroDef+{bidderfont}[\marg{font description}]
% \par\noindent
% \DescribeMacro{\compassfont}\MacroDef+{compassfont}[\marg{font description}]
% \par\noindent
% \DescribeMacro{\gamefont}\MacroDef+{gamefont}[\marg{font description}]
% \par\noindent
% \DescribeMacro{\legendfont}\MacroDef+{legendfont}[\marg{font description}]
% \par\noindent
% \DescribeMacro{\namefont}\MacroDef+{namefont}[\marg{font description}]
% \par\noindent
% \DescribeMacro{\otherfont}\MacroDef+{otherfont}[\marg{font description}]
% These commands all have 1 mandatory argument: a \textbf{description} of
% the font to be used. In the list below the command names are typeset in
% their default font.
% \begin{itemize}[itemsep=-2mm]
% \item {\mdseries\sffamily bidderfont}: Used for the player-names in the
% |bidding| diagram.\\ The default is |\mdseries\sffamily|.
% \item {\mdseries\sffamily compassfont}: Used for the directions and the
% ''midvalue'' in the compass. The default is |\mdseries\sffamily|.
% \item {\bfseries\sffamily gamefont}: Used for card diagrams, hands and
% suits.\\ The default is |\bfseries\sffamily|.
% \item {\mdseries\rmfamily legendfont}: Used for the conditions in
% card diagrams.\\ The default is |\mdseries\rmfamily|.
% \item {\mdseries\slshape namefont}: Used for the real world names in 
% |bidding| diagrams.\\ The default is |\mdseries\slshape|.
% \item {\bfseries\sffamily otherfont}: Used for the other bridge
% expressions, also outside diagrams. The default is |\bfseries\sffamily|.
% \end{itemize}
% If a new font is
% defined, all relevant dimensions of the card diagrams (including the
% |NESW| compass, the |bidding| diagram etc.) will be recalculated.
% Some examples for setting the gamefont to a new value are:
% \begin{itemize}[itemsep=-2mm]
% \item |\gamefont{\sffamily\bfseries\HUGE}| to get \emph{HUGE} diagrams.
% Refer to the documentation of package \packname{moresize} for details.
% \item |\legendfont{\smaller}| to diminish the text in the card diagram
% conditions a little. Refer to the
% documentation of package \packname{relsize} for details.
% \item |\gamefont{\sffamily\scalefont{3}}|\footnote{needs package
% scalefnt} to typeset real big diagrams for overhead sheets
% \end{itemize}
% \needspace{4\baselineskip}\noindent
%
% \subsection{Misc}
%
% Many of the text producing macros have in common that they can produce 4
% different versions of the text they represent. Normally, without any
% token, they produce the 
% lowercase text. With the token~|*| they produce the capitalised text.
% With the token |!| they produce some abbreviation of the text (if
% available). Finally with both tokens~|*!| the produce the capitalised
% abbreviation of the text. What exactly is produced, is shown in the
% macro descriptions. In some cases it seems rather strange to have the
% code for an abbreviated form, i.e.\ |\Lead[*!]|, because it produces only
% the variants \Lead and  \Lead*. But remember that we also support automatic
% translations into other languages and that in another language an
% abreviationt might be feasible: With the german language active |\Lead*|
% and |\Lead*!| produce \foreignlanguage{german}{\example{\Lead*}} and
% \foreignlanguage{german}{\example{\Lead*!}} respectively.

% At the other
% hand it seems peculiar to let |\Ace!| produce \example{\Ace!} for an
% Ace. But we do not foresee which modern novelist might want to produce
% this. That's why they are defined, but 'normal' writers probably will
% never used it.
%
% The short versions are primarily meant to be used within diagrams,
% allthough it is possible to get the long forms there too. Refer to page
% \pageref{Defaults} for details. We show the output of such a macro
% |\Macro| (note the capital~|M|!) in the form:
% \par\vspace{0.3\baselineskip}\noindent
% \MacroDef{Macro}[\Oarg{*!}\hfill \cmd{\Macro} (\cmd{\Macro*}, \cmd{\Macro!}, \cmd{\Macro*!})]
% In addition to each macro |\Macro| with its 4 variants, we also create a
% macro |\macro| which is defined to output the most used variant of
% |\Macro|:
% \par\vspace{0.3\baselineskip}\noindent
% \MacroDef{macro}[\hfill most used variant of \cmd{\Macro}]
% \par\vspace{0.3\baselineskip}\noindent
% It is very easy to redefine |\macro|.\label{ReDefine}
%  As an example we take the macro |\ace|. Its definition is:
% \par
% |\def\ace{\Ace*!}|\\
% so calling |\ace| will produce \example{\ace}. If somewhere in your
% document you redefine |\ace| to be 
% \par
% |\def\ace{\Ace*}|\\
% {\def\ace{\Ace*} then |\ace| will produce \example{\ace}} rather than \example{\ace}.
%
% \subsubsection{Honor Cards}
%
% \noindent
% \DescribeMacro{\Ace}\MacroDef*+{Ace}[\Oarg{*!}\hfill \Ace (\Ace*, \Ace!, \Ace*!)]
% \par\noindent
% \DescribeMacro{\ace}\MacroDef*+{ace}[\hfill \ace]
% \par\noindent
% \DescribeMacro{\King}\MacroDef*+{King}[\Oarg{*!}\hfill \King (\King*, \King!, \King*!)]
% \par\noindent
% \DescribeMacro{\king}\MacroDef*+{king}[\hfill \king]
% \par\noindent
% \DescribeMacro{\Queen}\MacroDef*+{Queen}[\Oarg{*!}\hfill \Queen (\Queen*, \Queen!, \Queen*!)]
% \par\noindent
% \DescribeMacro{\queen}\MacroDef*+{queen}[\hfill \queen]
% \par\noindent
% \DescribeMacro{\Jack}\MacroDef*+{Jack}[\Oarg{*!}\hfill \Jack (\Jack*, \Jack!, \Jack*!)]
% \par\noindent
% \DescribeMacro{\jack}\MacroDef*+{jack}[\hfill \jack]
% These commands produce the language dependent names for the honor
% cards. To be used primarily when adding a lead to a card diagram.
%
% \subsubsection{Variants of Basic Symbols}
%
% In section \ref{BasicSym} we already described the macros for the main
% variant. Here we introduce the macros that handle 4 variants with a
% combination of the tokens |*| and |!|.
% \par\noindent
% We start with the variants for |\NT| 
% \par\vspace{0.3\baselineskip}\noindent
% \DescribeMacro{\nt}\MacroDef*+{nt}[\Oarg{*!}\hfill \nt (\nt*, \nt!, \nt*!)]
% \par\noindent
% Next we show the 4 macros for the non-bid calls:
% \par\vspace{0.3\baselineskip}\noindent
% \DescribeMacro{\Pass}\MacroDef*+{Pass}[\Oarg{*!}\hfill \Pass (\Pass*, \Pass!, \Pass*!)]
% \par\noindent
% \DescribeMacro{\Allpass}\MacroDef*+{Allpass}[\Oarg{*!}\hfill \Allpass
% (\Allpass*, \Allpass!, \Allpass*!)]
% \par\noindent
% \DescribeMacro{\Double}\MacroDef*+{Double}[\Oarg{*!}\hfill \Double (\Double*,
% \Double!, \Double*!)]
% \par\noindent
% \DescribeMacro{\Redouble}\MacroDef*+{Redouble}[\Oarg{*!}\hfill \Redouble
% (\Redouble*, \Redouble!, \Redouble*!)]
% \par\noindent
% Next come the 6 macros for the symbolic names of players and axes.
% \par\vspace{0.5\baselineskip}\noindent
% \needspace{4\baselineskip}\noindent
% \DescribeMacro{\North}\MacroDef*+{North}[\Oarg{*!}\hfill \North (\North*, \North!, \North*!)]
% \par\noindent
% \DescribeMacro{\East}\MacroDef*+{East}[\Oarg{*!}\hfill \East (\East*, \East!, \East*!)]
% \par\noindent
% \DescribeMacro{\South}\MacroDef*+{South}[\Oarg{*!}\hfill \South (\South*, \South!, \South*!)]
% \par\noindent
% \DescribeMacro{\West}\MacroDef*+{West}[\Oarg{*!}\hfill \West (\West*, \West!, \West*!)]
% \par\vspace{0.5\baselineskip}\noindent
% \DescribeMacro{\NorthSouth}\MacroDef*+{NorthSouth}[\Oarg{*!}\hfill \NorthSouth (\NorthSouth*, \NorthSouth!, \NorthSouth*!)]
% \par\noindent
% \DescribeMacro{\EastWest}\MacroDef*+{EastWest}[\Oarg{*!}\hfill \EastWest (\EastWest*, \EastWest!, \EastWest*!)]
% \par\noindent
% The 4 commands that typeset the \emph{point-unit}
% \par\vspace{0.5\baselineskip}\noindent
% \DescribeMacro{\hpts}\MacroDef*+{hpts}[\Oarg{*!}\hfill \hpts (\hpts*, \hpts!, \hpts*!)]
% \par\noindent
% \DescribeMacro{\tpts}\MacroDef*+{tpts}[\Oarg{*!}\hfill \tpts (\tpts*, \tpts!, \tpts*!)]
% \par\noindent
% \DescribeMacro{\lpts}\MacroDef*+{lpts}[\Oarg{*!}\hfill \lpts (\lpts*, \lpts!, \lpts*!)]
% \par\noindent
% \DescribeMacro{\dpts}\MacroDef*+{dpts}[\Oarg{*!}\hfill \dpts (\dpts*, \dpts!, \dpts*!)]
% \par\noindent
% The forcing terms
% \par\vspace{0.5\baselineskip}\noindent
% \DescribeMacro{\gforce}\MacroDef*+{gforce}[\Oarg{*!}\hfill \gforce (\gforce*, \gforce!, \gforce*!)]
% \par\noindent
% \DescribeMacro{\sforce}\MacroDef*+{sforce}[\Oarg{*!}\hfill \sforce (\sforce*, \sforce!, \sforce*!)]
% \par\noindent
% \DescribeMacro{\nmforce}\MacroDef*+{nmforce}[\Oarg{*!}\hfill \nmforce (\nmforce*, \nmforce!, \nmforce*!)]
% \par\noindent
% \DescribeMacro{\tsforce}\MacroDef*+{tsforce}[\Oarg{*!}\hfill \tsforce (\tsforce*, \tsforce!, \tsforce*!)]
% \par\noindent
% \DescribeMacro{\fsforce}\MacroDef*+{fsforce}[\Oarg{*!}\hfill \fsforce (\fsforce*, \fsforce!, \fsforce*!)]
%
% \subsubsection{Conditions in Diagrams}\label{Conditions}
%
% These commands produce the langugage dependent expressions for
% \emph{\all, \none, \by, \board} etc. To be used primarily in card
% diagrams.
% \par\vspace{0.5\baselineskip}\noindent
% \DescribeMacro{\All}\MacroDef*+{All}[\Oarg{*!}\hfill \All (\All*, \All!, \All*!)]
% \par\noindent
% \DescribeMacro{\all}\MacroDef*+{all}[\hfill \all]
% \par\noindent
% \DescribeMacro{\None}\MacroDef*+{None}[\Oarg{*!}\hfill \None (\None*, \None!, \None*!)]
% \par\noindent
% \DescribeMacro{\none}\MacroDef*+{none}[\hfill \none]
% \par\noindent
% \DescribeMacro{\by}\MacroDef*+{by}[\hfill \by]
% \par\noindent
% \DescribeMacro{\Board}\MacroDef*+{Board}[\Oarg{*!}\hfill \Board (\Board*, \Board!, \Board*!)]
% \par\noindent
% \DescribeMacro{\board}\MacroDef*+{board}[\hfill \board]
% \par\noindent
% \DescribeMacro{\Contract}\MacroDef*+{Contract}[\Oarg{*!}\hfill \Contract (\Contract*, \Contract!, \Contract*!)]
% \par\noindent
% \DescribeMacro{\contract}\MacroDef*+{contract}[\hfill \contract]
% \par\noindent
% \DescribeMacro{\Declarer}\MacroDef*+{Declarer}[\Oarg{*!}\hfill \Declarer (\Declarer*, \Declarer!, \Declarer*!)]
% \par\noindent
% \DescribeMacro{\declarer}\MacroDef*+{declarer}[\hfill \declarer]
% \par\noindent
% \DescribeMacro{\Deal}\MacroDef*+{Deal}[\Oarg{*!}\hfill \Deal (\Deal*, \Deal!, \Deal*!)]
% \par\noindent
% \DescribeMacro{\deal}\MacroDef*+{deal}[\hfill \deal]
% \par\noindent
% \DescribeMacro{\Lead}\MacroDef*+{Lead}[\Oarg{*!}\hfill \Lead (\Lead*, \Lead!, \Lead*!)]
% \par\noindent
% \DescribeMacro{\lead}\MacroDef*+{lead}[\hfill \lead]
%
% \subsubsection{Annotations in Bidding Diagrams}
%
% \noindent
% \DescribeMacro{\alert}\MacroDef+{alert}[\hfill \alert]
% \par\noindent
% \DescribeMacro{\announce}\MacroDef+{announce}[\hfill \announce]
% \par\noindent
% These macros have no argument. With |\alert| one can mark a call that
% must be alerted with an asterisk (\alert) e.g.\ a weak 2\NT{} opening
% with |2\NT\alert|. It produces \example{2\NT\alert}. With |\announce| one
% can mark a bid with an 'A' (\announce) where an announcement is
% obligatory, e.g |2\He\announce| produces \example{2\He\announce}.
% \par\vspace{0.5\baselineskip}
% \needspace{4\baselineskip}\noindent
% \DescribeMacro{\markit}\MacroDef+{markit}
% \par\noindent
% \DescribeMacro{\explainit}\MacroDef+{explainit}[\marg{explanation}]
% These commands are to be used to mark a call in the |bidding| diagram and
% explain it with a kind of footnote-like mechanism, directly below the
% |bidding| diagram. Both |\markit| and |\explainit| step a counter for
% associating the explanation with the mark. |\markit| has no arguments;
% |\explainit| has one mandatory argument: the text to be displayed as
% explanation. |\explainit| should be called in the description part of
% |bidding| diagrams (or expertquiz). The text of the explanation is then
% typeset under the |bidding| diagram and has the same width.
% You can use newline (|\\|, or |\newline|) in your text to force an new
% line in the explanation\footnote{Using \bs par produces the error:
% \textbf{Runaway argument?\ldots}}.
% \needspace{6\baselineskip}%

% \subsubsection{Specials}
%
% \par\vspace{0.5\baselineskip}\noindent
% \DescribeMacro{\expertquiz}\MacroDef+{expertquiz}[\Oarg{*!}\oarg{comment}\marg{award}]
% This command displays a hand, a |bidding| sequence and some additional
% stuff. It is designed after the \emph{Expert Quiz} column in the
% \emph{Bridge Magazin} of the  \textsf{DBV}\footnote{Deutsche Bridge
% Verband}, the German Bridge Union.
% \\
% It has 2 optional tokens: a '|*|' for centering and a
% '|!|' which 1) forces the |bidding| diagram to appear on a new line, and
% 2) shifts the hand a bit to the right.
% Next there is one optional argument with wich some commentary information
% can be added. And finally there is 1 mandatory argument that describes the
% awards for certain solutions. Both the hand and the bidding must be
% defined before calling |\expertquiz|. One can do that by calling e.g.
% |\hand-| which suppresses the output of the hand.
%
% \subsubsection{Re-Initialization}
%
% \par\vspace{0.5\baselineskip}\noindent
% \DescribeMacro{\newgame}\MacroDef+{newgame}
% This command resets most bridge diagram data and can be used to start a
% new series of bridge diagrams. It is however not necessary to use
% |\newgame| if one enters new cards for the \north etc.\ hands. The list
% below shows which items are reset by calling |\newgame|
% \begin{itemize}
% \item resets |\boardnr{0}|.
% \item resets |headlinetext| and |footlinetext|.
% \item resets |LeftUpperText|, |LeftLowerText|, |RightUpperText| and
% |RightLowerText|.
% \item resets |northhand|, |easthand|, |southhand| and |westhand|.
% \item resets |namesNS| and |namesEW|.
% \item resets the checks for Spades, Hearts, Diamonds and Clubs.
% \end{itemize}
% \needspace{15\baselineskip}
% \par\vspace{0.5\baselineskip}\noindent
% \DescribeMacro{\setdefaults}\MacroDef+{setdefaults}[\Oarg{*}\string{\meta{key1=val1},\meta{key2=val2},\ldots\string}]\label{Defaults}
% \par\noindent
% \DeleteShortVerb{\|}
% \begin{tabular}{>{\ttfamily}l>{\ttfamily}l}
% key      & font \\\hline
% bidder   & bidderfont \\
% compass  & compassfont \\
% game     & gamefont \\
% legend   & legendfont \\
% name     & namefont \\
% other    & otherfont \\\hline
% \\
% key      & value \\\hline
% colors   & 0|1|\underline{2}|3|4A|4B \\
% warn     & \underline{off}|on \\
% err      & off|\underline{on} \\
% \hline
% \end{tabular}
% \qquad
% \begin{tabular}{>{\ttfamily}l>{\ttfamily}l}
% key      & value \\\hline
% compline & \meta{factor} \\
% compshow & off|\underline{on} \\
% compsize & \meta{factor} \\
% compturn & \underline{off}|on \\\hline
% \\
% key      & value  \\\hline
% bidders  & off|\underline{on} \\
% bidfirst & N|E|S|\underline{W} \\
% bidline  & \underline{off}|on \\
% bidlong  & off|\underline{on} \\
% \hline
% \end{tabular}
% \MakeShortVerb{\|}
% \par\vspace{\baselineskip}
% The macro |\setdefaults| uses a \meta{key}=\meta{val} mechanism. The
% tables above show which keys are available. The underlined key values are
% defaults. The available keys with respect to fonts are: |bidder|,
% |compass|, |game|, |legend|, |name| and |other|. In upper the table to
% the left the association between key and font is shown. A call e.g.\ 
% |\setdefaults{name=\bfseries\scriptsize}| will set the default for the
% namefont to the value specified. The starred form |\setdefaults*| will
% also call |\resetfonts|, which effectuates any change in a new default
% font immediately.
%
% In the lower table to the left you'll find the three keys that are also
% possible as package options. They have been described already in section
% \ref{Options}.
%
% The keys with respect to the compass are: |compline|, |compshow|,
% |compsize| and |compturn|. They are shown in the upper table to the
% right. With the first key one can set the linethickness of the compass
% frame, the default is |0.1em|. The second key controls whether the
% compass is shown or not. The third key controls the size of the compass,
% which per default is |2.5em|. With the fourth key one can rotate the
% letters for the \EastWest*! direction over 90°. The
% multiplication-\meta{factor}, which defaults to the value |1|, can have
% any non-negative real value.
%
% The keys with respect to the |bidding| diagram are: |bidders|, |bidfirst|,
% |bidline| and |bidlong|. They are shown in the lower table to the right.
% With the first key one can suppress the bidders in the bidding header.
% With the second key one can set which bidder appears in the first column
% of the diagram. The default is |W|. The third key controls whether an
% |\hline| is printed below the header. The fourth key switches between
% the long or short form of the non-bid calls, like \example{\pass} or
% \example{\Pass!}.
%
% For the key-value |on| we have the synonyms |true| and |1|, for the
% key-value |off| we have the synonyms |false| and |0|.
% \par\vspace{0.5\baselineskip}\noindent
% \DescribeMacro{\resetfonts}\MacroDef+{resetfonts}
% When calling this macro, all fonts are set back to their default value.
% This is the value that was explicitly set by a previous call of
% |\setdefaults|, or to the intrinsic default value if |\setdefaults| has
% not been called before.
%
% \subsection{Environments}
%
% In the first place we must warn the user for a peculiarity of the package
% \packname{collcell}, which is used to do some special processing in these
% 3 environments: \emph{The last row must either end with a newline} (|\\|)
% \emph{or with an \emph{empty} cell.}\par\noindent
% The advantage of the |collcell| processing is that within the |bidding|
% and |play| diagrams we can use shorthands for the suit symbols: rather
% than writing |3\Sp| in a |bidding| diagram we can also write |3S| to obtain
% 3\,\Sp. In the |play| diagram we could write |HA| instead of |\He\,\Ace|
% and get \He\,A as output. In |bidding| diagrams some non-bid calls may
% appear in short or in long form, controlled by calling
% |\setdfefaults{bidlong=on}|, which switches to the lang form, or
% |\setdfefaults{bidlong=off}| which switches to the short form.
% These non-bid calls are coded as follows: A small |p| yields short form
% \example{\Pass!} or long form \example{\pass}. A capital |P| yields short
% form \example{\Allpass*!} or long form \example{\allpass}. A capital |X|
% yields short form \example{\Double!} and long form \example{\double}. A
% capital |R| yields short form \example{\Redouble!} and long form
% \example{\redouble}.\footnote{due to the fact that |x| denotes a
% spotcard, we had to implement it this way}
% \par\vspace{0.5\baselineskip}\noindent
% \DescribeEnv{bidding}\EnvDef*+{bidding}[\Oarg{*!-}\oarg{pos}\parg{description}]\label{Bidding}
% This environment has 3 tokens. The '|*|' centers the |bidding| diagram.
% The '|!|' outputs the short form: e.g.\ \North*! rather than the long form
% \North* in the table heading. The '|-|' completely suppresses the output.
% The data is stored in a savebox and can be used in other macros, e.g.\ in
% all |\showXX| macros. Next come 2 optional parameters. The first
% one controls the alignment (default \textbf{c}) and the second one adds
% the list of annotations below the |bidding| diagram. With |\setdefaults|
% one can fine tune the look of the |bidding| diagram. Refer to page
% \pageref{Defaults} for details. For example
% \iffalse
%<*verb>
% \fi
\begin{verbnobox}[\small]
 \begin{bidding}(\explainit{WeakTwo}\explainit{preemptive})
   2H\markit & p & 3H\markit & p \\
 \end{bidding}
\quad
 \setdefaults{bidlong=off}
 \begin{bidding}!
   2H & p & 3H & p\\
 \end{bidding}\\
\end{verbnobox}
% \iffalse
%</verb>
% \fi
% produces\\
% \example{
% \begin{bidding}(\explainit{WeakTwo}\\\explainit{preemptive})
%  2H\markit & p & 3H\markit & p \\
% \end{bidding}
% \quad
% \setdefaults{bidlong=off}
% ^^A avoid clash with babel languages
% \shorthandoff{!}
% \begin{bidding}!
%  2H & p & 3H & p \\
% \end{bidding} 
% }
%
% \shorthandon{!}\setdefaults{bidlong=on}
% 
% \par\vspace{0.3\baselineskip}\noindent
% In addition to the shorthands we mentioned before, one can also use macros
% in the bidding and play diagrams. As long as these macros appear as 1
% single token in the diagram, no special care has to be taken. But if a
% macro appears as multiple tokens, e.g.\ like the call |\Pass*!|, which
% consists of the 3 tokens |\Pass|, |*| and |!|, then it \textbf{must} be
% enclosed in braces |{...}| to make it act as 1 token. Without the
% braces |\Pass*!| will produce \example{\Xfer{\Pass*!}}, with them
% |{\Pass*!}| will produce \example{\Xfer{{\Pass*!}}}.
% Note that although |\pass| expands to |\Pass*|, it wil produce the correct
% \example{\Xfer{\pass}}.
% \par\vspace{0.5\baselineskip}\noindent
% \DescribeEnv{biddingpair}\EnvDef*+{biddingpair}[\Oarg{*!-}\oarg{pos}\parg{descr}]
% This environment is essentially the same as the |bidding| environment, but 
% here the |bidding| diagram has only two columns rather than four.
% \par\vspace{0.5\baselineskip}\noindent
% \DescribeEnv{play}\EnvDef*+{play}[\Oarg{*}\marg{Lead}\oarg{Trump}]
% This environment has 1 token, a '|*|', which controls the centering of
% the table; 1 mandatory argument, denoting the opening lead and 1
% optional argument which specifies the trump suit, with default: \NT. It
% typesets a diagram with the sequence of playing tricks, by producing a
% table with 8 columns: the running number; the player who had
% had the lead; the 4 cards played in this trick and finally
% the 2 columns that show how many tricks \NorthSouth*!{} and \EastWest*!{}
% have won so far. The user has to specify only the columns 3-6, i.e.\ the
% cards that were played. Columns 1--2 and 7--8 are constructed by
% \OneDown. Just as in |bidding| diagrams, also here
% one can denote the suit with |S|, |H|, |D|, or |C|. The winning card is
% automatically detected, taking into account if a suit contract or \NT
% is played. The winning tricks counters are then updated automatically.
% Concerning consistency it is just as with hands and deals: If a card
% occurs more than one time, an error is raised and for missing cards a
% warning is issued.
% \\[0.3\baselineskip]
% \needspace{4\baselineskip}\noindent
% \otherfont{\sffamily\bfseries\footnotesize}
% \begin{minipage}{\linewidth}
% \begin{minipage}[b]{0.36\linewidth}
% 
% \iffalse
%<*verb>
% \fi
\begin{verbnobox}[\small]
\begin{play}{W}  \\
  D3 & 2 & Q & K \\
  HA & 5 & 4 & J \\
  C3 & 5 & K & A \\
\end{play}
\end{verbnobox}
% \iffalse
%</verb>
% \fi
%
% \end{minipage}
% \quad
% \example{
% \begin{play}{W}
%    D3 & 2 & Q & K \\
%    HA & 5 & 4 & J  \\
%    C3 & 5 & K & A \\
% \end{play}
% }
% \end{minipage}
%
% \needspace{8\baselineskip}\noindent
%
% \iffalse
%<*verb>
% \fi
\begin{verbnobox}[\small]
\begin{play}*{W} \\
  D3 & 2 & Q & K \\
  HA & 5 & 4 & J \\
  C3 & 5 & K & A \\
\end{play}
\end{verbnobox}
% \iffalse
%</verb>
% \fi
%
% produces the same diagram, but this time horizontally
% centered.\\[0.5\baselineskip]
% \example{
% \begin{minipage}{0.95\linewidth}
% \begin{play}*{W}
%    D3 & 2  & Q  & K \\
%    HA & 5  & 4  & J  \\
%    C3 & 5  & K  & A \\
% \end{play}
% \end{minipage}
% }
% \otherfont{\sffamily\bfseries\footnotesize}
%
% \section{Final Remarks}
%
% \subsection{Known Bugs}
%
% \begin{itemize}
%   \item Some dictionaries have questionable translations.
%   \item The boxes in |\northhand| and |\southhand| lead to problems with
%   shifting the \west hand. See file Legends in the example bundle.
% \end{itemize}
% \newpage
%
% \subsection{ToDo}
%
% \begin{itemize}[itemsep=-2mm]
%  \item Add the High Points to card diagrams (like Turnier in KA)
%  \item Check if |\def\xspace{}| is also needed in bidding...?
%  \item Make a template for showing 16 hands on 1 DIN A4 (3x5+1 or 4x4
%   landscape) e.g as handout for the hands on slides.
%  \item Read source files in PBN format. Example:
% \url{http://new.bridgekosice.sk/bridzove-diagramy-vykrelene-pomocou-tex/}
% \end{itemize}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% \subsection{Acknowledgements}
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% 
% This package is based on (ideas from) the style files:
% \begin{itemize}[itemsep=-2mm]
%  \item |bridge-i v1.0 (1995/04/16)| by René Steiner and Thomas Hof.
%  \item |kibitzer v1.0 (1995/04/16)| by René Steiner and Thomas Hof.
%  \item |bridge v0.1 (2012/03/18)| by Antony Lee.
%  \item |grbbridge v2.2 (2013/12/24)| by Gordon Bower.
% \end{itemize}
% 
% The style file |bridge-i| is based on the style file |bridge| v1.7c
% (1994/12/20) by J.L. Braams, which on itself was based on an article
% by Kees van der Laan in TUGboat (Vol 11 (1990), No 2: p265ff.
% \par
% Last but not least I want to thank all those wonderful people down
% there in the Internet who spent their time in answering silly questions
% and solving difficult problems. If I had imagined the difficulties I
% would encounter, then I would not have started this work. And without the
% help %of all these, to me unknown, people, this package would not exist.
%
% \StopEventually{}
%
% \section{Implementation}
%
% \iffalse
%<*package>
% \fi
%
% \subsection{Prelimaries}
%
% \subsubsection{Packages we depend upon}
%
% \label{RequirePackage}
%    \begin{macrocode}
\RequirePackage{%
  xcolor,%        colorizing symbols \Sp etc.
  textcomp,%      for the numbersign in environment play.
  moresize,%      add \HUGE and \ssmall to font-sizes
  relsize,%       relative font-sizes. (e.g. \smaller)
  makecmds,%      needed for provideenvironment
  expl3,%         needed for LaTeX3 packages (xparse)
  xparse,%        optional params and starred commands
  xspace,%        handling of spacing behind a command
  calc,%          makes calculations and lengths easier
  ifthen,%        easy booleans, tests and loops
  adjustbox,%     stacked boxes in L-/R-Lower captions
  translations,%  auto-translate terms (e.g. East->Ost)
  array,%         actions for tabular column cells 
  collcell,%      macro calls for tabular column cells
  pgfopts,%       for keyval opts, loads also pgfkeys
  environ,%       for handling bidding environments
  xstring,%       for easy string processing.
  tracklang,%     for iterating over loaded languages
  pict2e,%        for drawing the compass
}
%    \end{macrocode}
%\noindent
% Add exceptions for xspace
%    \begin{macrocode}
\xspaceaddexceptions{%
  = \markit \, \suit \GetTranslation
  2 3 4 5 6 7 8 9 T J Q K A
}
%    \end{macrocode}
% Load the fallback dictionary. This is the default one and equals the
% English dictionary. All other dictionaries are loaded on the fly, when
% needed, provided they are in the \TeX-path.
%
%    \begin{macrocode}
\LoadDictionaryFor{fallback}{ODw}
%    \end{macrocode}
%
% \subsubsection{Options}
%
% We use the \packname{pgf} \meta{key}=\meta{val} system for our 
% options: |colors|, |warn| and |err|.
%    \begin{macrocode}
\pgfkeys{/ODw/.is family}
\def\ODw@set#1{\pgfkeys{/ODw,#1}}
\ODw@set{colors/.is choice,}
\ODw@set{warn/.is choice,}
\ODw@set{err/.is choice,}
%    \end{macrocode}
% The details for option |colors| are on page \pageref{Colors}ff and those for
% option |warn| and |err| on page \pageref{Messages}.
%
% \subsubsection{Misc}
%
% \begin{macro}{\,}\MacroDef{,}
% \begin{macro}{\thinspace}\MacroDef{thinspace}
% We redefine |\thinspace| (originally $\frac{1}{6}$em) to a smaller amount.
% That makes denominations like |3\Sp| (3\Sp) look better. The code is
% from:\\
% \url{https://tex.stackexchange.com/questions/181003/multiply-fine-tuning-with-a-thinspace}\\
% This code however doesn't work when coded within an own package, unless we
% use |\AtBeginDocument|. 
%    \begin{macrocode}
\AtBeginDocument{%
  \renewcommand{\,}[1][1]{%
    \ifmmode\mskip#1\thinmuskip%
     \else\thinspace[#1]\fi%
  }%
  \renewcommand{\thinspace}[1][1]{%
   \kern#1\dimexpr0.16667em\relax%
  }% 
}% AtBeginDocument
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \begin{macro}{\ODw@gsetlength}\MacroDef{ODw@gsetlength}[\marg{\bs len-name}\marg{len-value}]
% \noindent
%
% We need to store the length of certain objects that are within a
% group (the group is needed to keep the font-size changes local).
% Therefore we define macro |\ODw@gsetlength|
% that works globally. The code is based upon a solution on LaTeX
% StackExchange:\\
% (\url{https://tex.stackexchange.com/questions/406015/defining-macro-gsetlength-as-global-setlength-reliable})
%    \begin{macrocode}
\gdef\ODw@gsetlength#1#2{%
  \begingroup
    \setlength\skip@{#2}% local assign to scratch reg.
    \global#1=\skip@%     global assignment to #1;
  \endgroup%              restore \skip@ by endgroup.
}% ODw@gsetlength
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\ODw@append}\MacroDef{ODw@append}[\marg{tokens}]
% In the environment |play| we need to calculate the winning tricks for
% \NorthSouth*! and \EastWest*!\footnote{For details see page \pageref{Play}}.
% We store this information as a string in |\ODw@Scratch| and use
%  |\ODw@append| to accumulate them.
%    \begin{macrocode}
\gdef\ODw@append#1{%
  \bgroup%
    \edef\tmp{\the\ODw@Scratch #1}%
    \global\ODw@Scratch=\expandafter{\tmp}%
  \egroup%
}% ODw@append
%    \end{macrocode}
% \end{macro}
%
% \subsubsection{Variables}
%
% In this package we do use font relative sizing. That means that widths
% and skips are defined in terms of |em|, |ex| and |baselineskip|. On the
% other hand there are e.g.\ the real world names of the bidders, that must
% be recorded. Some of these the user should be able to control. Rather
% than forcing the user to do that directly with |\def| or |\renewcommand|
% we store all this information in internal variables, by defining a
% constant command. These variables can be set by calling a user command,
% that is associated with the variable. E.g.\ the variable |\ODw@Skipwidth|
% gets set by the command |\handskip|. The variables we use are:
% \par\vspace{0.5\baselineskip}\noindent
% \DescribeMacro{\ODw@BidderFont}
% Controlled by |\bidderfont|: the font used for the players (|bidding|).
% \par\noindent
% \DescribeMacro{\ODw@CompassFont}
% Controlled by |\compassfont|: the font used for the compass.
% \par\noindent
% \DescribeMacro{\ODw@GameFont}
% Controlled by |\gamefont|: the font used for all card diagrams
% \par\noindent
% \DescribeMacro{\ODw@LegendFont}
% Controlled by |\legendfont|: the font used for the annotations.
% \par\noindent
% \DescribeMacro{\ODw@NameFont}
% Controlled by |\namefont|: the font used for the real world names.
% \par\noindent
% \DescribeMacro{\ODw@OtherFont}
% Controlled by |\otherfont|: the font used for other bridge
% expressions, also outside diagrams.
% \par\vspace{0.5\baselineskip}\noindent
% \DescribeMacro{\ODw@BidderDefault}
% \DescribeMacro{\ODw@CompassDefault}
% \DescribeMacro{\ODw@GameDefault}
% \DescribeMacro{\ODw@LegendDefault}
% \DescribeMacro{\ODw@NameDefault}
% \DescribeMacro{\ODw@OtherDefault}
% These contain the default values for the fonts
% \par\vspace{5.5\baselineskip}\noindent
% \DescribeMacro{\ODw@North@Name}
% \DescribeMacro{\ODw@South@Name}
% Controlled by |\namesNS|: hold the real world names of the \north
% and the \south player.
% \par\vspace{0.5\baselineskip}\noindent
% \DescribeMacro{\ODw@East@Name}
% \DescribeMacro{\ODw@West@Name}
% Controlled by |\namesEW|: hold the real world names of the \east
% and the \west player. These names are typeset using the font specified with
% |\namefont|.
% \par\vspace{0.5\baselineskip}\noindent
% \DescribeMacro{ODw@BoardText}
% Controlled by |\boardtext|: holds the board number and extra text.\\
% \DescribeMacro{ODw@HeaderText}
% Controlled by |\headlinetext|: holds header information for card
% diagrams.\\
% \DescribeMacro{ODw@FooterText}
% Controlled by |\footlinetext|: holds footer information for card
% diagrams.\\
% \DescribeMacro{ODw@Last}
% Used in command |\ODw@Tricks|: to store the player that had the
% lead\footnote{see page \pageref{Last}}.\\
% \DescribeMacro{\ODw@Skipwidth}
% Controlled by |\handskip|: holds the distance between hand and bidding
% diagram. 
%    \begin{macrocode}
\def\ODw@CompSize{1}% factor to enlarge the compass
\def\ODw@CompLine{}%  thickness of compass frame
\def\ODw@Skipwidth{1em}%
%    \end{macrocode}
%
% \subsubsection{Booleans, Saveboxes, Lengths, Counters and Registers}
%
% \paragraph{Booleans}
%
% \DescribeMacro{\ifODw@description}
% |\ifODw@description| is used in the |bidding| environments and the
% command |\expertquiz| to test if there is an annotation that should
% be written.
% \par\noindent
% \DescribeMacro{\ifODw@short}
% |\ifODw@short| is used in the |bidding| environments and the command
% |\expertquiz| to denote if a short form of the diagram header is to be
% used.
% \par\noindent
% \DescribeMacro{\ifODw@monochrome}
% |\ifODw@monochrome| flags the case
% that the user specified |colors=0| or |colors=1|, i.e.\ just black and
% white. In this situation we will not print the vulnerable side in red,
% but use italics instead.
% \par\noindent
% \DescribeMacro{\ifOdW@CardSkip}
% |\ifOdW@CardSkip| determines whether we need some extra space between
% card ranks (i.e.\ in suit descriptions) or not (i.e.\ in |bidding| 
% or |play| diagrams).
% \par\noindent
% \DescribeMacro{\ifOdW@Bidders}
% |\ifODw@Bidders| suppresses the bidders in the bidding header.
% \par\noindent
% \DescribeMacro{\ifOdW@BidLine}
% |\ifODw@BidLine| draw a |\hline| below the bidding header.
% \par\noindent
% \DescribeMacro{\ifOdW@LongCalls}
% |\ifODw@LongCalls| determines whether to use the short (like \North*!) or
% the long form (like \North*) for calls in the |bidding| diagram.
% \par\noindent
% \DescribeMacro{\ifOdW@CompShow}
% With |\ifODw@CompShow| one can suppress drawing a compass within card
% diagramns completely.
% \par\noindent
% \DescribeMacro{\ifOdW@CompTurn}
% With |\ifODw@CompTurn| one rotates letters |E| and |W| in the
% compass 90°.
%    \begin{macrocode}
\newif\ifODw@description% must typeset an annotation
\newif\ifODw@short%       short form in bidding header
\newif\ifODw@monochrome%  no colors wanted
\newif\ifOdW@CardSkip%    skip between ranks needed
%    \end{macrocode}
% The next booleans are directly controlled by |\setdefaults|.
%    \begin{macrocode}
\newif\ifODw@Bidders%    suppress bidders in bidding header
\newif\ifODw@BidLine%    draw \hline below bidding header
\newif\ifODw@LongCalls%  switch between long/short calls
\newif\ifODw@CompShow%   show compass or not
\newif\ifODw@CompTurn%   turn E-W letters 90°
%    \end{macrocode}
% \begin{macro}{\ODw@EmptyHeader}
% \begin{macro}{\ODw@EmptyFooter}
% Since there seems to be a problem in using\label{Empty}
% |\ifthenelse|\footnote{\textbf{ifthenelse} bites \textbf{multicolumn}!}
% in particular places, these booleans are set by calling |ODw@TestIfEmpty|
% (which uses an ordinary |\ifthenelse|) \emph{outside} the dangerous
% places, and then use e.g.\ |\ifODw@EmptyHeader| as a test whether the
% header is empty or not.
%    \begin{macrocode}
\newboolean{ODw@EmptyHeader}% = 'header is empty'
\newboolean{ODw@EmptyFooter}% = 'footer is empty'
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \paragraph{Saveboxes}
% \DescribeMacro{\ODw@Diagram@Box}
% |\ODw@Diagram@Box| is to store the actual card diagram (the compass
% with the hands) in order to calculate its width.
% \par\noindent
% \DescribeMacro{\ODw@BidBox}
% |\ODw@BidBox| stores a |bidding| diagram. 
% \par\noindent
% \DescribeMacro{\ODw@Hand@Box}
% |\ODw@Hand@Box| stores a hand with the 4 suits. 
% \par\noindent
%    \begin{macrocode}
\newsavebox\ODw@Diagram@Box
\newsavebox\ODw@Hand@Box
\newsavebox\ODw@BidBox
%    \end{macrocode}
% \paragraph{Lengths}
% \DescribeMacro{\ODw@Bid@Width}
% Is used to store the actual width of the |bidding| diagram.
% \par\noindent
% \DescribeMacro{\ODw@Card@Skip} Defines space between
% adjacent cards in suits.
% \par\noindent
% \DescribeMacro{\ODw@Diagram@Width} Defines the width of compass plus
% (\EastWest*!) hands.
% \par\noindent
% \DescribeMacro{\ODw@Skip@Width} Defines the distance between the card
% diagram and the |bidding| diagram.
% \par\noindent
% \DescribeMacro{\ODw@Tmp@Len}
% \par\noindent
% \DescribeMacro{\ODw@Tmp@Width} Auxiliary lengths, used in several
% calculations.
% \par\noindent
%    \begin{macrocode}
\newlength\ODw@Compasssize% the size of the compass.
\newlength\ODw@Diagram@Width
\newlength\ODw@Card@Skip
\setlength\ODw@Card@Skip{.15em}% space between cards
\newlength\ODw@Bid@Width
\newlength\ODw@Skip@Width
  \setlength\ODw@Skip@Width{\ODw@Skipwidth}
\newlength\ODw@Tmp@Len%   temp var for computations
\newlength\ODw@Tmp@Width% temp var for computations
%    \end{macrocode}
% \paragraph{Counters}
% \DescribeMacro{ODw@Nr} Counts lines (in |play| diagrams) and explanations
% (in |bidding| diagrams).
%    \begin{macrocode}
\newcounter{ODw@Nr}
%    \end{macrocode}
% \par\noindent
% \DescribeMacro{ODw@Cnt} Auxiliary counter, used in several calculations.
%    \begin{macrocode}
\newcounter{ODw@Cnt}
%    \end{macrocode}
% \par\noindent
% \DescribeMacro{ODw@PlayerNr} Set to the player that won the trick in
% environment |play|.
%    \begin{macrocode}
\newcounter{ODw@PlayerNr}
%    \end{macrocode}
% \par\noindent
% \DescribeMacro{ODw@NSCnt} Holds the number of N-S tricks in environment
% |play|.
%    \begin{macrocode}
\newcounter{ODw@NSCnt}
%    \end{macrocode}
% \par\noindent
% \DescribeMacro{ODw@EWCnt} Holds the number of E-W tricks in environment
% |play|.
%    \begin{macrocode}
\newcounter{ODw@EWCnt}
%    \end{macrocode}
% \paragraph{Registers}
% \DescribeMacro{ODw@Scratch} Tempory store for winning tricks in
% environment |play|.
%    \begin{macrocode}
\newtoks{\ODw@Scratch}
%    \end{macrocode}
%
% \subsubsection{Fonts}
%
% \paragraph{Text Fonts}
%
% Here we merely define the commands to set the default fonts. At the end
% of this .sty file they are set to their value. Refer to
% section~\ref{Init} for details.
% \begin{macro}{\bidderfont}
% \begin{macro}{\ODw@BidderFont}
% The font used to indicate the symbolic player (N, E, S, W) in bidding
% diagrams. The default is |\mdseries\sffamily|.
%    \begin{macrocode}
\newcommand\bidderfont[1]{\gdef\ODw@BidderFont{#1}}
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\compassfont}
% \begin{macro}{\ODw@CompassFont}
% The font used to indicate the directions (N, E, S, W) in the compass. The
% default is |\mdseries\sffamily|.
%    \begin{macrocode}
\newcommand\compassfont[1]{\gdef\ODw@CompassFont{#1}}
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\namefont}
% \begin{macro}{\ODw@NameFont}
% The font used for the real world names of the players in bidding
% diagrams. The default id |\mdseries\slshape|.
%    \begin{macrocode}
\newcommand\namefont[1]{\gdef\ODw@NameFont{#1}}
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\legendfont}
% \begin{macro}{\ODw@LegendFont}
% The font used for the conditions in card diagrams. The default is
% |\mdseries\rmfamily|.
%    \begin{macrocode}
\newcommand\legendfont[1]{\gdef\ODw@LegendFont{#1}}
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\otherfont}
% \begin{macro}{\ODw@OtherFont}
% The font used for the other bridge expressions like |\north|, |\pass| or
% |\double|. The default is |\bfseries\sffamily|.
%    \begin{macrocode}
\newcommand\otherfont[1]{\gdef\ODw@OtherFont{#1}}
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\gamefont}
% The font for the hands and calls. It sets the general font-size/widths for
% the game. The default is |\bfseries\sffamily|.
% \par\noindent
% \begin{macro}{\ODw@GameFont}
% We use widths that are dynamically adjusted at font changes and store the
% 'value' as text in |\ODw@GameFont|.
% \par\noindent
% \begin{macro}{\ODw@GameSize}
% |\ODw@GameSize| recalculates these
% sizes and is called in all show- and bid-diagrams.
%    \begin{macrocode}
\newcommand\gamefont[1]{%
  \gdef\ODw@GameFont{#1}%
  \gdef\ODw@GameSize{% recalculate dimens for the new font
    \ODw@GameFont%
    \setlength\ODw@Skip@Width{\ODw@Skipwidth}%
  }%
}% gamefont
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \paragraph{Symbol Font}
% We need special symbols to get solid colored \He{} and \Di, rather than
% \textcolor{red}{\ensuremath{\heartsuit}}{} and 
% \textcolor{red}{\ensuremath{\diamondsuit}}. We use those from |stix|.
% As the shape of the 'normal' black suits differ from the red ones we also
% take the black suits from the font |stix|. First we define the symbols
% and font. As we do not want to load the complete package, we only use
% the relevant piece of code found in |txfont.sty|:
%    \begin{macrocode}
\fontencoding{T1}\fontfamily{stix}
\fontseries{m}\fontshape{n}\selectfont
%
% Code stolen from txfonts.sty.
% It works smoothly: thank you guys!
% Because of an interference with package newtxmath I had to rename
% symbols into ODw@symbols and symbolsC into ODw@symbolsC
%
\DeclareSymbolFont{ODw@symbols}{OMS}{txsy}{m}{n}
\SetSymbolFont{ODw@symbols}{bold}{OMS}{txsy}{bx}{n}
\DeclareFontSubstitution{OMS}{txsy}{m}{n}
\DeclareSymbolFont{ODw@symbolsC}{U}{txsyc}{m}{n}
\SetSymbolFont{ODw@symbolsC}{bold}{U}{txsyc}{bx}{n}
\DeclareFontSubstitution{U}{txsyc}{m}{n}
%    \end{macrocode}
% \begin{macro}{\ODw@spadesuit}
%    \begin{macrocode}
\DeclareMathSymbol{\ODw@spadesuit}{\mathord}{ODw@symbols}{127}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\ODw@varheart}
%    \begin{macrocode}
\DeclareMathSymbol{\ODw@varheart}{\mathord}{ODw@symbolsC}{114}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\ODw@vardiamond}
%    \begin{macrocode}
\DeclareMathSymbol{\ODw@vardiamond}{\mathord}{ODw@symbolsC}{113}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\ODw@clubsuit}
%    \begin{macrocode}
\DeclareMathSymbol{\ODw@clubsuit}{\mathord}{ODw@symbols}{124}
%    \end{macrocode}
% \end{macro}
%
% \subsection{Bridge Basic Terms}
%
% \subsubsection{Suit Symbols}
%
% First we supply shorthands for the `five' suits (\Cl, \Di, \He, \Sp and
% \NT) that are used in the game of bridge.
% We define the international version with the English shortcuts. We use
% the |xcolor| package to colorize the suit symbols. The color can be set
% as an \meta{key}=\meta{val} option when loading the package. The option
% |colors=0| means mono-color (black only), synonyms of key 0 are |mono|
% and |black|. |colors=1| means black and white, a synonym is |b+w|.
% |colors=2| means bi-color (black and red), with synonym |b+r|.
% |colors=3| means grey, with synonyms |gray| and |grey|. This 'color' is meant for special
% effects, e.g. for making unimportant parts less visible
% |colors=4A| gives qua-color (green, orange, red and blue); synonyms are
% |fourA| and |4a|. Finally |colors=4B| defines the second qua-color (black,
% orange, red and green) with synonyms |fourB| and |4b|. 
%
% We precede all the suit symbols with a `very-thin-space' (|\,[0.3]|)
% which is 0.3 the size of a normal |\thinspace|.\label{Colors}
%
% In order to test which suit (|\Cl|,\ldots) was encountered in
% |\ODw@translate|\footnote{see page \pageref{Translate}} we \emph{must}
% define the suits with a |renewrobustcommand|. So we must |\def| them
% first.
%
% \changes{v0.6a}{2018/03/15}{\\
% - 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}
% }
%
%    \begin{macrocode}
% \def them first and then use renewrobustcmd! 
\def\Cl{}\def\Di{}\def\He{}\def\Sp{}%
\ODw@set{%
 colors/0/.code={%
  \ODw@monochrometrue%
  \renewrobustcmd\Cl{\textcolor{black}%
   {\,[0.3]\ensuremath{\ODw@clubsuit}}\xspace}%
  \renewrobustcmd\Di{\textcolor{black}%
   {\,[0.3]\ensuremath{\ODw@vardiamond}}\xspace}%
  \renewrobustcmd\He{\textcolor{black}%
   {\,[0.3]\ensuremath{\ODw@varheart}}\xspace}%
  \renewrobustcmd\Sp{\textcolor{black}%
   {\,[0.3]\ensuremath{\ODw@spadesuit}}\xspace}%
 }%
}
\ODw@set{colors/mono/.code={\pgfkeys{/ODw/colors=0}}}
\ODw@set{colors/black/.code={\pgfkeys{/ODw/colors=0}}}
%
\ODw@set{%
 colors/1/.code={%
  \ODw@monochrometrue%
  \renewrobustcmd\Cl{\textcolor{black}%
   {\,[0.3]\ensuremath{\ODw@clubsuit}}\xspace}%
  \renewrobustcmd\Di{\,[0.3]\ensuremath{\diamondsuit}\xspace}%
  \renewrobustcmd\He{\,[0.3]\ensuremath{\heartsuit}\xspace}%
  \renewrobustcmd\Sp{\textcolor{black}%
   {\,[0.3]\ensuremath{\ODw@spadesuit}}\xspace}%
 }%
}
\ODw@set{colors/b+w/.code={\pgfkeys{/ODw/colors=1}}}
%
\ODw@set{%
 colors/2/.code={%
  \ODw@monochromefalse%
  \renewrobustcmd\Cl{\textcolor{black}%
   {\,[0.3]\ensuremath{\ODw@clubsuit}}\xspace}%
  \renewrobustcmd\Di{\textcolor{red}%
   {\,[0.3]\ensuremath{\ODw@vardiamond}}\xspace}%
  \renewrobustcmd\He{\textcolor{red}%
   {\,[0.3]\ensuremath{\ODw@varheart}}\xspace}%
  \renewrobustcmd\Sp{\textcolor{black}%
   {\,[0.3]\ensuremath{\ODw@spadesuit}}\xspace}%
 }%
}
\ODw@set{colors/b+r/.code={\pgfkeys{/ODw/colors=2}}}
%
\ODw@set{%
 colors/3/.code={%
  \ODw@monochromefalse%
  \renewrobustcmd\Cl{\textcolor{gray}%
   {\,[0.3]\ensuremath{\ODw@clubsuit}}\xspace}%
  \renewrobustcmd\Di{\textcolor{gray}%
   {\,[0.3]\ensuremath{\ODw@vardiamond}}\xspace}%
  \renewrobustcmd\He{\textcolor{gray}%
   {\,[0.3]\ensuremath{\ODw@varheart}}\xspace}%
  \renewrobustcmd\Sp{\textcolor{gray}%
   {\,[0.3]\ensuremath{\ODw@spadesuit}}\xspace}%
 }%
}
\ODw@set{colors/grey/.code={\pgfkeys{/ODw/colors=3}}}
\ODw@set{colors/gray/.code={\pgfkeys{/ODw/colors=3}}}
%
\ODw@set{%
 colors/4A/.code={%
  \ODw@monochromefalse%
  \renewrobustcmd\Cl{\textcolor{green}%
   {\,[0.3]\ensuremath{\ODw@clubsuit}}\xspace}%
  \renewrobustcmd\Di{\textcolor{orange}%
   {\,[0.3]\ensuremath{\ODw@vardiamond}}\xspace}%
  \renewrobustcmd\He{\textcolor{red}%
   {\,[0.3]\ensuremath{\ODw@varheart}}\xspace}%
  \renewrobustcmd\Sp{\textcolor{blue}%
   {\,[0.3]\ensuremath{\ODw@spadesuit}}\xspace}%
 }%
}
\ODw@set{colors/fourA/.code={\pgfkeys{/ODw/colors=4A}}}
\ODw@set{colors/4a/.code={\pgfkeys{/ODw/colors=4A}}}
%
\ODw@set{%
 colors/4B/.code={%
  \ODw@monochromefalse%
  \renewrobustcmd\Cl{\textcolor{black}%
   {\,[0.3]\ensuremath{\ODw@clubsuit}}\xspace}%
  \renewrobustcmd\Di{\textcolor{orange}%
   {\,[0.3]\ensuremath{\ODw@vardiamond}}\xspace}%
  \renewrobustcmd\He{\textcolor{red}%
   {\,[0.3]\ensuremath{\ODw@varheart}}\xspace}%
  \renewrobustcmd\Sp{\textcolor{green}%
   {\,[0.3]\ensuremath{\ODw@spadesuit}}\xspace}%
 }%
}
\ODw@set{colors/fourB/.code={\pgfkeys{/ODw/colors=4B}}}
\ODw@set{colors/4b/.code={\pgfkeys{/ODw/colors=4B}}}
%    \end{macrocode}
%
% \begin{macro}{\nt}
% \begin{macro}{\NT}
% Because some languages use a different symbol for \NT{} (\nt*) we must
% look it up in the dictionary to find e.g.\ \Translate{\NT}
% (\Translate{\nt*}) for German.
%    \begin{macrocode}
\NewDocumentCommand\nt{s t!}{%
  \bgroup%
    \ODw@OtherFont%
    \IfBooleanTF#1{%
      \IfBooleanTF#2
        {\,[0.3]\GetTranslation{NT-(ODw)}}%
        {\GetTranslation{No Trump-(ODw)}}%
      }{%
      \IfBooleanTF#2
        {\,[0.3]\GetTranslation{nt-(ODw)}}%
        {\GetTranslation{no trump-(ODw)}}%
    }%
  \egroup%
  \xspace%
}% nt
%    \end{macrocode}
% Define a practical shorthand to produce \NT{} without the need to add a
% token.
%    \begin{macrocode}
\def\NT{\nt*!}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \par\vspace{0.3\baselineskip}\noindent
% \begin{macro}{\ODw@SetRank}\MacroDef{ODw@SetRank}[\marg{card rank}]
% |\ODw@SetRank| stores the rank of the card played in |\ODw@Rank|. This is
% essentially the intrinsic rank of the card (\emph{2} for a 2, \emph{14}
% for an Ace), but there are special cases:
% \begin{itemize}[itemsep=-2mm,topsep=-1em]
%  \item Spot cards (denoted with \emph{x}) always get rank 0
%  \item Discards always get rank 0
%  \item Trump cards get 15 (\emph{15} to ensure that a spot trump card
%  defeats an Ace) added to the intrinsic rank, to make sure
%   that:
%   \begin{itemize}[itemsep=-1mm,topsep=-0.3em]
%    \item A trump card will defeat all other cards
%    \item The highest trump card will win the trick
%   \end{itemize}
% \end{itemize}
% \par\vspace{0.5\baselineskip}
% We first define three variables, one to store the suit of the actual card,
% the second one to store which suit was led and the last variable
% to store which suit is the trump suit, all initialized with the '\NT-suit'.
%    \begin{macrocode}
\gdef\ODw@SuitPlayed{N}
\gdef\ODw@SuitLead{N}
\gdef\ODw@TrumpSuit{N}
\newcounter{ODw@Rank}
%    \end{macrocode}
%    \begin{macrocode}
\def\ODw@SetRank#1{%
  \ifthenelse{\equal{\ODw@SuitPlayed}{\ODw@SuitLead}}%
  % if a suit is followed, store the intrinsic rank
    {\setcounter{ODw@Rank}{#1}}%
    {% else, if a suit is not followed then ...
  % (at NoTrump, the trumpsuit is coded 'N' and will
  % never match a real suit (coded C, D, H and S))
  % thus avoiding that trump cards are detected
       \ifthenelse{\equal{\ODw@SuitPlayed}{\ODw@TrumpSuit}}%
  % if it is a trump card, increase the rank
         {\setcounter{ODw@Rank}{#1}%
          \addtocounter{ODw@Rank}{15}}%
  % if it is a discard, set the rank to 0 to make
  % sure it will never win
         {\setcounter{ODw@Rank}{0}}%
    }% ifthen
  % If the card was of another suit,
  %    then ODw@SuitPlayed was changed.
  % If we encounter 'unsuited' cards, 
  %    then we must reestablish the 
  %    original ODw@SuitPlayed. 
    \global\edef\ODw@SuitPlayed{\ODw@SuitLead}% org. suit
}% ODw@SetRank
%    \end{macrocode}
% \end{macro}
% \par\vspace{0.3\baselineskip}\noindent
% \begin{macro}{\ODw@Xfer}\MacroDef{ODw@Xfer}[\marg{tokens}]
% This macro gets called by |ODw@Tfer| which is automatically called in the
% environments |play|, |bidding| and |biddingpair| by means of
% |columntype P| and |columntype B| to convert at one hand the shorthand
% suit code in suit symbols and at the other hand to translate card honors
% into the active language. It also converts the card value |T| into
% \Xfer{T} and a hyphen into an en-dash. It calls |\ODw@translate| to do
% the work.
%
% The following code was contributed on StackExchange by egreg, see
% \url{https://tex.stackexchange.com/questions/417731/problem-with-xstring-ifeqcase-case-falls-thru/417788?noredirect=1#comment1045001_417788}
%    \begin{macrocode}
\ExplSyntaxOn
 % NB: now all spaces are ignored, use '~' if needed.
\NewDocumentCommand{\ODw@Xfer}{m}{
  \bgroup
  % we do not want spaces here
    \def\xspace{}
    \tl_map_function:nN {#1} \ODw@translate:n
  \egroup
}% ODw@Xfer
%    \end{macrocode}
% \end{macro}
% \par\vspace{0.3\baselineskip}\noindent
% \begin{macro}{\ODw@translate}\MacroDef{ODw@translate}[\marg{tokens}]
% |\ODw@translate| processes a (relatively short) string of tokens that
% determine an entry in |bidding| or |play| diagrams, and also
% in all situations where suits are defined. It gets called by |\ODw@Xfer|.
%
% It expects bridge stuff describing strings like |AKT54| to produce the
% suit \suit{AKT52}, |2H\alert| to produce the call
% \Xfer{2H\alert} in the |bidding| diagram, or |DA| to produce \Xfer{DA} as
% entry in the |play| diagram to show that the ace of diamonds was played.
% Please note that constructs like |\textit{DA}| or |\frame{2H}| are not
% allowed and will produce rather misleading errors like:\\
% \example{|! Argument of \bs ODw@translate:n has an extra \}.|} or \\
% \example{|! Missing number,treated as zero.|}\\[0.2\baselineskip]
% Even clever people who use |{\frame{2H}}| will get disoppointed, because
% they'll get \frame{2H} rather than the wanted \frame{2\He}. But the very
% clever people can reach their goal by using |{\frame{2\He}}| or
% |{\textit{\Di A}}|. 
% \par\vspace{0.5\baselineskip}
%    \begin{macrocode}
\cs_new_protected:Nn \ODw@translate:n
 {
  \setcounter{ODw@Rank}{0}
  \str_case:nnTF {#1}
   { % Store the suit of the card played
     % needed to determine the winner
     % and for checking for multiple cards
     {C}{\Cl\gdef\ODw@SuitPlayed{C}}
     {D}{\Di\gdef\ODw@SuitPlayed{D}}
     {H}{\He\gdef\ODw@SuitPlayed{H}}
     {S}{\Sp\gdef\ODw@SuitPlayed{S}}
     {N}{\NT\gdef\ODw@SuitPlayed{N}}
  % Translate a hyphen into an en-dash
     {-}{--}
  %
  % 1: translate the honour cards,
  % 2: store the played cards for checking
  % 3: and set their rank. This must be done last, because
  % \ODw@SetRank resets \ODw@SuitPlayed to \ODw@SuitLead
  % Honour Cards
  %        1                      2
     {A}{\Ace*!\ODw@AppendCard{\ODw@SuitPlayed}{A}
          \ODw@SetRank{14}}% 3
     {K}{\King*!\ODw@AppendCard{\ODw@SuitPlayed}{K}
          \ODw@SetRank{13}}
     {Q}{\Queen*!\ODw@AppendCard{\ODw@SuitPlayed}{Q}
          \ODw@SetRank{12}}
     {J}{\Jack*!\ODw@AppendCard{\ODw@SuitPlayed}{J}
          \ODw@SetRank{11}}
     {T}{\kern-0.1em1\kern-0.1em0% massage 1 and 0 a bit
         \ODw@AppendCard{\ODw@SuitPlayed}{T}\ODw@SetRank{10}}
  % Numeral Cards
     {9}{9\ODw@AppendCard{\ODw@SuitPlayed}{9}\ODw@SetRank{9}}
     {8}{8\ODw@AppendCard{\ODw@SuitPlayed}{8}\ODw@SetRank{8}}
     {7}{7\ODw@AppendCard{\ODw@SuitPlayed}{7}\ODw@SetRank{7}}
     {6}{6\ODw@AppendCard{\ODw@SuitPlayed}{6}\ODw@SetRank{6}}
     {5}{5\ODw@AppendCard{\ODw@SuitPlayed}{5}\ODw@SetRank{5}}
     {4}{4\ODw@AppendCard{\ODw@SuitPlayed}{4}\ODw@SetRank{4}}
     {3}{3\ODw@AppendCard{\ODw@SuitPlayed}{3}\ODw@SetRank{3}}
     {2}{2\ODw@AppendCard{\ODw@SuitPlayed}{2}\ODw@SetRank{2}}
  % A spot card has rank 0
     {x}{x\ODw@SetRank{0}}
  % 
  % Non cards (bidding only)
     {1}{1}% this enables e.g. 1\He in biddings
     {p}{\ifODw@LongCalls\Pass*\else\Pass!\fi}
     {P}{\ifODw@LongCalls\Allpass*\else\Allpass*!\fi}
     {X}{\ifODw@LongCalls\Double*\else\Double!\fi}
     {R}{\ifODw@LongCalls\Redouble*\else\Redouble!\fi}
   }% case
   {% if matched (case T(rue)) 
    \ifOdW@CardSkip\hspace{\ODw@Card@Skip}\fi
  % suit of 1st card (ODw@SuitLead) is ODw@SuitPlayed
   \if\theODw@PlayerNr1
     \global\edef\ODw@SuitLead{\ODw@SuitPlayed}
   \fi
   }
%    \end{macrocode}
% We offer the possibility that one can use also |\He| in |bidding| and
% |play| diagrams rather than just the abbreviation |H|. Therefore we must
% test which suit was given and set |\ODw@SuitPlayed| accordingly. To make
% this test work, we had to redefine the suit macros with an
% |\renewrobustcmd|.\label{Translate} Here we also issue |\expandafter{#1}|
% rather than just |#1|. Otherwise, among others, the coloring of the suit
% symbol would extend behind it. Curiously enough the phenomena does not
% occur anymore. I leave the expandafter in, until this is cleared.
%    \begin{macrocode}
   {% if not matched (case F(alse))
     \ifx#1\Cl\gdef\ODw@SuitPlayed{C}\fi
     \ifx#1\Di\gdef\ODw@SuitPlayed{D}\fi
     \ifx#1\He\gdef\ODw@SuitPlayed{H}\fi
     \ifx#1\Sp\gdef\ODw@SuitPlayed{S}\fi
     \expandafter{#1}% enables e.g. 1\He
   % suit of 1st card (ODw@SuitLead) is ODw@SuitPlayed
     \if\theODw@PlayerNr1
       \global\edef\ODw@SuitLead{\ODw@SuitPlayed}
     \fi
   }
}% ODw@translate
\ExplSyntaxOff
%    \end{macrocode}
% \end{macro}
% \par\vspace{0.3\baselineskip}\noindent
% \begin{macro}{\ODw@AppendCard}\MacroDef{ODw@AppendCard}[\marg{suit}\marg{card}]
% In order to do a simple consistency check in |play| diagrams, we
% need to store the cards that were played. We do that for each suit in the
% variable |\ODw@<suit>|. This macro is called in |\ODw@translate|, i.e.\ 
% for all situations where cards are to be manipulated. But the result of
% |\ODw@AppendCard| is used only within |play| diagrams. The macro
% |\ODw@appendcard| appends 1 character to a string.
% 
%    \begin{macrocode}
%
\newcommand{\ODw@appendcard}[2]{\xdef#1{#1#2}}

\newcommand\ODw@AppendCard[2]{%
  \IfEqCase{#1}{%
    {C}{\ODw@appendcard{\ODw@Clubs}{#2}}%
    {D}{\ODw@appendcard{\ODw@Diamonds}{#2}}%
    {H}{\ODw@appendcard{\ODw@Hearts}{#2}}%
    {S}{\ODw@appendcard{\ODw@Spades}{#2}}%
  }%
}% ODw@AppendCard
%    \end{macrocode}
% \end{macro}
% \par\vspace{0.3\baselineskip}\noindent
% \begin{macro}{\ODw@PTfer}\MacroDef{ODw@PTfer}[\marg{tokens}]
% This macro is called within |play| diagrams where we can write |HA| and
% get \Xfer{HA}. Also all relevant symbols get translated into the active
% language. We use the counter |ODw@PlayerNr| to determine the column in
% the |play| diagrams with the winning card, and from this we can compute
% which player won the trick. 
% |\ODw@PTfer| is essentially called for each entry in all columns of the 
% |play| diagram through the column definition:\\
% |\newcolumntype{P}{>{\collectcell\ODw@PTfer}c<{\endcollectcell}}|
%
% We first define two counters, both initially set to zero.
%    \begin{macrocode}
\newcounter{ODw@Highest}%    the highest rank until now
\setcounter{ODw@Highest}{0}
\newcounter{ODw@WinningNr}%  player with the highest rank
\setcounter{ODw@WinningNr}{0}

\def\ODw@PTfer#1{%
  \stepcounter{ODw@PlayerNr}%
  \ODw@Xfer{#1}% ODw@Rank = the rank for this card
  \ifthenelse{\value{ODw@Rank} > \value{ODw@Highest}}%
    {% This rank is higher than previous highest one
      \setcounter{ODw@WinningNr}{\theODw@PlayerNr}%
      \setcounter{ODw@Highest}{\theODw@Rank}% 
    }%
    {}%
  \ifthenelse{\value{ODw@PlayerNr} = 4}%
    {% last player: Process the winning trick:
      \stepcounter{ODw@Nr}% Start new row with new player
      \ODw@AccTricks%      Accumulate tricks for N-S/E-W
    }%
    {}%
}
%    \end{macrocode}
% \end{macro}
% \par\vspace{0.3\baselineskip}\noindent
% \begin{macro}{\ODw@FTfer}\MacroDef{ODw@FTfer}[\marg{tokens}]
% |\ODw@FTfer| is called for the first column of the |play| diagram
% TableII. In |\ODw@Tricks| it just resets |ODw@PlayerNr| and |\ODw@Last|
% and writes the player who leads. Finally it processes the entry of the
% first column by calling |\ODw@PTfer|.
% |\ODw@FTfer| is essentially called for the entries in the first column of
% TableII in the |play| diagram through the column definition:\\
% |\newcolumntype{F}{>{\collectcell\ODw@FTfer}c<{\endcollectcell}}|
%    \begin{macrocode}
\def\ODw@FTfer#1{%
  \ODw@Tricks%
  \ODw@PTfer{#1}%
}% ODw@FTfer
%    \end{macrocode}
% \end{macro}
% \par\vspace{0.3\baselineskip}\noindent
% \begin{macro}{\ODw@BTfer}\MacroDef{ODw@BTfer}[\marg{tokens}]
% This macro is called within |bidding| diagrams and enables us to type
% |1C\announce| and get \Xfer{1C\announce}. The symbols get translated into
% the active language. |\ODw@BTfer| is essentially called for each entry in
% the |bidding| diagrams through:\\
% |\newcolumntype{B}{>{\collectcell\ODw@BTfer}c<{\endcollectcell}}|
%
% As there is no special processing for the biding entries, we call |\ODw@Xfer|
% right away to do the job.
%
%    \begin{macrocode}
\def\ODw@BTfer#1{%
  \ODw@Xfer{#1}%
}
%    \end{macrocode}
% \end{macro}
%
% \subsubsection{Names of Directions and Axes}
%
% \begin{macro}{\North}\MacroDef{North}[\Oarg{*!}]
% \begin{macro}{\north}\MacroDef{north}
%    \begin{macrocode}
\NewDocumentCommand\North{s t!}{%
  \bgroup%
    \ODw@OtherFont%
    \IfBooleanTF#1{%
      \IfBooleanTF{#2}{\ODw@N*}{\ODw@North*}%
    }{%
      \IfBooleanTF{#2}{\ODw@N}{\ODw@North}%
    }% TF#1
  \egroup%
  \xspace%
}% North
%
\def\north{\North*}
%    \end{macrocode}
% \end{macro}
% \end{macro}

% \begin{macro}{\East}\MacroDef{East}[\Oarg{*!}]
% \begin{macro}{\east}\MacroDef{east}
%    \begin{macrocode}
\NewDocumentCommand\East{s t!}{%
  \bgroup%
    \ODw@OtherFont%
    \IfBooleanTF#1{%
      \IfBooleanTF{#2}{\ODw@E*}{\ODw@East*}%
    }{%
      \IfBooleanTF{#2}{\ODw@E}{\ODw@East}%
    }% TF#1
  \egroup%
  \xspace%
}% East
%
\def\east{\East*}
%    \end{macrocode}
% \end{macro}
% \end{macro}

% \begin{macro}{\South}\MacroDef{South}[\Oarg{*!}]
% \begin{macro}{\south}\MacroDef{south}
%    \begin{macrocode}
\NewDocumentCommand\South{s t!}{%
  \bgroup%
    \ODw@OtherFont%
    \IfBooleanTF#1{%
      \IfBooleanTF{#2}{\ODw@S*}{\ODw@South*}%
    }{%
      \IfBooleanTF{#2}{\ODw@S}{\ODw@South}%
    }% TF#1
  \egroup%
  \xspace%
}% South
%
\def\south{\South*}
%    \end{macrocode}
% \end{macro}
% \end{macro}

% \begin{macro}{\West}\MacroDef{West}[\Oarg{*!}]
% \begin{macro}{\west}\MacroDef{west}
%    \begin{macrocode}
\NewDocumentCommand\West{s t!}{%
  \bgroup%
    \ODw@OtherFont%
    \IfBooleanTF#1{%
      \IfBooleanTF{#2}{\ODw@W*}{\ODw@West*}%
    }{%
      \IfBooleanTF{#2}{\ODw@W}{\ODw@West}%
    }% TF#1
  \egroup%
  \xspace%
}% West
%
\def\west{\West*}
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\NorthSouth}\MacroDef{NorthSouth}[\Oarg{*!}]
% \begin{macro}{\northsouth}\MacroDef{northsouth}
%    \begin{macrocode}
\NewDocumentCommand\NorthSouth{s t!}{%
  \bgroup%
   \ODw@OtherFont%
   \IfBooleanTF#1{%
     \IfBooleanTF{#2}{\North*!--\South*!}{\North*--\South*}%
   }{%
     \IfBooleanTF{#2}{\North!--\South!}{\North--\South}%
   }%
  \egroup%
  \xspace%
}% NorthSouth
%
\def\northsouth{\NorthSouth*}
%    \end{macrocode}
% \end{macro}
% \end{macro}

% \begin{macro}{\EastWest}\MacroDef{EastWest}[\Oarg{*!}]
% \begin{macro}{\eastwest}\MacroDef{eastwest}
%    \begin{macrocode}
\NewDocumentCommand\EastWest{s t!}{%
  \bgroup%
    \ODw@OtherFont%
   \IfBooleanTF#1{%
     \IfBooleanTF{#2}{\East*!--\West*!}{\East*--\West*}%
   }{%
     \IfBooleanTF{#2}{\East!--\West!}{\East--\West}%
   }%
  \egroup%
  \xspace%
}% EastWest
%
\def\eastwest{\EastWest*}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% Next we define macros that translate the short form of the directions
% into the active language.
% \par\noindent
% \begin{macro}{\ODw@N}
% \begin{macro}{\ODw@E}
% \begin{macro}{\ODw@S}
% \begin{macro}{\ODw@W}
%    \begin{macrocode}
\def\ODw@N{%
  \@ifstar{\GetTranslation{N-(ODw)}}%
          {\GetTranslation{n-(ODw)}}%
}
\def\ODw@E{%
  \@ifstar{\GetTranslation{E-(ODw)}}%
          {\GetTranslation{e-(ODw)}}%
}
\def\ODw@S{%
  \@ifstar{\GetTranslation{S-(ODw)}}%
          {\GetTranslation{s-(ODw)}}%
}
\def\ODw@W{%
  \@ifstar{\GetTranslation{W-(ODw)}}%
          {\GetTranslation{w-(ODw)}}%
}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
%
%
% \begin{macro}{\ODw@NS}
% \begin{macro}{\ODw@EW}
%    \begin{macrocode}
\def\ODw@NS{\ODw@N--\ODw@S}
\def\ODw@EW{\ODw@E--\ODw@W}
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
%
% \begin{macro}{\ODw@North}
% \begin{macro}{\ODw@East}
% \begin{macro}{\ODw@South}
% \begin{macro}{\ODw@West}
%    \begin{macrocode}
\def\ODw@North{%
  \@ifstar{\GetTranslation{North-(ODw)}}%
          {\GetTranslation{north-(ODw)}}%
}
\def\ODw@East{%
  \@ifstar{\GetTranslation{East-(ODw)}}%
          {\GetTranslation{east-(ODw)}}%
}
\def\ODw@South{%
  \@ifstar{\GetTranslation{South-(ODw)}}%
          {\GetTranslation{south-(ODw)}}%
}
\def\ODw@West{%
  \@ifstar{\GetTranslation{West-(ODw)}}%
          {\GetTranslation{west-(ODw)}}%
}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
%
%
% \subsubsection{Non-Bid Calls}
%
% \begin{macro}{\Pass}\MacroDef{Pass}[\Oarg{*!}]
% \begin{macro}{\pass}\MacroDef{pass}
%    \begin{macrocode}
\NewDocumentCommand\Pass{s t!}{%
  \bgroup%
    \ODw@OtherFont%
    \IfBooleanTF{#1}{%
      \IfBooleanTF{#2}%
        {\GetTranslation{Pass!-(ODw)}}%
        {\GetTranslation{Pass-(ODw)}}%
    }{%
     \IfBooleanTF{#2}%
       {\GetTranslation{pass!-(ODw)}}%
       {\GetTranslation{pass-(ODw)}}%
    }% TF#1
  \egroup%
  \xspace%
}% Pass
%
\def\pass{\Pass*}
%    \end{macrocode}
% \end{macro}
% \end{macro}

% \begin{macro}{\Allpass}\MacroDef{Allpass}[\Oarg{*!}]
% \begin{macro}{\allpass}\MacroDef{allpass}
%    \begin{macrocode}
\NewDocumentCommand\Allpass{s t!}{%
  \bgroup%
    \ODw@OtherFont%
    \IfBooleanTF#1{%
      \IfBooleanTF{#2}%
        {\GetTranslation{AP-(ODw)}}%
        {\GetTranslation{All pass-(ODw)}}%
    }{%
     \IfBooleanTF{#2}%
       {\GetTranslation{ap-(ODw)}}%
       {\GetTranslation{all pass-(ODw)}}%
    }% TF#1
  \egroup%
  \xspace%
}% Allpass
%
\def\allpass{\Allpass*}
%    \end{macrocode}
% \end{macro}
% \end{macro}

% \begin{macro}{\Double}\MacroDef{Double}[\Oarg{*!}]
% \begin{macro}{\double}\MacroDef{double}
%    \begin{macrocode}
\NewDocumentCommand\Double{s t!}{%
  \bgroup%
    \ODw@OtherFont%
    \IfBooleanTF#1{%
      \IfBooleanTF{#2}%
       {\GetTranslation{Dbl-(ODw)}}%
       {\GetTranslation{Double-(ODw)}}%
    }{%
     \IfBooleanTF{#2}%
       {X}%
       {\GetTranslation{double-(ODw)}}%
    }% TF#1
  \egroup%
  \xspace%
}% Double
%
\def\double{\Double*}
%    \end{macrocode}
% \end{macro}
% \end{macro}

% \begin{macro}{\Redouble}\MacroDef{Redouble}[\Oarg{*!}]
% \begin{macro}{\redouble}\MacroDef{redouble}
%    \begin{macrocode}
\NewDocumentCommand\Redouble{s t!}{%
  \bgroup%
    \ODw@OtherFont%
    \IfBooleanTF#1{%
      \IfBooleanTF{#2}%
        {\GetTranslation{ReDbl-(ODw)}}%
        {\GetTranslation{ReDouble-(ODw)}}%
   }{%
     \IfBooleanTF{#2}%
       {\mbox{X\kern-0.1em X}}%
       {\GetTranslation{redouble-(ODw)}}%
    }% TF#1
  \egroup%
  \xspace%
}% Redouble
%
\def\redouble{\Redouble*}
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
%
% \subsubsection{Bidding Diagrams}
%
% \DeleteShortVerb{\|}
% \begin{macro}{\ODw@FirstBidCol}\MacroDef{ODw@FirstBidCol}[\marg{{\upshape N|S|E|W}}]
% \MakeShortVerb{\|}
%
% |\ODw@FirstBidCol| determines which player starts in the first bidding column.
% We also take care that the real world name of the players are kept
% associated with the columns. For |\ODw@BidderX| (X=I,II,III,IV) we
% define two macros: |\ODw@BidderX| and |\ODw@BidderX*| in one. When these
% macros are called in the |bidding| diagram, the starred version writes the
% short notation whereas the unstarred one writes the long version.
%    \begin{macrocode}
\newcommand\ODw@FirstBidCol[1]{%
 \IfEqCase{#1}{%
  {N}{%
   \def\ODw@BidderI{\@ifstar{\ODw@North*}{\ODw@N*}}%
   \def\ODw@BidderII{\@ifstar{\ODw@East*}{\ODw@E*}}%
   \def\ODw@BidderIII{\@ifstar{\ODw@South*}{\ODw@S*}}%
   \def\ODw@BidderIV{\@ifstar{\ODw@West*}{\ODw@W*}}%
   \def\ODw@NameI{\ODw@North@Name}%
   \def\ODw@NameII{\ODw@East@Name}%
   \def\ODw@NameIII{\ODw@South@Name}%
   \def\ODw@NameIV{\ODw@West@Name}%
  }%
  {E}{%
   \def\ODw@BidderI{\@ifstar{\ODw@East*}{\ODw@E*}}%
   \def\ODw@BidderII{\@ifstar{\ODw@South*}{\ODw@S*}}%
   \def\ODw@BidderIII{\@ifstar{\ODw@West*}{\ODw@W*}}%
   \def\ODw@BidderIV{\@ifstar{\ODw@North*}{\ODw@N*}}%
   \def\ODw@NameI{\ODw@East@Name}%
   \def\ODw@NameII{\ODw@South@Name}%
   \def\ODw@NameIII{\ODw@West@Name}%
   \def\ODw@NameIV{\ODw@North@Name}%
  }%
  {S}{%
   \def\ODw@BidderI{\@ifstar{\ODw@South*}{\ODw@S*}}%
   \def\ODw@BidderII{\@ifstar{\ODw@West*}{\ODw@W*}}%
   \def\ODw@BidderIII{\@ifstar{\ODw@North*}{\ODw@N*}}%
   \def\ODw@BidderIV{\@ifstar{\ODw@East*}{\ODw@E*}}%
   \def\ODw@NameI{\ODw@South@Name}%
   \def\ODw@NameII{\ODw@West@Name}%
   \def\ODw@NameIII{\ODw@North@Name}%
   \def\ODw@NameIV{\ODw@East@Name}%
  }%
  {W}{%
   \def\ODw@BidderI{\@ifstar{\ODw@West*}{\ODw@W*}}%
   \def\ODw@BidderII{\@ifstar{\ODw@North*}{\ODw@N*}}%
   \def\ODw@BidderIII{\@ifstar{\ODw@East*}{\ODw@E*}}%
   \def\ODw@BidderIV{\@ifstar{\ODw@South*}{\ODw@S*}}%
   \def\ODw@NameI{\ODw@West@Name}%
   \def\ODw@NameII{\ODw@North@Name}%
   \def\ODw@NameIII{\ODw@East@Name}%
   \def\ODw@NameIV{\ODw@South@Name}%
  }%
 }% IfEqCase
}% ODw@FirstBidCol
%    \end{macrocode}
% \end{macro}
%
% Next we define the real world names for the \NorthSouth*! and the \EastWest*!
% bidders. We use |\ODw@All@Names| as variable to test if we have names for
% bidders at all: If it is empty, then no names were defined.
% \begin{macro}{\namesNS}\MacroDef{namesNS}[\marg{N-name}\marg{S-name}]
%    \begin{macrocode}
\newcommand\namesNS[2]{%
  \gdef\ODw@North@Name{#1}%
  \gdef\ODw@South@Name{#2}%
  \gdef\ODw@All@Names{#1#2\ODw@East@Name\ODw@West@Name}%
}% namesNS
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\namesEW}\MacroDef{namesEW}[\marg{E-name}\marg{W-name}]
%    \begin{macrocode}
\newcommand\namesEW[2]{%
  \gdef\ODw@East@Name{#1}%
  \gdef\ODw@West@Name{#2}%
  \gdef\ODw@All@Names{#1#2\ODw@North@Name\ODw@South@Name}%
}% namesEW
%    \end{macrocode}
% \end{macro}
%
% \subsubsection{Diagram Hands}
%
% Here we implement commands that store the cards that each player holds.
% E.g.\ |\northhand| defines the complete hand, i.e.\ all 4 suits for the
% \North*-player. They have an optional parameter (an offset, default |0pt|)
% to finetune the distance to the compass. In |\ODw@Nhand| and
% |\ODw@Shand| we use a makebox to prevent that its width goes beyond the
% |NESW| compass (but this can interfere with the Right-U/L-Legend). Within
% these macros, we check the consistency of the cards in the hand and also
% store card-information to check a complete deal later.
% \begin{macro}{\northhand}\MacroDef{northhand}[\oarg{v-offset}\marg{Sp}\marg{He}\marg{Di}\marg{Cl}]
% |\northhand[v-offset]{Sp}{He}{Di}{Cl}|\\
% |               1      2   3   4   5|
%    \begin{macrocode}
\newcommand\northhand[5][0pt]{%
% check that north has 13 cards
  \ODw@ChkNrOfCards{#2#3#4#5}{\north}%
  \gdef\ODw@NSpades{#2}%   Save norths cards
  \gdef\ODw@NHearts{#3}%   of all suits
  \gdef\ODw@NDiamonds{#4}% for later
  \gdef\ODw@NClubs{#5}%    checking
%    \end{macrocode}
% \begin{macro}{\ODw@Nhand}
% We fit the \north hand in a box to avoid that a 
% very long suit shifts the \east hand to the right
%    \begin{macrocode}
  \gdef\ODw@Nhand{%
    \makebox[\ODw@Compasssize + 2ex][l]{%
      \ODw@hand{t}{#2}{#3}{#4}{#5}%
    }%
    \vspace{#1}%
  }%
%    \end{macrocode}
% \end{macro}
%    \begin{macrocode}
}% northhand
%    \end{macrocode}
% \end{macro}

% \begin{macro}{\easthand}\MacroDef{easthand}[\oarg{h-offset}\marg{Sp}\marg{He}\marg{Di}\marg{Cl}]
% |\easthand[h-offset]{Sp}{He}{Di}{Cl}|\\
% |               1      2   3   4   5|
%    \begin{macrocode}
\newcommand\easthand[5][0pt]{%
% check that east has 13 cards
  \ODw@ChkNrOfCards{#2#3#4#5}{\east}%
  \gdef\ODw@ESpades{#2}%   Save easts cards
  \gdef\ODw@EHearts{#3}%   of all suits
  \gdef\ODw@EDiamonds{#4}% for later
  \gdef\ODw@EClubs{#5}%    checking
%    \end{macrocode}
% \begin{macro}{\ODw@Ehand}
%    \begin{macrocode}
  \gdef\ODw@Ehand{%
    \hspace{#1}%
    \ODw@hand{c}{#2}{#3}{#4}{#5}%
  }%
%    \end{macrocode}
% \end{macro}
%    \begin{macrocode}
}% easthand
%    \end{macrocode}
% \end{macro}

% \begin{macro}{\southhand}\MacroDef{southhand}[\oarg{v-offset}\marg{Sp}\marg{He}\marg{Di}\marg{Cl}]
% |\southhand[v-offset]{Sp}{He}{Di}{Cl}|\\
% |               1      2   3   4   5|
%    \begin{macrocode}
\newcommand\southhand[5][0pt]{%
% check that south has 13 cards
  \ODw@ChkNrOfCards{#2#3#4#5}{\south}%
  \gdef\ODw@SSpades{#2}%   Save souths cards
  \gdef\ODw@SHearts{#3}%   of all suits
  \gdef\ODw@SDiamonds{#4}% for later
  \gdef\ODw@SClubs{#5}%    checking
%    \end{macrocode}
% \begin{macro}{\ODw@Shand}
% We fit the \south hand in a box to avoid that a 
% very long suit shifts the \east hand to the right
%    \begin{macrocode}
  \gdef\ODw@Shand{%
    \parbox[b]{\ODw@Compasssize + 2ex}{%
      \vspace*{#1}\par%
      \makebox[0pt][l]{%
        \ODw@hand{b}{#2}{#3}{#4}{#5}%
      }%
    }%
  }%
%    \end{macrocode}
% \end{macro}
%    \begin{macrocode}
}% southhand
%    \end{macrocode}
% \end{macro}

% \begin{macro}{\westhand}\MacroDef{westhand}[\oarg{h-offset}\marg{Sp}\marg{He}\marg{Di}\marg{Cl}]
% |\westhand[h-offset]{Sp}{He}{Di}{Cl}|\\
% |               1      2   3   4   5|
%    \begin{macrocode}
\newcommand\westhand[5][0pt]{%
% check that west has 13 cards
  \ODw@ChkNrOfCards{#2#3#4#5}{\west}%
  \gdef\ODw@WSpades{#2}%   Save wests cards
  \gdef\ODw@WHearts{#3}%   of all suits
  \gdef\ODw@WDiamonds{#4}% for later
  \gdef\ODw@WClubs{#5}%    checking
%    \end{macrocode}
% \begin{macro}{\ODw@Whand}
%    \begin{macrocode}
  \gdef\ODw@Whand{%
    \ODw@hand{c}{#2}{#3}{#4}{#5}%
    \hspace*{#1}%
  }%
%    \end{macrocode}
% \end{macro}
%    \begin{macrocode}
}% westhand
%    \end{macrocode}
% \end{macro}
%
% \subsubsection{A Single Hand}
%
% Sometimes we want to show only (the cards of) one single hand.
%
% \noindent
% \begin{macro}{\hand}\MacroDef{hand}[\Oarg{*!-}\oarg{pos}\marg{Sp}\marg{He}\marg{Di}\marg{Cl}]
%    \begin{macrocode}
\NewDocumentCommand\hand{s t! t- O{c}mmmm}{%
%    \end{macrocode}
% |\hand* ! -[pos]{Sp}{He}{Di}{Cl}|\\
% |     1 2 3  4   5   6   7   8|\\
% This macro has 3 optional tokens that act as follows:\\
% Naked mode: Displays the hand horizontally, left aligned.\\
% |*| mode: Displays the hand horizontally, centered.\\
% |!| mode: Displays the hand vertically, left aligned.\\
% |*!| mode: Displays the hand vertically, centered.\\
% |-| mode: Output is suppressed, it is stored in a savebox for later use.
% \par\vspace{0.3\baselineskip}\noindent
% The 4th argument is the aligning (used only in case of a vertical hand):
% default \textbf{c}. The rest of the arguments denote the cards of the
% suits. 
%
% We first check that this hand has 13 cards. Then we check for each
% suit that there are no multiples. Finally we store the hand in
% |\ODw@Hand@Box|. If output is not suppressed, we write the hand with
% |\usebox\ODw@Hand@Box|.
%    \begin{macrocode}
  \ODw@ChkNrOfCards{#5#6#7#8}{Hand}%
  \ODw@ChkSameCards{#5}{\Sp}% 
  \ODw@ChkSameCards{#6}{\He}%
  \ODw@ChkSameCards{#7}{\Di}%
  \ODw@ChkSameCards{#8}{\Cl}%
  \global\sbox{\ODw@Hand@Box}{%
    \bgroup%
      \ODw@GameSize% 
      \IfBooleanTF{#2}%
        {\ODw@vhand[#4]{#5}{#6}{#7}{#8}}%
        {\ODw@hhand{#5}{#6}{#7}{#8}}%
    \egroup%
  }% sbox
  \IfBooleanTF{#3}{}{%
   \IfBooleanTF{#1}%
      {{\centering \usebox{\ODw@Hand@Box}\par}}%
      {\usebox{\ODw@Hand@Box}}%
  }%
}% hand
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\ODw@hhand}\MacroDef{ODw@hhand}[\marg{Sp}\marg{He}\marg{Di}\marg{Cl}]
% Displays a hand horizontally (e.g.\ \hand{xxxx}{xxx}{xxx}{xxx}). We use a
% |tabular| with 4 columns in 1 row to print the 4 suits.
%    \begin{macrocode}
\newcommand\ODw@hhand[4]{%
  \bgroup%
  \def\xspace{}% undo xspace locally
               % it screws the distance between suit and cards
  \setlength\tabcolsep{1\ODw@Card@Skip}%
  \begin{tabular}{llll}
  % we can't use \suit here: it would cause double checks!
    \Sp\hspace{0.3em}\ODw@Cards{#1} &%
    \He\hspace{0.3em}\ODw@Cards{#2} &%
    \Di\hspace{0.3em}\ODw@Cards{#3} &%
    \Cl\hspace{0.3em}\ODw@Cards{#4} \\
  \end{tabular}%
  \egroup%
}% ODw@hhand
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\ODw@vhand}\MacroDef{ODw@vhand}[\oarg{pos}\marg{Sp}\marg{He}\marg{Di}\marg{Cl}]
% \shorthandoff{!}
% Display a hand vertically (e.g.\ \hand!{xxxx}{xxx}{xxx}{xxx}). We call
% \shorthandon{!}
% |\ODw@hand| to do the job.
%    \begin{macrocode}
\newcommand\ODw@vhand[5][c]{%
  \ODw@hand{#1}{#2}{#3}{#4}{#5}%
}% ODw@vhand
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\ODw@hand}\MacroDef{ODw@hand}[\oarg{pos}\marg{Sp}\marg{He}\marg{Di}\marg{Cl}]
% We put a hand and some spacing in a |tabular| by reading the cards for
% each suit, making the lines more tense with the |\\[-0.5ex]|.
% Empty hands are discarded completely.
%
%    \begin{macrocode}
\newcommand\ODw@hand[5]{%
%    \end{macrocode}
% |ODw@hand{pos}{spades}{hearts}{diamonds}{clubs}|\\
% |          1     2       3        4        5|
% \par\noindent 
% First we test if the hand is completely empty; only if not, we output
% something.
%    \begin{macrocode}
  \ifthenelse{\equal{#2#3#4#5}{}}{}{%
    \setlength\tabcolsep{\ODw@Card@Skip}%
%JW    \ODw@GameSize% XYX JW 30.04.2018
    \begin{tabular}[#1]{ll}%
  % we can't use \suit here: it would cause double checks!
      \Sp & \ODw@Cards{#2}\\[-0.5ex]
      \He & \ODw@Cards{#3}\\[-0.5ex]
      \Di & \ODw@Cards{#4}\\[-0.5ex]
      \Cl & \ODw@Cards{#5}\\
    \end{tabular}%
  }% ifthenelse
}% ODw@hand
%    \end{macrocode}
% \end{macro}
%
% \subsubsection{Suits}
%
% In some cases, we need only a collection of cards, without a suit symbol.
% \begin{macro}{\onesuitAll}\MacroDef{onesuitAll}[\Oarg{*!}\marg{N}\marg{S}\marg{E}\marg{W}]
% Display the cards of one suit in a \North*!{}\South*!--\East*!{}\West*! diagram, with
% the \North*!-, \East*!-, \South*!- and \West*!-hand.
%    \begin{macrocode}
\NewDocumentCommand\onesuitAll{s t! mmmm}{%
%    \end{macrocode}
% |onesuitAll* !{N-hand}{S-hand}{E-hand}{W-hand}|\\
% |          1 2   3       4       5       6|\\
% |Naked version:  Use a |\ODwBox\\
% |* version: Display the diagram centered|\\
% |! version: use the NESW compass|
% \par\noindent
% First we test that we have no multiple cards in the suit. Then we use a
% |tabular| to place the cards around a compass or around a box. 
%    \begin{macrocode}
  \ODw@ChkSameCards{#3#4#5#6}{}%
  \IfBooleanTF#1{\begin{center}}{}%
  \bgroup%
    \ODw@GameSize%
    \setlength\tabcolsep{0em}%
\begin{tabular}{@{}r@{ }c@{ }l@{}}%
%\begin{tabular}{@{}rcl@{}}%
       & \ODw@Cards{#3} \IfBooleanTF#2{\\[-0.2em]}{\\}%
 \ODw@Cards{#6} & \IfBooleanTF#2{\ODw@Compass}{\ODw@Box}%
         & \ODw@Cards{#5} \IfBooleanTF#2{\\[-0.2em]}{\\}%
                & \ODw@Cards{#4}\\
    \end{tabular}%
  \egroup%
  \IfBooleanTF#1{\end{center}}{}%
}% onesuitAll
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\onesuitNS}\MacroDef{onesuitNS}[\Oarg{*!}\marg{N}\marg{S}]
% Display a suit as |NS|-diagram. Similar to |\onesuitAll| but with only
% |N|- and |S|-hand.
%    \begin{macrocode}
\NewDocumentCommand\onesuitNS{s t! mm}{%
%    \end{macrocode}
% |onesuitNS* !{N-hand}{S-hand}|\\
% |         1 2   3       4|\\
% |Naked version:  Use a |\ODwBox\\
% |* version:  Display the diagram centered|\\
% |! version: use the NESW compass|
%
%    \begin{macrocode}
  \ODw@ChkSameCards{#3#4}{}%
  \IfBooleanTF#1{\begin{center}}{}%
  \bgroup%
    \ODw@GameSize%
    \begin{tabular}{@{}c@{}}%
      \ODw@Cards{#3}\IfBooleanTF#2{\\[-0.2em]}{\\}%
        \IfBooleanTF#2{\ODw@Compass\\[-0.2em]}{\ODw@Box\\}%
      \ODw@Cards{#4}%
    \end{tabular}%
  \egroup%
  \IfBooleanTF#1{\end{center}}{}%
}% onesuitNS
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\onesuitEW}\MacroDef{onesuitEW}[\Oarg{*!}\marg{E}\marg{W}]
% Display a suit as |EW| diagram. Similar to |\onesuitAll| but with only
% |E|- and |W|-hand.
%    \begin{macrocode}
\NewDocumentCommand\onesuitEW{s t! mm}{%
%    \end{macrocode}
% |onesuitEW* !{E-hand}{W-hand}|\\
% |         1 2   3       4|\\
% |Naked version:  Use a |\ODwBox\\
% |* version: Display the diagram centered|\\
% |! version: use the NESW compass|
%
%    \begin{macrocode}
  \ODw@ChkSameCards{#3#4}{}%
  \IfBooleanTF#1{\begin{center}}{}%
  \bgroup%
    \ODw@GameSize%
    \begin{tabular}{@{}r@{ }c@{ }l@{}}%
      \ODw@Cards{#4} &%
      \IfBooleanTF#2{\ODw@Compass}{\ODw@Box} &%
         \ODw@Cards{#3} \\%
    \end{tabular}%
  \egroup%
   \IfBooleanTF#1{\end{center}}{}%
}% onesuitEW
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\onesuitNE}\MacroDef{onesuitNE}[\Oarg{*!}\marg{N}\marg{E}]
% Display a suit as |NE| diagram. Similar to |\onesuitAll| but with only
% |N|- and |E|-hand.
%    \begin{macrocode}
\NewDocumentCommand\onesuitNE{s t! mm}{%
%    \end{macrocode}
% |onesuitNE* !{N-hand}{E-hand}|\\
% |         1 2   3       4|\\
% |Naked version:  Use a |\ODwBox\\
% |* version: Display the diagram centered|\\
% |! version: use the NESW compass|
%
%    \begin{macrocode}
  \ODw@ChkSameCards{#3#4}{}%
  \IfBooleanTF#1{\begin{center}}{}%
  \bgroup%
    \ODw@GameSize%
    \begin{tabular}[b]{c@{ }l@{}}%
      \ODw@Cards{#3} \\%
      \IfBooleanTF#2{\ODw@Compass}{\ODw@Box} &%
         \ODw@Cards{#4} \\%
    \end{tabular}%
  \egroup%
   \IfBooleanTF#1{\end{center}}{}%
}% onesuitEW
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\onesuitNW}\MacroDef{onesuitNW}[\Oarg{*!}\marg{N}\marg{W}]
% Display a suit as |NW| diagram. Similar to |\onesuitAll| but with only
% |N|- and |W|-hand.
%    \begin{macrocode}
\NewDocumentCommand\onesuitNW{s t! mm}{%
%    \end{macrocode}
% |onesuitNW* !{N-hand}{W-hand}|\\
% |         1 2   3       4|\\
% |Naked version:  Use a |\ODwBox\\
% |* version: Display the diagram centered|\\
% |! version: use the NESW compass|
%
%    \begin{macrocode}
  \ODw@ChkSameCards{#3#4}{}%
  \IfBooleanTF#1{\begin{center}}{}%
  \bgroup%
    \ODw@GameSize%
    \begin{tabular}[b]{r@{ }c}%
                     & \ODw@Cards{#3} \\%
      \ODw@Cards{#4} & \IfBooleanTF#2{\ODw@Compass}{\ODw@Box} \\%
    \end{tabular}%
  \egroup%
   \IfBooleanTF#1{\end{center}}{}%
}% onesuitEW
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\suit}\MacroDef{suit}[\oarg{suit symbol}\marg{cards}]
% Command for displaying the cards of a suit. With the optional argument
% one can add a suit symbol to the suit.
%
%    \begin{macrocode}
\newcommand\suit[2][]{%
%    \end{macrocode}
% |\suit[suit]{cards}|\\
% |       1      2   |
%    \begin{macrocode}
  \ODw@ChkNrOfCards{#2}{suit}%
  \ODw@ChkSameCards{#2}{#1}%
  \bgroup% keep font change local
%JW
    \ODw@GameSize%
    #1\ODw@Cards{#2}%
  \egroup%
  \xspace%
}% suit
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\ODw@Cards}\MacroDef{ODw@Cards}[\marg{cards}]
% This macro gets called by |\suit| and all commands that process hands. It
% processes the ranks of the cards. Between ranks some space is typeset.
% Care is taken that |T| becomes \suit{T} and honor cards are
% translated into the active language.
%    \begin{macrocode}
\newcommand{\ODw@Cards}[1]{%
%    \end{macrocode}
% \par\vspace{0.3\baselineskip}\noindent
% We enable the cardskip and call |\ODw@Xfer| to do the job
%    \begin{macrocode}
  \OdW@CardSkiptrue%
  \ODw@Xfer{#1}%
}% ODw@Cards
%    \end{macrocode}
% \end{macro}
%
% \subsubsection{Card Diagrams}
%
% Next we define several diagrams with hands around the compass.
% |\ODw@GameSize| sets the size of the compass, the directions and the
% hands, according to the actual font or font-size.
% |\ODw@LeftUpperText| etc.\ displays extra text, that appear in the left
% upper, etc.\ corner of the diagram. If |\headlinetext| (|\footlinetext|)
% is the empty string, we set boolean |ODw@EmptyHeader| (|ODw@EmptyFooter|)
% to true\footnote{see page \pageref{Empty}, last paragraph why this is
% necessary}. This value is used in
% |\ODw@ProcessHeader| to conditionally span the 3 columns with the
% headline- (footline)text. We first store the diagram in a box, so we can
% calculate its width and use that as a size to limit the header/footer
% texts.
%
% \begin{macro}{\showAll}\MacroDef{showAll}[\Oarg{*+}\oarg{pos}]
% Define the diagram, showing the cards for \textbf{All} hands.
%
%    \begin{macrocode}
\NewDocumentCommand\showAll{s t+ O{c}}{%
%    \end{macrocode}
% |showAll* + [pos]|\\
% |       1 2   3|\\
% |Display the NS--EW diagram, defined by \northhand, etc|\\
% |* Version: Display the diagram centered|\\
% |+ Version: Also display a bidding diagram|\\ 
% |pos: aligning, default= c|
% \par\noindent
% First, for all suits we store all cards of all sides together. Next we
% check the consistency of all complete suits. The individual suits of each
% player have already been checked as we defined the hands. Finally we
% print the hands around the compass using a |tabular|, taking care of the
% additions above, below and in the corners of the diagram. Before we write
% the diagram, we store it in an sbox to calulate its width, so we can use
% that in other places.
% 
%    \begin{macrocode}
  \gdef\ODw@Spades{% store all Spades together
    \ODw@NSpades\ODw@ESpades\ODw@SSpades\ODw@WSpades%
  }%
  \gdef\ODw@Hearts{% store all Hearts together
    \ODw@NHearts\ODw@EHearts\ODw@SHearts\ODw@WHearts%
  }%
  \gdef\ODw@Diamonds{% store all Diamonds together
    \ODw@NDiamonds\ODw@EDiamonds\ODw@SDiamonds\ODw@WDiamonds%
  }%
  \gdef\ODw@Clubs{% store all Clubs together
    \ODw@NClubs\ODw@EClubs\ODw@SClubs\ODw@WClubs%
  }%
  % check for multiple and nr. of cards
  \ODw@ChkNrOfCards{\ODw@Spades}{\Sp}%
  \ODw@ChkSameCards{\ODw@Spades}{\Sp}%
  \ODw@ChkNrOfCards{\ODw@Hearts}{\He}%
  \ODw@ChkSameCards{\ODw@Hearts}{\He}%
  \ODw@ChkNrOfCards{\ODw@Diamonds}{\Di}%
  \ODw@ChkSameCards{\ODw@Diamonds}{\Di}%
  \ODw@ChkNrOfCards{\ODw@Clubs}{\Cl}%
  \ODw@ChkSameCards{\ODw@Clubs}{\Cl}%
  \IfBooleanTF#1{\begin{center}}{}%
  \bgroup%
    \setlength\tabcolsep{0em}%
    \ODw@GameSize%
    \ODw@TestIfEmpty{\ODw@HeaderText}{ODw@EmptyHeader}%
    \ODw@TestIfEmpty{\ODw@FooterText}{ODw@EmptyFooter}%
  % sbox1 necessary to calc. |Compasssize| for |Nhand|
    \sbox1{\ODw@Compass}%
    \sbox0{%
\begin{tabular}[#3]{@{}r@{}c@{}l@{}}%
  \ODw@LeftUpperText & \ODw@Nhand & \ODw@RightUpperText\\
  \ODw@Whand         & \usebox{1} & \ODw@Ehand\\
  \ODw@LeftLowerText & \ODw@Shand & \ODw@RightLowerText\\
\end{tabular}%
    }% sbox
    \ODw@gsetlength{\ODw@Diagram@Width}{\wd0}%
    \begin{tabular}[#3]{@{}r@{}c@{}l@{}}%
      \ODw@ProcessHeader{3}% span 3 columns
      \ODw@LeftUpperText & \ODw@Nhand & \ODw@RightUpperText\\
      \ODw@Whand         & \usebox{1} & \ODw@Ehand\\
      \ODw@LeftLowerText & \ODw@Shand & \ODw@RightLowerText\\
      \ODw@ProcessFooter{3}% span 3 columns
    \end{tabular}%
    \IfBooleanTF#2{%
 %  needed for \ODw@CondNewLine
      \setlength{\ODw@Bid@Width}{\wd\ODw@BidBox}%
      \ODw@CondNewLine%
      \usebox{\ODw@BidBox}%
    }{}%
  \egroup%
  \IfBooleanTF#1{\end{center}}{}%
}% showAll
%    \end{macrocode}
% \end{macro}
%
% \DeleteShortVerb{\|}
% \begin{macro}{\showNS}\MacroDef{showNS}[\Oarg{*+}\oarg{pos}\parg{N|S}]
% \MakeShortVerb{\|}
% Define the diagram, showing the cards for the \NorthSouth*! hands.
%
%    \begin{macrocode}
\NewDocumentCommand\showNS{s t+ O{c} d()}{%
%    \end{macrocode}
% |showNS* +[pos] (N/S)|\\
% |      1 2  3     4|\\
% |Display the NS diagram, defined by \northhand, etc|\\
% |* Version: Display the diagram centered|\\
% |+ Version: Also display a bidding diagram|\\
% |pos: aligning, default c|\\
% |N/S: only N-hand (or S-hand) is to be displayed|\\
% \par\noindent
% Description: similar to |\showAll|
%    \begin{macrocode}
% For all suits store all cards of north and south together
  \gdef\ODw@Spades{\ODw@NSpades\ODw@SSpades}%
  \gdef\ODw@Hearts{\ODw@NHearts\ODw@SHearts}%
  \gdef\ODw@Diamonds{\ODw@NDiamonds\ODw@SDiamonds}%
  \gdef\ODw@Clubs{\ODw@NClubs\ODw@SClubs}%
  \ODw@ChkSameCards{\ODw@Spades}{\Sp}%
  \ODw@ChkSameCards{\ODw@Hearts}{\He}%
  \ODw@ChkSameCards{\ODw@Diamonds}{\Di}%
  \ODw@ChkSameCards{\ODw@Clubs}{\Cl}%
  \IfBooleanTF#1{\begin{center}}{}%
  \bgroup%
    \setlength\tabcolsep{0em}%
    \ODw@GameSize%
    \ODw@TestIfEmpty{\ODw@HeaderText}{ODw@EmptyHeader}%
    \ODw@TestIfEmpty{\ODw@FooterText}{ODw@EmptyFooter}%
%    \end{macrocode}
% Here we store the width of the diagram \textbf{without} the header and
% footer. So we can limit their width to the diagramwidth.
%    \begin{macrocode}
  % sbox1 necessary to calc. |Compasssize| for |Nhand|
    \sbox1{\ODw@Compass}%
    \sbox0{%
  \begin{tabular}[#3]{@{}r@{}c@{}l@{}}%
% Display the N-hand only with token 'N', or no token at all
     & \IfNoValueTF{#4}{\ODw@Nhand}{\ifthenelse{\equal{#4}{N}}{\ODw@Nhand}{}} & \\
     & \usebox{1} & \\
% Display the S-hand only with token 'S', or no token at all
     & \IfNoValueTF{#4}{\ODw@Shand}{\ifthenelse{\equal{#4}{S}}{\ODw@Shand}{}} & \\
  \end{tabular}%
    }% sbox0
  \ODw@gsetlength\ODw@Diagram@Width{\wd0}%
  \begin{tabular}[#3]{@{}r@{}c@{}l@{}}%
    \ODw@ProcessHeader{3}% span 3 columns
% Display the N-hand only with token 'N', or no token at all
     & \IfNoValueTF{#4}{\ODw@Nhand}{\ifthenelse{\equal{#4}{N}}{\ODw@Nhand}{}} & \\
     & \usebox{1} & \\
% Display the S-hand only with token 'S', or no token at all
     & \IfNoValueTF{#4}{\ODw@Shand}{\ifthenelse{\equal{#4}{S}}{\ODw@Shand}{}} & \\
    \ODw@ProcessFooter{3}% span 3 columns
  \end{tabular}%
   \IfBooleanTF#2{%
 % necessary for \ODw@CondNewLine
     \setlength{\ODw@Bid@Width}{\wd\ODw@BidBox}%
     \ODw@CondNewLine%
     \usebox{\ODw@BidBox}%
   }{}%
 \egroup%
 \IfBooleanTF#1{\end{center}}{}%
}% showNS
%    \end{macrocode}
% \end{macro}
%
% \DeleteShortVerb{\|}
% \begin{macro}{\showEW}\MacroDef{showEW}[\Oarg{*+}\oarg{pos}\parg{E|W}]
% \MakeShortVerb{\|}
% Define the diagram, showing the cards for the \EastWest*! hands.
%    \begin{macrocode}
\NewDocumentCommand\showEW{s t+ O{c} d()}{%
%    \end{macrocode}
% |showEW* + [pos] (E/W)|\\
% |      1 2   3     4|\\
% |Display the EW diagram, defined by \easthand, etc|\\
% |* Version: Display the diagram centered|\\
% |+ Version: Also display a bidding diagram|\\
% |pos: aligning, default c|\\
% |E/W: only E-hand (or W-hand) is to be displayed|\\
% \par\noindent
% Description: similar to |\showAll|
%    \begin{macrocode}
% For all suits put all cards of east and west together
  \gdef\ODw@Spades{\ODw@ESpades\ODw@WSpades}%
  \gdef\ODw@Hearts{\ODw@EHearts\ODw@WHearts}%
  \gdef\ODw@Diamonds{\ODw@EDiamonds\ODw@WDiamonds}%
  \gdef\ODw@Clubs{\ODw@EClubs\ODw@WClubs}%
  \ODw@ChkSameCards{\ODw@Spades}{\Sp}%
  \ODw@ChkSameCards{\ODw@Hearts}{\He}%
  \ODw@ChkSameCards{\ODw@Diamonds}{\Di}%
  \ODw@ChkSameCards{\ODw@Clubs}{\Cl}%
  \IfBooleanTF#1{\begin{center}}{}%
  \bgroup%
    \setlength\tabcolsep{0em}%
    \ODw@GameSize%
    \ODw@TestIfEmpty{\ODw@HeaderText}{ODw@EmptyHeader}%
    \ODw@TestIfEmpty{\ODw@FooterText}{ODw@EmptyFooter}%
    \sbox0{%
      \begin{tabular}[#3]{@{}r@{}c@{}l@{}}%
% Display the W-hand only with token 'W', or no token at all
        \IfNoValueTF{#4}{\ODw@Whand}{\ifthenelse{\equal{#4}{W}}{\ODw@Whand}{}} 
               & \ODw@Compass & 
% Display the E-hand only with token 'E', or no token at all
        \IfNoValueTF{#4}{\ODw@Ehand}{\ifthenelse{\equal{#4}{E}}{\ODw@Ehand}{}} \\
      \end{tabular}%
    }% sbox
    \ODw@gsetlength{\ODw@Diagram@Width}{\wd0}%
    \begin{tabular}[#3]{@{}r@{}c@{}l@{}}%
      \ODw@ProcessHeader{3}% span 3 columns
               &              & \\
% Display the W-hand only with token 'W', or no token at all
      \IfNoValueTF{#4}{\ODw@Whand}{\ifthenelse{\equal{#4}{W}}{\ODw@Whand}{}} 
               & \ODw@Compass & 
% Display the E-hand only with token 'E', or no token at all
      \IfNoValueTF{#4}{\ODw@Ehand}{\ifthenelse{\equal{#4}{E}}{\ODw@Ehand}{}} \\
      \ODw@ProcessFooter{3}% span 3 columns
    \end{tabular}%
   \IfBooleanTF#2{%
 % necessary for \ODw@CondNewLine
     \setlength{\ODw@Bid@Width}{\wd\ODw@BidBox}%
     \ODw@CondNewLine%
     \usebox{\ODw@BidBox}%
   }{}%
  \egroup%
  \IfBooleanTF#1{\end{center}}{}%
}% showEW
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\showNE}\MacroDef{showNE}[\Oarg{*+}\oarg{pos}]
% Define the diagram, showing the cards for the
% \North*!{}\textbf{--}\East*! hands.
%    \begin{macrocode}
\NewDocumentCommand\showNE{s t+ O{c}}{%
%    \end{macrocode}
% |showNE* +[pos]|\\
% |      1 2  3|\\
% |Display the NE diagram, defined by \northhand, etc|\\
% |* Version: Display the diagram centered|\\
% |+ Version: Also display a bidding diagram|\\
% |pos: aligning, default c|\\
% Description: similar to |\showAll|
%    \begin{macrocode}
% For all suits put all cards of north and east together
  \gdef\ODw@Spades{\ODw@NSpades\ODw@ESpades}%
  \gdef\ODw@Hearts{\ODw@NHearts\ODw@EHearts}%
  \gdef\ODw@Diamonds{\ODw@NDiamonds\ODw@EDiamonds}%
  \gdef\ODw@Clubs{\ODw@NClubs\ODw@EClubs}%
  \ODw@ChkSameCards{\ODw@Spades}{\Sp}%
  \ODw@ChkSameCards{\ODw@Hearts}{\He}%
  \ODw@ChkSameCards{\ODw@Diamonds}{\Di}%
  \ODw@ChkSameCards{\ODw@Clubs}{\Cl}%
  \IfBooleanTF#1{\begin{center}}{}%
  \bgroup%
    \setlength\tabcolsep{0em}%
    \ODw@GameSize%
    \ODw@TestIfEmpty{\ODw@HeaderText}{ODw@EmptyHeader}%
    \ODw@TestIfEmpty{\ODw@FooterText}{ODw@EmptyFooter}%
  % sbox1 necessary to calc. |Compasssize| for |Nhand|
    \sbox1{\ODw@Compass}%
    \sbox0{%
      \begin{tabular}[#3]{@{}c@{}l@{}}%
        \ODw@Nhand & \ODw@RightUpperText\\
        \usebox{1} & \ODw@Ehand\\
      \end{tabular}%
    }% sbox
    \ODw@gsetlength{\ODw@Diagram@Width}{\wd0}%
    \begin{tabular}[#3]{@{}c@{}l@{}}%
      \ODw@ProcessHeader{2}% span 2 columns
      \ODw@Nhand & \ODw@RightUpperText\\
      \usebox{1} & \ODw@Ehand\\
      \ODw@ProcessFooter{2}% span 2 columns
    \end{tabular}%
   \IfBooleanTF#2{%
 % necessary for \ODw@CondNewLine
     \setlength{\ODw@Bid@Width}{\wd\ODw@BidBox}%
     \ODw@CondNewLine%
     \usebox{\ODw@BidBox}%
   }{}%
  \egroup%
  \IfBooleanTF#1{\end{center}}{}%
}% showNE
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\showNW}\MacroDef{showNW}[\Oarg{*+}\oarg{pos}]
% Define the diagram, showing the cards for the
% \North*!{}\textbf{--}\West*! hands.
%    \begin{macrocode}
\NewDocumentCommand\showNW{s t+ O{c}}{%
%    \end{macrocode}
% |showNW* +[pos]|\\
% |      1 2  3|\\
% |Display the NW diagram, defined by \northhand, etc|\\
% |* Version: Display the diagram centered|\\
% |+ Version: Also display a bidding diagram|\\
% |pos: aligning, default c|\\
% Description: similar to |\showAll|
%    \begin{macrocode}
% For all suits put all cards of north and west together
  \gdef\ODw@Spades{\ODw@NSpades\ODw@WSpades}%
  \gdef\ODw@Hearts{\ODw@NHearts\ODw@WHearts}%
  \gdef\ODw@Diamonds{\ODw@NDiamonds\ODw@WDiamonds}%
  \gdef\ODw@Clubs{\ODw@NClubs\ODw@WClubs}%
  \ODw@ChkSameCards{\ODw@Spades}{\Sp}%
  \ODw@ChkSameCards{\ODw@Hearts}{\He}%
  \ODw@ChkSameCards{\ODw@Diamonds}{\Di}%
  \ODw@ChkSameCards{\ODw@Clubs}{\Cl}%
  \IfBooleanTF#1{\begin{center}}{}%
  \bgroup%
    \setlength\tabcolsep{0em}%
    \ODw@GameSize%
    \ODw@TestIfEmpty{\ODw@HeaderText}{ODw@EmptyHeader}%
    \ODw@TestIfEmpty{\ODw@FooterText}{ODw@EmptyFooter}%
  % sbox1 necessary to calc. |Compasssize| for |Nhand|  
    \sbox1{\ODw@Compass}%
    \sbox0{%
      \begin{tabular}[#3]{@{}c@{}l@{}}%
        \ODw@LeftUpperText & \ODw@Nhand\\
        \ODw@Whand         & \usebox{1}\\
      \end{tabular}%
    }% sbox
    \ODw@gsetlength{\ODw@Diagram@Width}{\wd0}%
    \begin{tabular}[#3]{@{}r@{}c@{}}%
      \ODw@ProcessHeader{2}% span 2 columns
      \ODw@LeftUpperText & \ODw@Nhand\\
      \ODw@Whand         & \usebox{1}\\
      \ODw@ProcessFooter{2}% span 2 columns
    \end{tabular}%
   \IfBooleanTF#2{%
 % necessary for \ODw@CondNewLine
     \setlength{\ODw@Bid@Width}{\wd\ODw@BidBox}%
     \ODw@CondNewLine%
     \usebox{\ODw@BidBox}%
   }{}%
  \egroup%
  \IfBooleanTF#1{\end{center}}{}%
}% showNW
%    \end{macrocode}
% \end{macro}
%
% \subsubsection{The Compass}
%
% When displaying the compass, the square with |N-S| and |E-W| axes, we try
% to achieve several things:
% \begin{enumerate}[itemsep=0em]
% \item Making the size font-size dependent
% \item Put both |N| and |S| horizontally centered
% \item Put both |E| and |W| vertically centered
% \item Print the vulnerable side in red if in colored mode
% \item Underline the dealer (we \emph{over}line |S| for better clarity)
% \end{enumerate}
% We use the mapping as shown in the tables below. The |U| stands for
% undefined. This reflects the situation where neither |\vulner| nor
% |\dealer| have been called, and also there is no board number known.\\
%
% \hfill
% \begin{tabular}{|c|c|}\hline
% \multicolumn{2}{|c|}{Player} \\\hline
% N & 0 \\
% E & 1 \\
% S & 2 \\
% W & 3 \\\hline
% \end{tabular}
% \hfill\hfill
% \begin{tabular}{|c|c|}\hline
% \multicolumn{2}{|c|}{Vulner} \\\hline
% none & 0 \\
% all & 1 \\
% N-S & 2 \\
% E-W & 3 \\\hline
% U & -1 \\\hline
% \end{tabular}
% \hfill\hfill
% \begin{tabular}{|c|c|}\hline
% \multicolumn{2}{|c|}{Dealer} \\\hline
% N & 0 \\
% E & 1 \\
% S & 2 \\
% W & 3 \\\hline
% U & -1 \\\hline
% \end{tabular}
% \hfill\hfill
%
% \begin{macro}{\ODw@Compass}\MacroDef{ODw@Compass}
%    \begin{macrocode}
\newcommand{\ODw@Compass}{%
%    \end{macrocode}
% The codes for dealership (|\ODw@D|) and vulnerability (|\ODw@V|) are used
% in |\ODw@Print|. We initialize them with the value |-1| to denote the
% undefined state. |\@ODw| acts as a local temp variable in oder to make a
% smooth comparison.
%    \begin{macrocode}
 \begingroup
  \def\ODw@V{-1}\def\ODw@D{-1}%
%
% Set the code for vulnerability
%
  \def\@ODw{\none}\ifx\ODw@Vulner\@ODw\def\ODw@V{0}\fi%
  \def\@ODw{\none*}\ifx\ODw@Vulner\@ODw\def\ODw@V{0}\fi%
  \def\@ODw{\none!}\ifx\ODw@Vulner\@ODw\def\ODw@V{0}\fi%
  \def\@ODw{\none*!}\ifx\ODw@Vulner\@ODw\def\ODw@V{0}\fi%
  \def\@ODw{\all}\ifx\ODw@Vulner\@ODw\def\ODw@V{1}\fi%
  \def\@ODw{\all*}\ifx\ODw@Vulner\@ODw\def\ODw@V{1}\fi%
  \def\@ODw{\all!}\ifx\ODw@Vulner\@ODw\def\ODw@V{1}\fi%
  \def\@ODw{\all*!}\ifx\ODw@Vulner\@ODw\def\ODw@V{1}\fi%
  \def\@ODw{\NorthSouth}\ifx\ODw@Vulner\@ODw\def\ODw@V{2}\fi%
  \def\@ODw{\NorthSouth*}\ifx\ODw@Vulner\@ODw\def\ODw@V{2}\fi%
  \def\@ODw{\NorthSouth!}\ifx\ODw@Vulner\@ODw\def\ODw@V{2}\fi%
  \def\@ODw{\NorthSouth*!}\ifx\ODw@Vulner\@ODw\def\ODw@V{2}\fi%
  \def\@ODw{\EastWest}\ifx\ODw@Vulner\@ODw\def\ODw@V{3}\fi%
  \def\@ODw{\EastWest*}\ifx\ODw@Vulner\@ODw\def\ODw@V{3}\fi%
  \def\@ODw{\EastWest!}\ifx\ODw@Vulner\@ODw\def\ODw@V{3}\fi%
  \def\@ODw{\EastWest*!}\ifx\ODw@Vulner\@ODw\def\ODw@V{3}\fi%
%
% Set the code for dealership
%
  \def\@ODw{\North}\ifx\ODw@Dealer\@ODw\def\ODw@D{0}\fi%
  \def\@ODw{\North*}\ifx\ODw@Dealer\@ODw\def\ODw@D{0}\fi%
  \def\@ODw{\North!}\ifx\ODw@Dealer\@ODw\def\ODw@D{0}\fi%
  \def\@ODw{\North*!}\ifx\ODw@Dealer\@ODw\def\ODw@D{0}\fi%
  \def\@ODw{\East}\ifx\ODw@Dealer\@ODw\def\ODw@D{1}\fi%
  \def\@ODw{\East*}\ifx\ODw@Dealer\@ODw\def\ODw@D{1}\fi%
  \def\@ODw{\East!}\ifx\ODw@Dealer\@ODw\def\ODw@D{1}\fi%
  \def\@ODw{\East*!}\ifx\ODw@Dealer\@ODw\def\ODw@D{1}\fi%
  \def\@ODw{\South}\ifx\ODw@Dealer\@ODw\def\ODw@D{2}\fi%
  \def\@ODw{\South*}\ifx\ODw@Dealer\@ODw\def\ODw@D{2}\fi%
  \def\@ODw{\South!}\ifx\ODw@Dealer\@ODw\def\ODw@D{2}\fi%
  \def\@ODw{\South*!}\ifx\ODw@Dealer\@ODw\def\ODw@D{2}\fi%
  \def\@ODw{\West}\ifx\ODw@Dealer\@ODw\def\ODw@D{3}\fi%
  \def\@ODw{\West*}\ifx\ODw@Dealer\@ODw\def\ODw@D{3}\fi%
  \def\@ODw{\West!}\ifx\ODw@Dealer\@ODw\def\ODw@D{3}\fi%
  \def\@ODw{\West*!}\ifx\ODw@Dealer\@ODw\def\ODw@D{3}\fi%
%
%    \end{macrocode}
% We use a |picture| environment and set its size to 
% $\mbox{|2.5em|} \times \mbox{|2.5em|}$
% by setting the |\PicSize| to 500 and the unitlength to |0.005em|. Doing this
% enables us the avoid floating point arithmetic in the calculations of
% positions. Both |\PicSize| and |\MidSize| are local to |\ODw@Compass| and
% skipped from indexing. The same goes for |\Hoffset| and |\Voffset|.
%    \begin{macrocode}
  \ODw@CompassDefault% use the compass font
  \def\PicSize{500}%
  \def\MidSize{250}%
  % Multiply unitlength=0.005em with CompSize (default= 1)
  \setlength\unitlength{0.005em * \real{\ODw@CompSize}}%
  \ODw@gsetlength\ODw@Compasssize{\unitlength * \PicSize + 2ex}%
  \def\Hoffset{30}% distance between W (E) and frame
  \def\Voffset{30}% distance between N (S) and frame
  \setlength\ODw@Tmp@Width{0.1em * \real{\ODw@CompLine}}%
  \linethickness{\ODw@Tmp@Width}%
  % leave 1ex space on all sides
  \parbox[c][\ODw@Compasssize]{\ODw@Compasssize}{%
    \centering%
    \begin{picture}(\PicSize,\PicSize)%
      \ifODw@CompShow%
        % the frame
        \moveto(0,0)
       \if\ODw@CompLine0% must do it this way, because
       \else% linethickness zero does not suppress the line
         \lineto(0,\PicSize)\lineto(\PicSize,\PicSize)
         \lineto(\PicSize,0)\closepath\strokepath
       \fi%
        % the cardinal points
       \put(\MidSize,\the\numexpr \PicSize - \Voffset)%
         {\makebox[0pt]{\raisebox{-\height}{\ODw@Print{0}}}}% N
       \put(\MidSize,\Voffset){\makebox[0pt]{\ODw@Print{2}}}% S
       \put(\Hoffset,\MidSize){%
         \makebox[0pt][l]{%
          \ifODw@CompTurn%
            \raisebox{-0.5\height}{%
              \rotatebox[origin=t]{90}{\ODw@Print{3}}%
            }%
          \else%
             \raisebox{-0.5\height}{\ODw@Print{3}}%
          \fi%
         }% makebox
        }% W
        \put(\the\numexpr \PicSize - \Hoffset,\MidSize)%
         {\makebox[0pt][r]{%
            \raisebox{-0.5\height}{%
            \ifODw@CompTurn%
                \rotatebox[origin=c]{90}{\ODw@Print{1}}%
              \else%
                \ODw@Print{1}%
              \fi%
            }%
           }% makebox
         }% E
        % the center
          \put(\MidSize,\MidSize){\makebox(0,0){\ODw@mid}}
      \fi%
    \end{picture}%
   }% parbox
 \endgroup
}% ODw@Compass 
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\ODw@Print}\MacroDef{ODw@Print}[\marg{player-code}]
% |\ODw@Print| prints |N|, |E|, |S| and |W| in the compass. The side that
% is vulnerable is printed in red (or italics if we are monochrome),
% otherwise in black. The dealer is under- or overlined.
% \par\noindent
% The |\ifcase| distinguishes between the players. Then dealership and
% vulnerability are tested. |\ODw@PrintColor| is called to actually print
% the player.
%    \begin{macrocode}
\newcommand\ODw@Print[1]{%
%    \end{macrocode}
% |\ODw@Print{player-code}|\\
% |            1 (player-code=0-3)|
%    \begin{macrocode}
\bgroup
  \smaller\smaller%
  \ifcase#1% #1=0: print N
    \ifboolexpr{ test {\ifnumcomp{\ODw@D}{=}{0}}}%
    {% dealer = N
      \ifboolexpr{ test {\ifnumcomp{\ODw@V}{=}{1}} or%
                   test {\ifnumcomp{\ODw@V}{=}{2}} }%
        {\ODw@PrintColor{\underline{\ODw@N*}}}% Vul
        {\underline{\ODw@N*}}% not Vul
    }{% dealer <> N
      \ifboolexpr{ test {\ifnumcomp{\ODw@V}{=}{1}} or%
                   test {\ifnumcomp{\ODw@V}{=}{2}} }%
        {\ODw@PrintColor{\ODw@N*}}% Vul
        {\ODw@N*}% not Vul
    }% 
  \or% #1=1: print E
    \ifboolexpr{ test {\ifnumcomp{\ODw@D}{=}{1}}}%
    {% dealer E
      \ifboolexpr{ test {\ifnumcomp{\ODw@V}{=}{1}} or%
                   test {\ifnumcomp{\ODw@V}{=}{3}} }%
        {\ODw@PrintColor{\underline{\ODw@E*}}}% Vul
        {\underline{\ODw@E*}}% not Vul
    }{% dealer <> E
      \ifboolexpr{ test {\ifnumcomp{\ODw@V}{=}{1}} or%
                   test {\ifnumcomp{\ODw@V}{=}{3}} }%
        {\ODw@PrintColor{\ODw@E*}}% Vul
        {\ODw@E*}% not Vul
    }% 
  \or% #1=2: print S
    \ifboolexpr{ test {\ifnumcomp{\ODw@D}{=}{2}}}%
    {% dealer S
      \ifboolexpr{ test {\ifnumcomp{\ODw@V}{=}{1}} or%
                   test {\ifnumcomp{\ODw@V}{=}{2}} }%
        {\ODw@PrintColor{%
           \ensuremath{\overline{\mbox{\ODw@S*}}}}%
        }% Vul
        {\ensuremath{\overline{\mbox{\ODw@S*}}}}% not Vul
    }{% dealer <> S
      \ifboolexpr{ test {\ifnumcomp{\ODw@V}{=}{1}} or%
                   test {\ifnumcomp{\ODw@V}{=}{2}} }%
        {\ODw@PrintColor{\ODw@S*}}% Vul
        {\ODw@S*}% not Vul
    }% 
  \or% #1=3: print W
    \ifboolexpr{ test {\ifnumcomp{\ODw@D}{=}{3}}}%
    {% dealer W
      \ifboolexpr{ test {\ifnumcomp{\ODw@V}{=}{1}} or%
                   test {\ifnumcomp{\ODw@V}{=}{3}} }%
        {\ODw@PrintColor{\underline{\ODw@W*}}}% Vul
        {\underline{\ODw@W*}}% not Vul
    }{% dealer <> W
      \ifboolexpr{ test {\ifnumcomp{\ODw@V}{=}{1}} or%
                   test {\ifnumcomp{\ODw@V}{=}{3}} }%
        {\ODw@PrintColor{\ODw@W*}}% Vul
        {\ODw@W*}% not Vul
    }% 
  \fi% (ifcase#1)
\egroup%
}% ODw@Print
%    \end{macrocode}
% \end{macro}
%
% \DeleteShortVerb{\|}
% \begin{macro}{\ODw@PrintColor}\MacroDef{ODw@PrintColor}[\{|N|E|S|W\}]
% \MakeShortVerb{\|}
% |\ODw@PrintColor| checks if we are in monochrome mode. If that is the
% case we print |N|, |E|, |S| or |W| in italics, otherwise in color.
% 
%    \begin{macrocode}
\newcommand\ODw@PrintColor[1]{%
  \ifODw@monochrome\textit{#1}\else\textcolor{red}{#1}\fi%
}% ODw@PrintColor
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\ODw@mid}
% Hook to write something in the middle of the compass. We write what is
% stored in |\ODw@CompMid| a bit smaller than the |N-S| and |E-W| letters.
% |\ODw@mid| writes the contents of |\ODw@CompMid| in the middle of the
% compass. As there is only very limited room, this text should be very
% short. It is primarily meant to write just a board number in the
% compass.
% \begin{macro}{\ODw@CompMid}
%    \begin{macrocode}
\def\ODw@CompMid{}
\def\ODw@mid{{\smaller\smaller\smaller\ODw@CompMid}}
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\ODw@Box}
% Displays a \ODwBox 
%    \begin{macrocode}
\newcommand{\ODw@Box}{%
  \bgroup
    \setlength{\fboxsep}{0pt}%
    \setlength{\fboxrule}{0.1em}%
    \fbox{\rule{0mm}{0.7em}\rule{0.7em}{0mm}}%
  \egroup
}% ODw@Box
%    \end{macrocode}
% \end{macro}
%
%
% \subsubsection{Diagram Conditions}
%
% Here we implement several macros that add some board information to the
% card diagram. |\ODw@BoardText| serves as a variable to store the
% user-defined or (by means of the board number) auto-generated text,
% concerning the board. The macro |\boardnr| has 1 mandatory argument. If
% it is a number, it is considered to be the board number.
% The dealer and which side is vulnerable is then
% calculated from it and stored by calling |\dealer| resp. |\vulner|.  If
% it is not a positive integer, it is considered user-defined text which is
% stored 'as is' in |\ODw@BoardText|. The contents can be retrieved by the
% user by calling |\boardtext| to actually print the board information.
% \begin{macro}{\ODw@BoardText}
%    \begin{macrocode}
\def\ODw@BoardText{}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\boardtext}\MacroDef{boardtext}[\Oarg{*}]
% \noindent
% |\boardtext| has only 1 token and no arguments. The unstarred form
% outputs only the text stored in |\ODw@BoardText|, this is normally a
% board number. |\boardtext*| outputs something like 'Board:~23'.
%    \begin{macrocode}
\NewDocumentCommand\boardtext{s}{%
  \IfBooleanTF#1{\GetTranslation{Board-(ODw)}:\,\ODw@BoardText}%
                {\ODw@BoardText}%
}% boardtext
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\boardnr}\MacroDef{boardnr}[\marg{Nr}]
% |\boardnr{Nr}| sets the dealership and vulnerability according to |Nr|.
% As the system repeats itself after the 16th board, we canonize |Nr| to
% the range of 1--16. We also set |\ODw@BoardText| accordingly. For the
% association between boardnumber and dealer/vulner, see file
% \emph{Compass} of the |onedown-example| collection.
%    \begin{macrocode}
\newcommand{\boardnr}[1]{%
  \IfInteger{#1}{%
    \gdef\ODw@BoardText{%
      \bgroup%
        \ODw@OtherFont%
%        \GetTranslation{Board-(ODw)} #1%
      #1%
      \egroup%
    }%
    \setcounter{ODw@Cnt}{#1}%
    \whiledo{\theODw@Cnt > 16}{%
      \addtocounter{ODw@Cnt}{-16}%
    }% whiledo, now 1 <= Cnt <= 16
    \IfEqCase{\theODw@Cnt}{% set dealer/vulner
% Board 0 = no board: mark dealer and vulner undefined
      {0}{\gdef\ODw@BoardText{}\vulner[-1]\dealer[-1]}
      {1}{\vulner[\none]\dealer[\North*!]}
      {2}{\vulner[\NorthSouth*!]\dealer[\East*!]}
      {3}{\vulner[\EastWest*!]\dealer[\South*!]}
      {4}{\vulner[\all]\dealer[\West*!]}
      {5}{\vulner[\NorthSouth*!]\dealer[\North*!]}
      {6}{\vulner[\EastWest*!]\dealer[\East*!]}
      {7}{\vulner[\all]\dealer[\South*!]}
      {8}{\vulner[\none]\dealer[\West*!]}
      {9}{\vulner[\EastWest*!]\dealer[\North*!]}
      {10}{\vulner[\all]\dealer[\East*!]}
      {11}{\vulner[\none]\dealer[\South*!]}
      {12}{\vulner[\NorthSouth*!]\dealer[\West*!]}
      {13}{\vulner[\all]\dealer[\North*!]}
      {14}{\vulner[\none]\dealer[\East*!]}
      {15}{\vulner[\NorthSouth*!]\dealer[\South*!]}
      {16}{\vulner[\EastWest*!]\dealer[\West*!]}
    }% IfEqCase
  }{\gdef\ODw@BoardText{#1}}% otherwise take #1
}% boardnr
%    \end{macrocode}
% \end{macro}
%
% The next macros are used to add some game information above resp. below
% the card diagram. |\ODw@HeaderText| and |\ODw@FooterText| are used as
% variables to store the user-defined text.
% \begin{macro}{\headlinetext}\MacroDef{headlinetext}[\marg{text}]
% \begin{macro}{\ODw@HeaderText}
%    \begin{macrocode}
\newcommand\headlinetext[1]{\gdef\ODw@HeaderText{#1}}
\headlinetext{}
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\footlinetext}\MacroDef{footlinetext}[\marg{text}]
% \begin{macro}{\ODw@FooterText}
%    \begin{macrocode}
\newcommand\footlinetext[1]{\gdef\ODw@FooterText{#1}}
\footlinetext{}
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% The next macros are used to add some game information in the corners of
% the card diagram. We use a |tabular| with 1 column and 3 lines to do so.
%
% We redefine the (originally empty) |Left[Upper/Lower]|- and\\
% |Right[Upper/Lower]Text|, and set it to the wanted value. The
% first (optional) parameter defines some horizontal extra space if the
% hand and a condition text collide. The commands have 3 mandatory
% arguments, each for 1 of the 3 condition lines, which may be empty.
% \begin{macro}{\leftupper}\MacroDef{leftupper}[\oarg{h-offset}\marg{line1}\marg{line2}\marg{line3}]
% \begin{macro}{\ODw@LeftUpperText}
%    \begin{macrocode}
\def\ODw@LeftUpperText{}
\newcommand\leftupper[4][0pt]{%
  \gdef\ODw@LeftUpperText{%
    \hspace{-#1}%
     \begin{tabular}[t]{l}#2\\#3\\#4\\\end{tabular}
  }%
}% leftupper
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\leftlower}\MacroDef{leftlower}[\oarg{h-offset}\marg{line1}\marg{line2}\marg{line3}]
% \begin{macro}{\ODw@LeftLowerText}
%    \begin{macrocode}
\def\ODw@LeftLowerText{}
\newcommand\leftlower[4][0pt]{%
  \gdef\ODw@LeftLowerText{%
    \hspace{-#1}%
     \begin{tabular}[b]{l}#2\\#3\\#4\\\end{tabular}
  }%
}% leftlower
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\rightupper}\MacroDef{rightupper}[\oarg{h-offset}\marg{line1}\marg{line2}\marg{line3}]
% \begin{macro}{\ODw@RightUpperText}
%    \begin{macrocode}
\def\ODw@RightUpperText{}
\newcommand\rightupper[4][0pt]{%
  \gdef\ODw@RightUpperText{%
    \hspace{#1}%
     \begin{tabular}[t]{l}#2\\#3\\#4\\\end{tabular}
  }%
}% rightupper
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\rightlower}\MacroDef{rightlower}[\oarg{h-offset}\marg{line1}\marg{line2}\marg{line3}]
% \begin{macro}{\ODw@RightLowerText}
%    \begin{macrocode}
\def\ODw@RightLowerText{}
\newcommand\rightlower[4][0pt]{%
  \gdef\ODw@RightLowerText{%
    \hspace{#1}%
     \begin{tabular}[b]{l}#2\\#3\\#4\\\end{tabular}
  }%
}% rightlower
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
%
%
% \begin{macro}{\ODw@ProcessHeader}\MacroDef{ODw@ProcessHeader}[\marg{N}]
% |\ODw@ProcessHeader[N]| puts |HeaderText| in a multicolumn which spans N
% columns.
%    \begin{macrocode}
\newcommand{\ODw@ProcessHeader}[1]{%
%    \end{macrocode}
% Programmers note:\\
% |\ODw@TestIfEmpty| cannot be called in here. The |\ifthenelse| called within
% the tabular environment leads to the error:\\
%   \example{|! Misplaced |\bs|omit. |\bs|multispan ->|\bs|omit |\bs|@multispan|}
% \par\vspace{0.5\baselineskip}\noindent
% So the test of the emptiness of |Header-| and |FooterText| is done out of
% the tabular. Why is (La)TeX always causing unexpected problems?:-(
% \par\noindent
% We set the headline/footline text to the width of the diagram with a
% solution found at:\\
% \url{https://tex.stackexchange.com/questions/125005/how-to-create-a-table-where-one-cell-spans-all-the-columns-and-the-text-wraps-pr}
%
%    \begin{macrocode}
  \ifODw@EmptyHeader% Must be this way (StackExchange)
   \else%             |\ifthenelse| bites |\multicolumn|!
    \multicolumn{#1}{%
      p{\dimexpr\ODw@Diagram@Width-%
          2\tabcolsep-2\arrayrulewidth}%
    }{{\ODw@LegendFont\ODw@HeaderText}}\\
  \fi%
}% ODw@ProcessHeader
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\ODw@TestIfEmpty}\MacroDef{ODw@TestIfEmpty}[\marg{Str}\marg{Bool}]
% Tests the emptiness of a string.
%    \begin{macrocode}
\newcommand{\ODw@TestIfEmpty}[2]{%
%    \end{macrocode}
% |\ODw@TestIfEmpty{Str}{Bool}|\\
% | sets boolean Bool to true if string Str is empty|
%    \begin{macrocode}
  \ifthenelse{\equal{#1}{}}{%
    \setboolean{#2}{true}}{%
    \setboolean{#2}{false}%
  }%
}% ODw@TestIfEmpty
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\ODw@ProcessFooter}\MacroDef{ODw@ProcessFooter}[\marg{N}]
% |\ODw@ProcessFooter[N]| puts |FooterText| in a multicolumn which spans
% |N| columns.
%    \begin{macrocode}
\newcommand{\ODw@ProcessFooter}[1]{%
  \ifODw@EmptyFooter% Must be this way (StackExchange)
   \else%             |\ifthenelse| bites |\multicolumn|!
    \multicolumn{#1}{% 
      p{\dimexpr\ODw@Diagram@Width%
        -2\tabcolsep-2\arrayrulewidth}%
    }{{\ODw@LegendFont\ODw@FooterText}}\\
  \fi%
}% ODw@ProcessFooter
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\handskip}\MacroDef{handskip}[\marg{length}]
% |\handskip| adds \meta{length} to |SkipWidth|, i.e.\ the distance between
% the card diagram (with or without the east hand) and the |bidding|
% diagram.
%    \begin{macrocode}
\newcommand\handskip[1]{%
  \def\ODw@Skipwidth{1em + #1}% recalculate the new Skipwidth
  \setlength\ODw@Skip@Width{\ODw@Skipwidth}%
}% handskip
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\ODw@DealerText}
% Typesets the string \emph{Dealer}.
%    \begin{macrocode}
\def\ODw@DealerText{%
  \bgroup%
     \ODw@OtherFont\GetTranslation{Dealer-(ODw)}%
  \egroup%
}% ODw@DealerText
%    \end{macrocode}
% \end{macro}
% \par\noindent\needspace{2\baselineskip}
% \begin{macro}{\ODw@VulnerText}
% \makeatletter
% \MacroDef{ODw@VulnerText}[\Oarg{*!}\hfill \ODw@VulnerText (\ODw@VulnerText*,
%                   \ODw@VulnerText!, \ODw@VulnerText*!)]
% \makeatother
% Typesets the string \emph{vulnerable} or \emph{Vul}.
%    \begin{macrocode}
\NewDocumentCommand\ODw@VulnerText{s t!}{%
  \bgroup%
    \ODw@OtherFont%
    \IfBooleanTF#1{%
      \IfBooleanTF#2{\GetTranslation{Vul-(ODw)}}%
        {\GetTranslation{Vulnerable-(ODw)}}%
    }{%
      \IfBooleanTF#2{\GetTranslation{vul-(ODw)}}%
        {\GetTranslation{vulnerable-(ODw)}}%
    }%
  \egroup%
  \xspace%
}% ODw@VulnerText
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\ODw@AwardText} Typesets the text to be put as 'title' in
% the \emph{award} part of a expert quiz.
%    \begin{macrocode}
\def\ODw@AwardText{\textsf{\GetTranslation{Award-(ODw)}}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\dealer}\MacroDef{dealer}[\oarg{dealer}]
% If |#1 = empty| then set |\ODw@Dealer| to |#1| else output |\ODw@Dealer|
%    \begin{macrocode}
\newcommand\dealer[1][]{%
  \ifthenelse{\equal{#1}{}}%
    {\ODw@Dealer}%
    {\gdef\ODw@Dealer{#1}}%
}% dealer
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\ODw@Dealer}
% set \north as default
%    \begin{macrocode}
\def\ODw@Dealer{\North*}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\vulner}\MacroDef{vulner}[\oarg{vulner}]
% If |#1 = empty| then set |\ODw@Vulner| to |#1| else output |\ODw@Vulner|
%    \begin{macrocode}
\newcommand\vulner[1][]{%
  \ifthenelse{\equal{#1}{}}%
    {\ODw@Vulner}%
    {\gdef\ODw@Vulner{#1}}%
}% vulner
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\ODw@Vulner}
% set \NorthSouth as default
%    \begin{macrocode}
\def\ODw@Vulner{\NorthSouth}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\dealertext}
%    \begin{macrocode}
\newcommand\dealertext[1][\ODw@Dealer]{\ODw@DealerText:\,#1}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\vulnertext}
%    \begin{macrocode}
\newcommand\vulnertext[1][\ODw@Vulner]{%
  \ifODw@LongCalls%
    \ODw@VulnerText*%
  \else%
    \ODw@VulnerText*!%
  \fi%
  :\,#1%
}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\alert}
%    \begin{macrocode}
\newcommand{\alert}{{}\ensuremath{^\textbf{\textasteriskcentered}}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\announce}
%    \begin{macrocode}
\newcommand{\announce}{{}\ensuremath{^\textbf{\smaller A}}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\markit}\MacroDef{markit}
%    \begin{macrocode}
\newcommand\markit{%
%    \end{macrocode}
% Sets markers \emph{a, b} etc. To be used only in |bidding| diagrams.
%    \begin{macrocode}
  \stepcounter{ODw@Nr}%
  \footnotemark[\theODw@Nr]%
}% markit
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\explainit}\MacroDef{explainit}[\marg{text}]
%    \begin{macrocode}
\newcommand\explainit[1]{%
%    \end{macrocode}
% Explains the marked items.  To be used only in |bidding| diagrams. The
% counter |ODw@Nr| associates the marker with the explanation.
%    \begin{macrocode}
  \stepcounter{ODw@Nr}%
  \ensuremath{{}^\textrm{\smaller\alph{ODw@Nr}}}\,#1%
}% explainit
%    \end{macrocode}
% \end{macro}
%
% \subsection{The Bidding Environments}
%
% \subsubsection{Special Columntypes}
%
% \begin{macro}{\newcolumntype}
% In order to automatically apply a macro call on all cell contents of a
% column (translate/convert; step a counter) in |bidding| and |play| diagrams,
% we define newcolumntypes, made possible by loading package
% \packname{collectcell}. We define next columntypes:
% \begin{description}[topsep=2mm,itemsep=-2mm]
% \item{B:} Transfers suits and cards (|bidding| and |play|)
% \item{F:} sets First column in |play| diagrams
% \item{P:} Transfers suits and cards, accumulates won tricks (|play|)
% \end{description}
%
%    \begin{macrocode}
\newcolumntype{B}{% for Biddings
  >{\collectcell\ODw@BTfer}c<{\endcollectcell}}
\newcolumntype{F}{% for First column in |play| diagrams
  >{\collectcell\ODw@FTfer}c<{\endcollectcell}}
\newcolumntype{P}{% for |Play| diagrams (2nd--4th column)
  >{\collectcell\ODw@PTfer}c<{\endcollectcell}}
%    \end{macrocode}
% \end{macro}
%
% \subsubsection{The Hidden Implementation}
%
% As explained before, in the |bidding| diagrams we convert |S| to the spade
% symbol \Sp, etc. We do need packages \packname{array} and
% \packname{collectcell} for this and define the columntype |B|. In order
% to avoid these convertions in the top row, where names are displayed, we
% use the |\cci|-trick to suppress expansion of the cell macro. Curiously
% the command |\cci| (from \packname{collcell}, v0.5, 2011/02/27) sometimes
% produces unwanted characters. The reason is unknown to me.
% We use a space ("| |") as first character in |\cci| to avoid this.
% \par\noindent
% We store the |bidding| diagram without the explanations in a box, so we can
% calculate the width of the |bidding| diagram and make our explanation part
% exactly as wide. In the first row we write the bidders: |North| etc.\ (or
% |N|, if it has to be short). In the second row we write the real world
% names of the bidders, if given. If any description is given, we make a
% multicolumn over the 4 rows with the previously stored width to write the
% explanations. We also use this width to calculate whether the bidding
% diagram will fit on the actual line. If not, we put it on a new line.
% \begin{environment}{ODw@Bidding}\MacroDef{ODw@Bidding}[\oarg{pos}\parg{description}\ldots\bs endODw@Bidding]
%    \begin{macrocode}
\NewEnviron{ODw@Bidding}[2][t]{%
  \def\xspace{}%
  \setlength\tabcolsep{0.2em}%
  \sbox{0}{%
    \begin{tabular}[#1]{BBBB}% 1st column
     \ifODw@Bidders%
      \cci{ % there MUST be a ' ' (space)
        \ODw@BidderFont%
          \ifODw@short\ODw@BidderI%
            \else\ODw@BidderI*%
          \fi%
      } &%                     2nd column
      \cci{ % there MUST be a ' ' (space)
        \ODw@BidderFont%
          \ifODw@short\ODw@BidderII%
            \else\ODw@BidderII*%
          \fi%
      } &%                     3rd column
      \cci{ % there MUST be a ' ' (space)
        \ODw@BidderFont%
          \ifODw@short\ODw@BidderIII%
            \else\ODw@BidderIII*%
          \fi%
      } &%                     4th column
      \cci{ % there MUST be a ' ' (space)
        \ODw@BidderFont%
          \ifODw@short\ODw@BidderIV%
            \else\ODw@BidderIV*%
          \fi%
      } \\% end of 1st row
      \if\ODw@All@Names\empty%
      \else% 2nd row
        \cci{ \ODw@NameFont\ODw@NameI}   &%  please
        \cci{ \ODw@NameFont\ODw@NameII}  &%  mind
        \cci{ \ODw@NameFont\ODw@NameIII} &%  the
        \cci{ \ODw@NameFont\ODw@NameIV}  \\% spaces!
      \fi%
      \ifODw@BidLine\hline\fi%
     \fi%
     \BODY%
%%%%%%
    \end{tabular}%
  }% sbox0
  \setcounter{ODw@Nr}{0}%
  \setlength{\ODw@Bid@Width}{\wd0}%
  \global\sbox\ODw@BidBox{%
    \begin{tabular}[#1]{BBBB}%   1st column
     \ifODw@Bidders%
      \cci{ % there MUST be a ' ' (space)
        \ODw@BidderFont%
          \ifODw@short\ODw@BidderI%
            \else\ODw@BidderI*%
          \fi%
      } &%                       2nd column
      \cci{ % there MUST be a ' ' (space)
        \ODw@BidderFont%
          \ifODw@short\ODw@BidderII%
            \else\ODw@BidderII*%
          \fi%
      } &%                       3rd column
      \cci{ % there MUST be a ' ' (space)
        \ODw@BidderFont%
          \ifODw@short\ODw@BidderIII%
            \else\ODw@BidderIII*%
          \fi%
      } &%                       4th column
      \cci{ % there MUST be a ' ' (space)
        \ODw@BidderFont%
          \ifODw@short\ODw@BidderIV%
            \else\ODw@BidderIV*%
          \fi%
      } \\% end of 1st row
      \if\ODw@All@Names\empty%
      \else% 2nd row
        \cci{ \ODw@NameFont\ODw@NameI}   &%  please
        \cci{ \ODw@NameFont\ODw@NameII}  &%  mind
        \cci{ \ODw@NameFont\ODw@NameIII} &%  the
        \cci{ \ODw@NameFont\ODw@NameIV}  \\% spaces!
      \fi%
      \ifODw@BidLine\hline\fi%
     \fi
     \BODY%
%%%%%  Until here the same code as in the sbox!
      \ifODw@description%
      % Add the description, if not empty
        \hline%
        \multicolumn{4}{% span explanations over 4 cols...
          p{\dimexpr\ODw@Bid@Width-2\tabcolsep}%
        }{% ...with the right width
          \setcounter{ODw@Nr}{0}%
          \raggedright%
          \smaller\smaller#2%
        }\\%
      \fi%
    \end{tabular}%
  }% sbox ODw@BidBox
}% ODw@Bidding
%    \end{macrocode}
% \end{environment}
%
% \begin{environment}{ODw@Biddingpair}\MacroDef{ODw@Biddingpair}[\oarg{pos}\parg{description}\ldots\bs endODw@Biddingpair]
% Decription: Similar to |ODw@Bidding|
%    \begin{macrocode}
\NewEnviron{ODw@Biddingpair}[2][t]{%
  \def\xspace{}%
  \setlength\tabcolsep{0.2em}%
  \sbox{0}{%
   \begin{tabular}[#1]{BB}% 1st column
    \ifODw@Bidders%
     \cci{ % there MUST be a ' ' (space)
      \ODw@BidderFont%
       \ifODw@short\ODw@BidderI%
         \else\ODw@BidderI*%
       \fi%
     } &% 2nd column
     \cci{ % there MUST be a ' ' (space)
      \ODw@BidderFont%
       \ifODw@short\ODw@BidderIII%
        \else\ODw@BidderIII*%
       \fi%
      } \\% end of 1st row
      \if\ODw@All@Names\empty%
       \else% 2nd row
        \cci{ \ODw@NameFont\ODw@NameI} &%  please mind
        \cci{ \ODw@NameFont\ODw@NameIII} \\% the spaces!
      \fi%
      \ifODw@BidLine\hline\fi%
     \fi%
     \BODY%
%%%%%%%
    \end{tabular}%
  }% sbox0
  \setcounter{ODw@Nr}{0}%
  \setlength{\ODw@Bid@Width}{\wd0}%
  \global\sbox\ODw@BidBox{%
    \begin{tabular}[#1]{BB}% 1st column
     \ifODw@Bidders%
      \cci{ % there MUST be a ' ' (space)
       \ODw@BidderFont%
        \ifODw@short\ODw@BidderI%
         \else\ODw@BidderI*%
        \fi%
      } &% 2nd column
      \cci{ % there MUST be a ' ' (space)
        \ODw@BidderFont%
          \ifODw@short\ODw@BidderIII%
            \else\ODw@BidderIII*%
          \fi%
      } \\% end of 1st row
      \if\ODw@All@Names\empty%
      \else% 2nd row
       \cci{ \ODw@NameFont\ODw@NameI}   &%  please mind
       \cci{ \ODw@NameFont\ODw@NameIII} \\% the spaces!
      \fi%
      \ifODw@BidLine\hline\fi%
     \fi%
     \BODY%
  %%%%%% Until here the same code as in the sbox!
      \ifODw@description%
      % Add the description, if not empty
        \hline%
        \multicolumn{2}{%
          p{\dimexpr\ODw@Bid@Width-2\tabcolsep}%
        }{%
          \setcounter{ODw@Nr}{0}%
          \raggedright%
          \smaller\smaller#2%
        }\\%
      \fi%
    \end{tabular}%
  }% sbox ODw@BidBox
}% ODw@Biddingpair
%    \end{macrocode}
% \end{environment}
%
% \subsection{The User Environments}
%
% \subsubsection{Bidding}
%
% The |bidding| environments have 2 optional arguments: an alignment
% \oarg{pos} and an annotation \parg{description}. There are also 3 tokens:
% the |*| centers the |bidding| diagram, the |+| forces the short notation,
% i.e. \North*! rather than \North* and the |-| suppresses all output.
% \par\noindent
% |\ODw@GameSize| takes care of the font dependent sizing of the diagram.
% We locally redefine |\thefootnote| and reset the (general) counter
% |ODw@Nr|, which is stepped in |\markit| and |\explainit| to make the
% annotations correspond. In the end code we define a multicolumn over all
% 4 (2) columns and write the annotation given in argument |#2|. With
% |p{...\ODw@Bid@Width...}| care is taken to limit this text to the width
% of the diagram.
%
% \begin{environment}{bidding}\EnvDef{bidding}[\Oarg{*!-}\oarg{pos}\parg{description}]
%    \begin{macrocode}
\NewDocumentEnvironment{bidding}{s t! t- O{c}d()}{%
%    \end{macrocode}
% |\begin{bidding}* ! -[pos](description)|\\
% |               1 2 3  4        5|\\
% The 1st token (|*|) centers the environment; the 2nd token (|!|) switches to the short
% notation in the table header; the 3rd token (|-|) suppresses the output.
% Argument 4 regulates the alignment of the table (default is \textbf{c}
% and the 5th argument contains the annotations of the bidding.
%    \begin{macrocode}
  \ODw@GameSize%
  \renewcommand{\thefootnote}{\alph{footnote}}%
  \setcounter{ODw@Nr}{0}%
  \IfBooleanTF#1{\center}{}%           "*" detected
  \IfBooleanTF{#2}{\ODw@shorttrue}{}%  "!" detected
  \IfValueTF{#5}{\ODw@descriptiontrue}{\ODw@descriptionfalse}%
  \ODw@Bidding[#4]{#5}%
}{%
  \endODw@Bidding%
  \IfBooleanTF{#3}%
    {\rule{0pt}{0pt}}%
  %           +---without this, pdflatex aborts compilation!
    {\usebox{\ODw@BidBox}}%  "-" detected
  \IfBooleanTF#1{\endcenter}{}%
}% bidding
%    \end{macrocode}
% \end{environment}
%
% \begin{environment}{biddingpair}\EnvDef{biddingpair}[\Oarg{*!-}\oarg{pos}\parg{description}]
%    \begin{macrocode}
\NewDocumentEnvironment{biddingpair}{s t! t- O{c}d()}{%
%    \end{macrocode}
% |\begin{biddingpair}* ! -[pos](description)|\\
% |                   1 2 3  4        5|\\
% The same as with environment |bidding|, only with 2 columns instead of 4.
%    \begin{macrocode}
  \def\xspace{}%
  \ODw@GameSize%
  \renewcommand{\thefootnote}{\alph{footnote}}%
  \setcounter{ODw@Nr}{0}%
  \IfBooleanTF#1{\center}{}%           "*" detected
  \IfBooleanTF{#2}{\ODw@shorttrue}{}%  "+" detected
  \IfValueTF{#5}{\ODw@descriptiontrue}{\ODw@descriptionfalse}%
  \ODw@Biddingpair[#4]{#5}%
}{%
  \endODw@Biddingpair%
  \IfBooleanTF{#3}%
    {\rule{0pt}{0pt}}%
  %           +---without this, pdflatex aborts compilation!
    {\usebox{\ODw@BidBox}}%  "-" detected
  \IfBooleanTF#1{\endcenter}{}%
}% biddingpair
%    \end{macrocode}
% \end{environment}
%
%
% \subsubsection{Play}
%
% Environment |play| displays the sequence of playing tricks. It uses
% 2 |newcolumntype|s:
% \begin{itemize}[itemsep=0em]
% \item[|F|] to increment and display the current row.
% \item[|P|] to translate an convert suits/ranks.
% \end{itemize}
%
% \begin{macro}{\ODw@AccTricks}
% |\ODw@AccTricks| calculates and shows the accumulated tricks in
% |play| that |N-S| and |E-W| has won. The winning card is detected
% automatically and |\ODw@LastTrick| is called to process the winning trick
% for whichever side won it (|N-S| or |E-W|) by stepping the counter for the
% winning side. The counter |ODw@Player| denotes the player who won the
% trick. From the player who leads and the position that wins we calculate
% the winning player and step the counter for his side.
%    \begin{macrocode}
\def\ODw@AccTricks{%
    \ODw@LastTrick{\ODw@Last}{\theODw@WinningNr}%
    \ODw@append{\theODw@NSCnt,\theODw@EWCnt,}% store counters
    \setcounter{ODw@Highest}{0}% reset for next trick
}% ODw@AccTricks
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\ODw@Tricks}\MacroDef{ODw@Tricks}
% \begin{macro}{\ODw@Last}\label{Last}
% This macro is automatically called in TableII for column 1.
% This column displays the player who had the lead.
% It essentially 1) resets the |ODw@PlayerNr| which will be
% stepped for each next column in search for the winning card 2)
% remembers in |\ODw@Last| who had the lead. From these two values we can
% later calculate who won this trick. The stepping of |ODw@PlayerNr| occurs
% in |\ODw@Tfer|.
%    \begin{macrocode}
\def\ODw@Tricks{%
  \setcounter{ODw@PlayerNr}{0}%
  \gdef\ODw@Last{\ODw@NextLead}%
    \expandafter\GetTranslation%
    \expandafter{\ODw@NextLead-(ODw)}:\,%
% write a colon and a thin space in the table,
% as separator between lead player and lead card.
}% ODw@Tricks
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\ODw@LastTrick}\MacroDef{ODw@LastTrick}[\marg{Player}\marg{Pos}]
% This macro is called by |\ODw@AccTricks|.
% It computes who won the last trick and steps the corresponding counter.
%    \begin{macrocode}
\newcommand\ODw@LastTrick[2]{%
%    \end{macrocode}
% |\ODw@LastTrick{Player}{Pos}|\\
% |                 1      2--- Seat Nr that won the trick|\\
% |                 +---------- Player (N,E,S,W) who has led|
% \par\vspace{0.5\baselineskip}\noindent
% Consider the following table, where the seats are in horizontal
% direction, starting with the player who leads in seat 1. Vertically, in
% the first column, we have an initial value, stored in |ODw@Cnt| which is
% associated with the leading player.
%
% \begin{tabular}{c|cccc}
%      & 1     & 2 & 3 & 4 \\\hline
%    0 & W$^1$ & N$^2$ & E$^3$ & S$^4$ \\
%    1 & N$^2$ & E$^3$ & S$^4$ & W$^5$ \\
%    2 & E$^3$ & S$^4$ & W$^5$ & N$^6$ \\
%    3 & S$^4$ & W$^5$ & N$^6$ & E$^7$ \\
% \end{tabular}
% \par\noindent
% If we add this initial value to the
% \emph{seat} where the trick is won, then the result gives us the
% \emph{player} who won the trick. Suppose that e.g.\ |S| had the lead,
% so |ODw@Cnt| $=$ 3. Suppose also that seat number 3 wins the trick. The
% sum equals 6 and this is the seat of |N|. For clarity these sums are
% displayed in the table as superscripts to the players
% \par\vspace{0.5\baselineskip}\noindent
% First we set the counter |ODw@Cnt| to the player who has the lead and add
% the seat number (|#2|) to it. We then store who has the next lead in
% |\ODw@NextLead| and increment the counter of the winning side.
%
%    \begin{macrocode}
  \IfEqCase{#1}{%
    {W}{\setcounter{ODw@Cnt}{0}}%
    {N}{\setcounter{ODw@Cnt}{1}}%
    {E}{\setcounter{ODw@Cnt}{2}}%
    {S}{\setcounter{ODw@Cnt}{3}}%
  }% IfEqCase
  \addtocounter{ODw@Cnt}{#2}%
  \IfEqCase{\theODw@Cnt}{%
    {1}{\gdef\ODw@NextLead{W}\stepcounter{ODw@EWCnt}}
    {2}{\gdef\ODw@NextLead{N}\stepcounter{ODw@NSCnt}}
    {3}{\gdef\ODw@NextLead{E}\stepcounter{ODw@EWCnt}}
    {4}{\gdef\ODw@NextLead{S}\stepcounter{ODw@NSCnt}}
    {5}{\gdef\ODw@NextLead{W}\stepcounter{ODw@EWCnt}}
    {6}{\gdef\ODw@NextLead{N}\stepcounter{ODw@NSCnt}}
    {7}{\gdef\ODw@NextLead{E}\stepcounter{ODw@EWCnt}}
  }% IfEqCase
}% ODw@LastTrick
%    \end{macrocode}
% \end{macro}
%
% \begin{environment}{play}\EnvDef{play}[*\marg{Lead}\oarg{Trump}]
% \label{Play}
% \changes{v0.3}{2018/02/24}{\\
% - In order to avoid empty columns in environment \texttt{playtricks} we
% reorganized it. Rather than just 1 table we use 3 tables. The middle one
% typesets the relevant tricks, stored in an \texttt{lrbox}, while
% generating on the fly a string with the winning tricks. Finally we put
% the running trick-number in TableI, we 'use' TableII and contruct
% TableIII from the string with the winning tricks.}
%
% Finally we define environment |play|. It consists primarily of
% these 3 tables, the middle one  with the special newcolumntype
% \textbf{P}. We reset the
% counter for the running line (=trick) |ODw@Nr| and the winning trick
% counters for |N|--|S| and |E|--|W|: |ODw@NSCnt| and |ODw@EWCnt|. As usual
% |\ODw@GameSize| takes care for the correct sizing. The first row (the
% title row) is displayed using the |\cci| method. The 3th table gets a
% stacked |N/S| and |E/W| title.
%    \begin{macrocode}
\NewDocumentEnvironment{play}{s mO{N}}{%
% #1 --> s center
% #2 --> m lead
% #3 --> O trumpsuit (default NoTrump)
  \def\ODw@TrumpSuit{#3}
  \gdef\ODw@NextLead{#2}%
  \setcounter{ODw@Nr}{0}%
  \setcounter{ODw@NSCnt}{0}
  \setcounter{ODw@EWCnt}{0}%
  \ODw@GameSize%
  \ODw@Scratch{}% make empty 
  \let\ODw@Clubs\empty%
  \let\ODw@Diamonds\empty%
  \let\ODw@Hearts\empty%
  \let\ODw@Spades\empty%
%
% We need some data which is calculated in TableII
% to create TableI and TableIII. So we put TableII in a 
% box and display it later at due time
%
\def\ODw@EXtra{0.9em}% white space in title
%
\provideenvironment{TableII}{%
    \begin{tabular}[b]{FPPP}%
      \multicolumn{1}{c}{\GetTranslation{Lead!-(ODw)}} &%
      \cci{\GetTranslation{2nd-(ODw)}}                 &%
      \cci{\GetTranslation{3rd-(ODw)}}                 &%
      \cci{\GetTranslation{4th-(ODw)}}   \\[0.3em]\hline%
      \multicolumn{4}{c}{}\\[-\ODw@EXtra]%
}{%
  \end{tabular}%
}% TableII
%
  \begin{lrbox}{0}% save TableII for later
    \begin{TableII}
}{%
    \end{TableII}
  \end{lrbox}%
  % Check consistency of the played cards
  \ODw@ChkSameCards{\ODw@Spades}{\Sp}%
  \ODw@ChkSameCards{\ODw@Hearts}{\He}%
  \ODw@ChkSameCards{\ODw@Diamonds}{\Di}%
  \ODw@ChkSameCards{\ODw@Clubs}{\Cl}%
%
  \setcounter{ODw@Cnt}{0}%
  \IfBooleanTF#1{\begin{center}}{}%
%
%    \end{macrocode}
% We need TableI to show the running trick number. When constructing Table
% II, the total number of tricks that were actually displayed is available
% in counter |ODw@Nr|. So we just need to loop |\theODw@Nr| times and write
% the local counter value |\theODw@Cnt|. To avoid \emph{the extra line
% problem} we use the solution from:\\
% \url{https://tex.stackexchange.com/questions/50296/problem-with-using-loop-inside-the-tabular-environment/142562#142562}
%    \begin{macrocode}
%
  \begin{tabular}[b]{r}% TableI
    \cci{\GetTranslation{Nr-(ODw)}}\\[0.3em]
    \hline\\[-\ODw@EXtra]%
    \setcounter{ODw@Cnt}{1}%
    \whiledo{\theODw@Cnt<\theODw@Nr}{%
      \theODw@Cnt\\
      \stepcounter{ODw@Cnt}%
    }%
    \theODw@Cnt\\% MUST be outside the loop 
  %  (the extra line problem]!
  \end{tabular}%
%
% TableII showing the cards played in the tricks
%
  \usebox{0}%
%
%    \end{macrocode}
% We use TableIII to show the winning trick counts. These are already stored
% in a CSV-list |\ODw@Scratch|, implemented as a token register. To process
% this list we use |\docsvlist| and must only define our |\do|. As this
% table has 2 columns, we check with |ODw@Nr| that after an item is read,
% we put an \& and after the next item a |\\|.
%    \begin{macrocode}
%
  \setcounter{ODw@Nr}{0}%
  \renewcommand*{\do}[1]{%
    \ifnumequal{\value{ODw@Nr}}{2}{\\\setcounter{ODw@Nr}{0}}{}%
    \stepcounter{ODw@Nr}%
    ##1
    \ifnumequal{\value{ODw@Nr}}{2}{}{&}%
  }%
  \begin{tabular}[b]{|cc}% TableIII
    \multicolumn{1}{|c}{%
      \cci{\scriptsize\shortstack[c]{\North*!\\\South*!}}} &%
    \multicolumn{1}{c}{%
      \cci{\scriptsize\shortstack[c]{\East*!\\\West*!}}%
    }\\\hline\\[-\ODw@EXtra]%
    \expandafter\docsvlist\expandafter{\the\ODw@Scratch}%
  \end{tabular}%
  \IfBooleanTF#1{\end{center}}{}%
%
}% play
%    \end{macrocode}
%  \end{environment}
%
% \subsection{Card Diagrams with Bidding}
%
% \begin{macro}{\ODw@CondNewLine}\MacroDef{ODw@CondNewLine}[\oarg{offset}]
%    \begin{macrocode}
\NewDocumentCommand\ODw@CondNewLine{O{0em}}{% 
%    \end{macrocode}
% |\ODw@CondNewLine| forces a newline if the |bidding| diagram does not fit on
% the line, taking into account the width of the card diagram and the width
% of the |bidding| diagram.
% Otherwise the |bidding| diagram appears to the right of the card diagram at
% distance |\ODw@Skip@Width|. We call the global macro
% |\ODw@Diagram@Width| that contains the width of the card diagram. The
% optional parameter of |\ODw@CondNewLine|  is used to add some extra
% offset if needed.
%
%    \begin{macrocode}
 {\ODw@GameFont% needed to relate skips to the font-size
%  :\the\ODw@Skip@Width:% JW XXX
  \setlength{\ODw@Tmp@Len}{\ODw@Bid@Width}%
  \addtolength{\ODw@Tmp@Len}{\ODw@Diagram@Width}%
  \addtolength{\ODw@Tmp@Len}{#1}%
  \addtolength{\ODw@Tmp@Len}{\ODw@Skip@Width}%
  \ifthenelse{\lengthtest{\ODw@Tmp@Len > \textwidth}}{%
    \\[1em]}{%
      \hspace{\ODw@Skip@Width}%
    }%
 }%
}% ODw@CondNewLine
%    \end{macrocode}
% \end{macro}
%
% \subsection{The Expert Quiz}
%
% \begin{macro}{\expertquiz}\MacroDef{expertquiz}[\Oarg{*!}\oarg{comment}\marg{award}]
% The macro |\expertquiz| displays a hand, a |bidding| diagram and the award
% for the answers. Optionally a description can be added. The hand and the
% bidding have to be defined before. This is done to avoid having 4 more
% arguments, needed for specifying the hand. The token '|*|' centers the
% whole and the token '|!|' forces that the |bidding| diagram appears on a
% new line and that the hand shifts a bit to the right. The last parameter
% defines the award. In order to limit the width of the award we use the
% known widths of the |bidding| diagram and the hand and set the parbox
% accordingly to display the award.
%
%    \begin{macrocode}
\NewDocumentCommand\expertquiz{st! O{}m}{%
%                              12  3  4
%    \end{macrocode}
% |\expertquiz* ![comment]{award}|\\
% |           1 2    3       4   |\\

%    \begin{macrocode}
  \noindent%
  \IfBooleanTF#1{\begin{center}}%      "*" detected
    {\par\vspace{0.5\baselineskip}}%
  \bgroup% keep font changes local (e.g. "\smaller").
    \ODw@LegendFont%
    \ifx#3\empty\else#3\par\fi%
  \egroup%
  \IfBooleanTF{#2}{~\hspace*{2em}}{}% "!" detected
  \usebox{\ODw@Hand@Box}%   display the saved hand
  \IfBooleanTF{#2}{}{\quad}%       no "!" detected
  \setlength\ODw@Tmp@Width{\wd\ODw@BidBox + 1em}%
  \IfBooleanTF{#2}%
    {\\}%
    {\addtolength\ODw@Tmp@Width{\wd\ODw@Hand@Box}}%
  \usebox{\ODw@BidBox}%     display the saved bidding
  \par\vspace{0.3em}%\noindent%
   {% keep legendfont and "smaller" local
    \ODw@LegendFont%
    \smaller%
    \IfBooleanTF#1{\bgroup\centering}{}%
    \parbox[t]{\ODw@Tmp@Width}{%
      \textbf{\ODw@AwardText: }%
      \raggedright#4%
    }% parbox
    \IfBooleanTF#1{\egroup}{}%
   }%
%  \fi%
    \IfBooleanTF#1{\end{center}}{}%
}% expertquiz
%    \end{macrocode}
% \end{macro}
%
% \subsection{Resetting the Game}
%
% We use \packname{pgfkeys} with its \meta{key}=\meta{val} system to
%specify the fonts and other things that we want to have as defaults,
%rather than the intitial \OneDown values. Therefore we first define the
%keys and the store for it.
%
%    \begin{macrocode}
\pgfkeys{%
  /ODw/.is family, /ODw,
% fonts
  bidder/.store in = \ODw@BidderDefault,
  compass/.store in = \ODw@CompassDefault,
  game/.store in = \ODw@GameDefault,
  legend/.store in = \ODw@LegendDefault,
  name/.store in = \ODw@NameDefault,
  other/.store in = \ODw@OtherDefault,
% compass
  compline/.store in = \ODw@CompLine,
  compmid/.store in = \ODw@CompMid,
  compsize/.store in = \ODw@CompSize,
}
% compass
  \ODw@set{compshow/.is choice}
  \ODw@set{compshow/off/.code={\ODw@CompShowfalse}}
  \ODw@set{compshow/on/.code={\ODw@CompShowtrue}}
  \ODw@set{compturn/.is choice}
  \ODw@set{compturn/off/.code={\ODw@CompTurnfalse}}
  \ODw@set{compturn/on/.code={\ODw@CompTurntrue}}
% bídding
  \ODw@set{bidders/.is choice}
  \ODw@set{bidders/off/.code={\ODw@Biddersfalse}}
  \ODw@set{bidders/on/.code={\ODw@Bidderstrue}}
  \ODw@set{bidfirst/.is choice}
  \ODw@set{bidfirst/N/.code=\ODw@FirstBidCol{N}}
  \ODw@set{bidfirst/E/.code=\ODw@FirstBidCol{E}}
  \ODw@set{bidfirst/S/.code=\ODw@FirstBidCol{S}}
  \ODw@set{bidfirst/W/.code=\ODw@FirstBidCol{W}}
  \ODw@set{bidline/.is choice}
  \ODw@set{bidline/off/.code={\ODw@BidLinefalse}}
  \ODw@set{bidline/on/.code={\ODw@BidLinetrue}}
  \ODw@set{bidlong/.is choice}
  \ODw@set{bidlong/off/.code={\ODw@LongCallsfalse}}
  \ODw@set{bidlong/on/.code={\ODw@LongCallstrue}}
% synonyms
  \ODw@set{compshow/1/.code={\pgfkeys{/ODw/compshow=on}}}
  \ODw@set{compshow/true/.code={\pgfkeys{/ODw/compshow=on}}}
  \ODw@set{compturn/1/.code={\pgfkeys{/ODw/compturn=on}}}
  \ODw@set{compturn/true/.code={\pgfkeys{/ODw/compturn=on}}}
  \ODw@set{bidline/1/.code={\pgfkeys{/ODw/bidline=on}}}
  \ODw@set{bidders/true/.code={\pgfkeys{/ODw/bidders=on}}}
  \ODw@set{bidders/1/.code={\pgfkeys{/ODw/bidders=on}}}
  \ODw@set{bidline/true/.code={\pgfkeys{/ODw/bidline=on}}}
  \ODw@set{bidlong/1/.code={\pgfkeys{/ODw/bidlong=on}}}
  \ODw@set{bidlong/true/.code={\pgfkeys{/ODw/bidlong=on}}}
%
  \ODw@set{compshow/0/.code={\pgfkeys{/ODw/compshow=off}}}
  \ODw@set{compshow/false/.code={\pgfkeys{/ODw/compshow=off}}}
  \ODw@set{compturn/0/.code={\pgfkeys{/ODw/compturn=off}}}
  \ODw@set{compturn/false/.code={\pgfkeys{/ODw/compturn=off}}}
  \ODw@set{bidders/0/.code={\pgfkeys{/ODw/bidders=off}}}
  \ODw@set{bidders/false/.code={\pgfkeys{/ODw/bidders=off}}}
  \ODw@set{bidline/0/.code={\pgfkeys{/ODw/bidline=off}}}
  \ODw@set{bidline/false/.code={\pgfkeys{/ODw/bidline=off}}}
  \ODw@set{bidlong/0/.code={\pgfkeys{/ODw/bidlong=off}}}
  \ODw@set{bidlong/false/.code={\pgfkeys{/ODw/bidlong=off}}}
%    \end{macrocode}
%
% \begin{macro}{\resetfonts}\MacroDef{resetfonts}
%    \begin{macrocode}
\newcommand\resetfonts{%
  \bidderfont{\ODw@BidderDefault}%
  \compassfont{\ODw@CompassDefault}%
  \gamefont{\ODw@GameDefault}%
  \legendfont{\ODw@LegendDefault}%
  \namefont{\ODw@NameDefault}%
  \otherfont{\ODw@OtherDefault}%
}% resetfonts
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\setdefaults}\MacroDef{setdefaults}[\Oarg{*}\string{\meta{key1=val1},\meta{key2=val2},\ldots\string}]
% The available keys are those defined in |\pgfkeys| some lines up from
% here. For the fonts they are: |bidder|, |compass|, |game|, |legend|,
% |name| and |other|. They store the new default value in the corresponding
% variable. In order to make the new default active, we must use
% |\setdefaults*| which will also call |\resetfonts|.
%
% The keys for the compass are: |compline|, |compmid|, |compshow|,
% |compsize| and |compturn|. They control the thickness of the frame, the
% mid-text, the visibility of the compass, its size and the angle of the
% compass E--W letters.
%
% For the |bidding| diagram we have: |bidders|, |bidfirst|, |bidline| and
% |bidlong|. They control if bidders are to be displayed at all, which
% bidder appears in the first column, draw a |\hline| below the header and
% showing long calls.
%
% Furthermore defined elsewhere are the keys to control errors |err| and
% warnings |warn|, as well as the key to control the color e.g. of the
% symbols |colors|. Refer to section~\ref{Options}
%
%    \begin{macrocode}
\NewDocumentCommand\setdefaults{s m}{%
  \pgfkeys{/ODw,#2}%
  \IfBooleanTF{#1}{\resetfonts}{}%
}% setdefaults
%
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\newgame}\MacroDef{newgame}
% |\newgame| resets and clears the stored game information to be ready for
% a new game. We do not reset the option for warn- and err-messages, nor
% any selected font. Setting |\boardnr{0}| executes also:\\
% |\ODw@BoardText{}\vulner[-1]\dealer[-1]}|.
%
%    \begin{macrocode}
\newcommand\newgame{%
  \boardnr{0}%
  \headlinetext{}%
  \footlinetext{}%
% clear the left/right upper/lower stuff
  \gdef\ODw@LeftUpperText{}%
  \gdef\ODw@LeftLowerText{}%
  \gdef\ODw@RightUpperText{}%
  \gdef\ODw@RightLowerText{}%
% clear the hands
  \gdef\ODw@Nhand{\ODw@hand{t}{}{}{}{}}%
  \gdef\ODw@Ehand{\ODw@hand{c}{}{}{}{}}%
  \gdef\ODw@Shand{\ODw@hand{b}{}{}{}{}}%
  \gdef\ODw@Whand{\ODw@hand{c}{}{}{}{}}%
%
% set default for real bidders names: no names
% we print only the symbolic names North, East, etc.
%
   \namesNS{}{}\namesEW{}{}%
%
% reset consistency check stuff
%
  \gdef\ODw@Spades{}%
  \gdef\ODw@Hearts{}%
  \gdef\ODw@Diamonds{}%
  \gdef\ODw@Clubs{}%
%
  \gdef\ODw@NSpades{}\gdef\ODw@ESpades{}%
  \gdef\ODw@SSpades{}\gdef\ODw@WSpades{}%
  \gdef\ODw@NHearts{}\gdef\ODw@EHearts{}%
  \gdef\ODw@SHearts{}\gdef\ODw@WHearts{}%
  \gdef\ODw@NDiamonds{}\gdef\ODw@EDiamonds{}%
  \gdef\ODw@SDiamonds{}\gdef\ODw@WDiamonds{}%
  \gdef\ODw@NClubs{}\gdef\ODw@EClubs{}%
  \gdef\ODw@SClubs{}\gdef\ODw@WClubs{}%
%
}% newgame
%    \end{macrocode}
% \end{macro}
%
% \subsection{Error Handling}
%
% \subsubsection{Consistency Checks}
%
% We perform different checks on consistency of the cards entered:
% \begin{enumerate}[itemsep=-2mm]
% \item Check that a hand not has more than 13 cards (E)
% \item Check that a hand doesn't contain multiple cards (E)
% \item Check that a deal doesn't contain multiple cards (E)
% \item Check that a hand has less than 13 cards (W)
% \item check that a suit of a deal has more than 13 cards (E)
% \item check that a suit of a deal has less than 13 cards (W)
% \item In |play| diagrams: check that a card is played only once (E)
% \end{enumerate}
% The checks marked with (E) raise an error, those marked with (W) raise
% a warning. They can be controlled with the package options |err| and
% |warn|.
%
% \begin{macro}{\ODw@ChkNrOfCards}\MacroDef{ODw@ChkNrOfCards}[\marg{cards}\marg{hand}]
%    \begin{macrocode}
\newcommand\ODw@ChkNrOfCards[2]{%
%    \end{macrocode}
% |\ODw@ChkNrOfCards{cards}{hand}|\\
% |                    1      2|\\
% |#1 = a string with all cards of all suits of the hand denoted by #2|\\
% |step 1: remove all "-" (that denotes an empty suit)|\\
% |step 2: warn if StrLen < 13 ; Err if StrLen > 13|
%
%    \begin{macrocode}
  \StrDel{#1}{-}[\ODw@CardStr]%     remove voids
  \StrLen{\ODw@CardStr}[\ODw@CardLen]%  
  \ifthenelse{\ODw@CardLen > 13}{%
    \ODw@Error{#2 has \ODw@CardLen{} cards}%
  }{%
    \ifthenelse{\ODw@CardLen < 13}{%
      \ODw@Warning{#2 has \ODw@CardLen{} cards}%
    }{}%
  }%
}% ODw@ChkNrOfCards
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\ODw@PrErr}\MacroDef{ODw@PrErr}[\marg{rank}\marg{count}\marg{suit}]
%    \begin{macrocode}
\newcommand\ODw@PrErr[3]{%
%    \end{macrocode}
% |\ODw@PrErr{rank}{count}{suit}|\\
% |            1      2     3|\\
% This macro only outputs the warning/error if the card specified by rank
% (\#1) and suit (\#3) does not occur (denoted by \#2) exactly $1 \times$.
% An exception for spotcards must not be made, because in
% |\ODw@ChkSameCards| they are not taken into account. (In fact they are
% already filtered out by |ODw@translate|).
%
%    \begin{macrocode}
  \bgroup%
    \if#1T\def\ODw@T{10}\else\def\ODw@T{#1}\fi%
    \ifthenelse{#2 > 1}{%
      \ODw@Error{Card #3\,\ODw@T{} occurs #2 times}%
    }{%
      \ifthenelse{#2 = 0}{%
        \ODw@Warning{Card #3\,\ODw@T{} fails}}{}%
    }%
  \egroup%
}% ODw@PrErr
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\ODw@ChkSameCards}\MacroDef{ODw@ChkSameCards}[\marg{cards}\marg{suit}]
%    \begin{macrocode}
\newcommand\ODw@ChkSameCards[2]{%
%    \end{macrocode}
% |#1 = a string with all cards of 1 suit (denoted by #2) of all hands|\\
% |step 1: remove all "-" |\\
% |step 2: we count the frequency of all ranks 2--9,T,J,Q,K,A| (|ODw@CCnt|)\\
% |step 3: Warn if Freq(card) = 0 ; Err if Freq(card) > 1| (|ODw@PrErr|)\\
%
%    \begin{macrocode}
  \StrDel{#1}{-}[\ODw@CardStr]%
  \StrCount{\ODw@CardStr}{2}[\ODw@CCnt]\ODw@PrErr{2}{\ODw@CCnt}{#2}%
  \StrCount{\ODw@CardStr}{3}[\ODw@CCnt]\ODw@PrErr{3}{\ODw@CCnt}{#2}%
  \StrCount{\ODw@CardStr}{4}[\ODw@CCnt]\ODw@PrErr{4}{\ODw@CCnt}{#2}%
  \StrCount{\ODw@CardStr}{5}[\ODw@CCnt]\ODw@PrErr{5}{\ODw@CCnt}{#2}%
  \StrCount{\ODw@CardStr}{6}[\ODw@CCnt]\ODw@PrErr{6}{\ODw@CCnt}{#2}%
  \StrCount{\ODw@CardStr}{7}[\ODw@CCnt]\ODw@PrErr{7}{\ODw@CCnt}{#2}%
  \StrCount{\ODw@CardStr}{8}[\ODw@CCnt]\ODw@PrErr{8}{\ODw@CCnt}{#2}%
  \StrCount{\ODw@CardStr}{9}[\ODw@CCnt]\ODw@PrErr{9}{\ODw@CCnt}{#2}%
  \StrCount{\ODw@CardStr}{T}[\ODw@CCnt]\ODw@PrErr{T}{\ODw@CCnt}{#2}%
  \StrCount{\ODw@CardStr}{J}[\ODw@CCnt]\ODw@PrErr{J}{\ODw@CCnt}{#2}%
  \StrCount{\ODw@CardStr}{Q}[\ODw@CCnt]\ODw@PrErr{Q}{\ODw@CCnt}{#2}%
  \StrCount{\ODw@CardStr}{K}[\ODw@CCnt]\ODw@PrErr{K}{\ODw@CCnt}{#2}%
  \StrCount{\ODw@CardStr}{A}[\ODw@CCnt]\ODw@PrErr{A}{\ODw@CCnt}{#2}%
}% ODw@ChkSameCards
%    \end{macrocode}
% \end{macro}
%
% \subsubsection{Controlling Messages}
%
% \label{Messages}
%    \begin{macrocode}
\newbool{ODw@Warnings}
\newbool{ODw@Errors}
%
\ODw@set{warn/off/.code={%
  \global\setbool{ODw@Warnings}{false}}}
\ODw@set{warn/on/.code={%
  \global\setbool{ODw@Warnings}{true}}}
\ODw@set{err/off/.code={%
  \global\setbool{ODw@Errors}{false}}}
\ODw@set{err/on/.code={%
  \global\setbool{ODw@Errors}{true}}}
\ODw@set{warn=off}
\ODw@set{err=on}

\ProcessPgfOptions{/ODw}
%    \end{macrocode}

% \begin{macro}{\ODw@Error}
%    \begin{macrocode}
\newcommand\ODw@Error[1]{%
  \ifbool{ODw@Errors}{%
    \par\textcolor{red}{Error: #1}\par}{}%
}% ODw@Error
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\ODw@Warning}
%    \begin{macrocode}
\newcommand\ODw@Warning[1]{%
  \ifbool{ODw@Warnings}{%
    \par\textcolor{blue}{Warning: #1}\par}{}%
}% ODw@Warning
%    \end{macrocode}
% \end{macro}
%
% \subsection{Misc Bridge Terms}
%
% \subsubsection{Honour Cards}
%
% These macros retrieve the translations of the 4 alternative forms of the
% honour cards from the |ODw|-dictionary of the active language.
% \noindent
% \begin{macro}{\Ace}
% \begin{macro}{\ace}
%    \begin{macrocode}
\NewDocumentCommand{\Ace}{s t!}{%
  \bgroup%
%JW    \ODw@GameFont%
    \IfBooleanTF{#1}{%
      \IfBooleanTF{#2}%
        {\GetTranslation{A-(ODw)}}%
        {\GetTranslation{Ace-(ODw)}}%
   }{%
      \IfBooleanTF{#2}%
        {\GetTranslation{a-(ODw)}}%
        {\GetTranslation{ace-(ODw)}}%
  }%
  \egroup%
  \xspace%
}% Ace
%
\def\ace{\Ace*!}
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\King}
% \begin{macro}{\king}
%    \begin{macrocode}
\NewDocumentCommand{\King}{s t!}{%
  \bgroup%
%JW    \ODw@GameFont%
    \IfBooleanTF{#1}{%
      \IfBooleanTF{#2}%
        {\GetTranslation{K-(ODw)}}%
        {\GetTranslation{King-(ODw)}}%
   }{%
      \IfBooleanTF{#2}%
        {\GetTranslation{k-(ODw)}}%
        {\GetTranslation{king-(ODw)}}%
    }%
  \egroup%
  \xspace%
}% King
%
\def\king{\King*!}
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\Queen}
% \begin{macro}{\queen}
%    \begin{macrocode}
\NewDocumentCommand{\Queen}{s t!}{%
  \bgroup%
%JW    \ODw@GameFont%
    \IfBooleanTF{#1}{%
      \IfBooleanTF{#2}%
        {\GetTranslation{Q-(ODw)}}%
        {\GetTranslation{Queen-(ODw)}}%
   }{%
      \IfBooleanTF{#2}%
        {\GetTranslation{q-(ODw)}}%
        {\GetTranslation{queen-(ODw)}}%
    }%
  \egroup%
  \xspace%
}% Queen
%
\def\queen{\Queen*!}
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\Jack}
% \begin{macro}{\jack}
%    \begin{macrocode}
\NewDocumentCommand{\Jack}{s t!}{%
  \bgroup%
%JW    \ODw@GameFont%
    \IfBooleanTF{#1}{%
      \IfBooleanTF{#2}%
        {\GetTranslation{J-(ODw)}}%
        {\GetTranslation{Jack-(ODw)}}%
   }{%
      \IfBooleanTF{#2}%
        {\GetTranslation{j-(ODw)}}%
        {\GetTranslation{jack-(ODw)}}%
    }%
  \egroup%
  \xspace%
}% Jack
%
\def\jack{\Jack*!}
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\Ten}
%    \begin{macrocode}
\newcommand{\Ten}{%
  \bgroup%
%JW    \ODw@GameFont%
    10%
  \egroup%
  \xspace%
}% Ten
%    \end{macrocode}
% \end{macro}

%
% \subsubsection{Vulnerability}
%
% These macros retrieve the translations of the 4 alternative forms of the
% commands |\All| and |\None| from the |ODw|-dictionary of the active
% language. As there is no short form for them in the English language, we
% just code these entries in the |ODw|-dictionaries with an exclamation
% mark~'|!|'.

% \begin{macro}{\All}
% \begin{macro}{\all}
%    \begin{macrocode}
\NewDocumentCommand{\All}{s t!}{%
  \bgroup%
    \ODw@OtherFont%
    \IfBooleanTF{#1}{%
      \IfBooleanTF{#2}%
        {\GetTranslation{All!-(ODw)}}%
        {\GetTranslation{All-(ODw)}}%
   }{%
      \IfBooleanTF{#2}%
        {\GetTranslation{all!-(ODw)}}%
        {\GetTranslation{all-(ODw)}}%
    }%
  \egroup%
  \xspace%
}% All
%
\def\all{\All*}
%    \end{macrocode}
% \end{macro}
% \end{macro}

% \begin{macro}{\None}
% \begin{macro}{\none}
%    \begin{macrocode}
\NewDocumentCommand{\None}{s t!}{%
  \bgroup%
    \ODw@OtherFont%
    \IfBooleanTF{#1}{%
      \IfBooleanTF{#2}%
        {\GetTranslation{None!-(ODw)}}%
        {\GetTranslation{None-(ODw)}}%
   }{%
      \IfBooleanTF{#2}%
        {\GetTranslation{none!-(ODw)}}%
        {\GetTranslation{none-(ODw)}}%
    }%
  \egroup%
  \xspace%
}% None
%
\def\none{\None*}
%%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \subsubsection{Diagram Annotations}
%
% These macros retrieve the translations of the 4 alternative forms of the
% commands |\Contract|, |\Lead|, |\Declarer|, |\Board| and |\Deal| from the
% |ODw|-dictionary of the active language.
%
% \begin{macro}{\Contract}
% \begin{macro}{\contract}
%    \begin{macrocode}
\NewDocumentCommand{\Contract}{s t!}{%
  \bgroup%
    \ODw@OtherFont%
    \IfBooleanTF{#1}{%
      \IfBooleanTF{#2}%
        {\GetTranslation{Contr-(ODw)}}%
        {\GetTranslation{Contract-(ODw)}}%
   }{%
      \IfBooleanTF{#2}%
        {\GetTranslation{contr-(ODw)}}%
        {\GetTranslation{contract-(ODw)}}%
    }%
  \egroup%
  \xspace%
}% Contract
%
\def\contract{\Contract*}
%%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\Lead}
% \begin{macro}{\lead}
%    \begin{macrocode}
\NewDocumentCommand{\Lead}{s t!}{%
  \bgroup%
    \ODw@OtherFont%
    \IfBooleanTF{#1}{%
      \IfBooleanTF{#2}%
        {\GetTranslation{Lead!-(ODw)}}%
        {\GetTranslation{Lead-(ODw)}}%
    }{% else #1
      \IfBooleanTF{#2}%
        {\GetTranslation{lead!-(ODw)}}%
        {\GetTranslation{lead-(ODw)}}%
    }% #1
  \egroup%
  \xspace%
}% Lead
%
\def\lead{\Lead*}
%%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\Declarer}
% \begin{macro}{\declarer}
%    \begin{macrocode}
\NewDocumentCommand{\Declarer}{s t!}{%
  \bgroup%
    \ODw@OtherFont%
    \IfBooleanTF{#1}{%
      \IfBooleanTF{#2}%
        {\GetTranslation{Decl-(ODw)}}%
        {\GetTranslation{Declarer-(ODw)}}%
   }{%
      \IfBooleanTF{#2}%
        {\GetTranslation{decl-(ODw)}}%
        {\GetTranslation{declarer-(ODw)}}%
    }%
  \egroup%
  \xspace%
}% Declarer
%
\def\declarer{\Declarer*}
%%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\by}
%    \begin{macrocode}
\newcommand\by{%
  \bgroup%
    \ODw@OtherFont%
    \GetTranslation{by-(ODw)}%
  \egroup%
  \xspace%
}% by
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\Board}
% \begin{macro}{\board}
%    \begin{macrocode}
\NewDocumentCommand{\Board}{s t!}{%
  \bgroup%
    \ODw@OtherFont%
    \IfBooleanTF{#1}{%
      \IfBooleanTF{#2}%
        {\GetTranslation{Brd-(ODw)}}%
        {\GetTranslation{Board-(ODw)}}%
   }{%
      \IfBooleanTF{#2}%
        {\GetTranslation{brd-(ODw)}}%
        {\GetTranslation{board-(ODw)}}%
    }%
  \egroup%
  \xspace%
}% Board
%
\def\board{\Board*}
%%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\Deal}
% \begin{macro}{\deal}
%    \begin{macrocode}
\NewDocumentCommand{\Deal}{s t!}{%
  \bgroup%
    \ODw@OtherFont%
    \IfBooleanTF{#1}{%
      \IfBooleanTF{#2}%
        {\GetTranslation{Deal!-(ODw)}}%
        {\GetTranslation{Deal-(ODw)}}%
   }{%
      \IfBooleanTF{#2}%
        {\GetTranslation{deal!-(ODw)}}%
        {\GetTranslation{deal-(ODw)}}%
    }%
  \egroup%
  \xspace%
}% Deal
%
\def\deal{\Deal*}
%%    \end{macrocode}
% \end{macro}
% \end{macro}
% \begin{macro}{\doubled}
% The commands |\doubled| and |\redoubled| do not have a short form.
%    \begin{macrocode}
\NewDocumentCommand{\doubled}{s}{%
  \bgroup%
    \ODw@OtherFont%
    \IfBooleanTF{#1}{%
      \GetTranslation{Doubled-(ODw)}}{%
      \GetTranslation{doubled-(ODw)}%
    }%
  \egroup%
  \xspace%
}% doubled
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\redoubled}
%    \begin{macrocode}
\NewDocumentCommand{\redoubled}{s}{%
  \bgroup%
    \ODw@OtherFont%
    \IfBooleanTF{#1}{%
      \GetTranslation{Redoubled-(ODw)}}{%
      \GetTranslation{redoubled-(ODw)}%
    }%
  \egroup%
  \xspace%
}% redoubled
%    \end{macrocode}
% \end{macro}
%
% \subsubsection{Point Units}
%
% These macros retrieve the translations of the commands |\hpts|, |\lpts|,
% |\dpts| and |\tpts| from the |ODw|-dictionary of the active language.
% \begin{macro}{\hpts}
% \begin{macro}{\HCP}
%    \begin{macrocode}
\NewDocumentCommand{\hpts}{s t!}{%
  \bgroup%
    \ODw@OtherFont%
    \IfBooleanTF{#1}{%
      \IfBooleanTF{#2}%
        {\GetTranslation{HCP-(ODw)}}%
        {\GetTranslation{High Card Points-(ODw)}}%
    }{%
      \IfBooleanTF{#2}%
        {\GetTranslation{hcp-(ODw)}}%
        {\GetTranslation{high card points-(ODw)}}%
    }%
  \egroup%
  \xspace%
}% High Card Points
%
\def\HCP{\,\hpts*!}
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\lpts}
% \begin{macro}{\LP}
% \begin{macro}{\HLP}
%    \begin{macrocode}
\NewDocumentCommand{\lpts}{s t!}{%
  \bgroup%
    \ODw@OtherFont%
    \IfBooleanTF{#1}{%
      \IfBooleanTF{#2}%
        {\GetTranslation{LP-(ODw)}}%
        {\GetTranslation{Length Points-(ODw)}}%
    }{%
      \IfBooleanTF{#2}%
        {\GetTranslation{lp-(ODw)}}%
        {\GetTranslation{length points-(ODw)}}%
    }%
  \egroup%
  \xspace%
}% Length Points
%
\def\LP{\,\lpts*!}
\def\HLP{\,\bgroup\ODw@OtherFont\GetTranslation{HLP-(ODw)}\egroup\xspace}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\dpts}
% \begin{macro}{\DP}
%    \begin{macrocode}
\NewDocumentCommand{\dpts}{s t!}{%
  \bgroup%
    \ODw@OtherFont%
    \IfBooleanTF{#1}{%
      \IfBooleanTF{#2}%
        {\GetTranslation{DP-(ODw)}}%
        {\GetTranslation{Distribution Points-(ODw)}}%
    }{%
      \IfBooleanTF{#2}%
        {\GetTranslation{dp-(ODw)}}%
        {\GetTranslation{distribution points-(ODw)}}%
    }%
  \egroup%
  \xspace%
}% Distribution Points
%
\def\DP{\,\dpts*!}
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\tpts}
% \begin{macro}{\TP}
%    \begin{macrocode}
\NewDocumentCommand{\tpts}{s t!}{%
  \bgroup%
    \ODw@OtherFont%
    \IfBooleanTF{#1}{%
      \IfBooleanTF{#2}%
        {\GetTranslation{TP-(ODw)}}%
        {\GetTranslation{Total Points-(ODw)}}%
    }{%
      \IfBooleanTF{#2}%
        {\GetTranslation{tp-(ODw)}}%
        {\GetTranslation{total points-(ODw)}}%
    }%
  \egroup%
  \xspace%
}% Total Points
%
\def\TP{\,\tpts*!}
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \subsubsection{Forcings}
%
% These macros retrieve the translations of the commands |\gforce|,
% |\sforce|, |\nmforce|, |\tsforce|  and |\fsforce| from the
% |ODw|-dictionary of the active language.
% \begin{macro}{\gforce}
% \begin{macro}{\GF}
%    \begin{macrocode}
\NewDocumentCommand{\gforce}{s t!}{%
  \bgroup%
    \ODw@OtherFont%
    \IfBooleanTF{#1}{%
      \IfBooleanTF{#2}%
        {\GetTranslation{GF-(ODw)}}%
        {\GetTranslation{Game Forcing-(ODw)}}%
    }{%
      \IfBooleanTF{#2}%
        {\GetTranslation{gf-(ODw)}}%
        {\GetTranslation{game forcing-(ODw)}}%
    }%
  \egroup%
  \xspace%
}% Game Forcing
%
\def\GF{\gforce*!}
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\sforce}
% \begin{macro}{\SF}
%    \begin{macrocode}
\NewDocumentCommand{\sforce}{s t!}{%
  \bgroup%
    \ODw@OtherFont%
    \IfBooleanTF{#1}{%
      \IfBooleanTF{#2}%
        {\GetTranslation{SF-(ODw)}}%
        {\GetTranslation{Semi Forcing-(ODw)}}%
    }{%
      \IfBooleanTF{#2}%
        {\GetTranslation{sf-(ODw)}}%
        {\GetTranslation{semi forcing-(ODw)}}%
    }%
  \egroup%
  \xspace%
}% Semi Forcing
%
\def\SF{\sforce*!}
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\nmforce}
% \begin{macro}{\NMF}
%    \begin{macrocode}
\NewDocumentCommand{\nmforce}{s t!}{%
  \bgroup%
    \ODw@OtherFont%
    \IfBooleanTF{#1}{%
      \IfBooleanTF{#2}%
        {\GetTranslation{NMF-(ODw)}}%
        {\GetTranslation{New Minor Forcing-(ODw)}}%
    }{%
      \IfBooleanTF{#2}%
        {\GetTranslation{nmf-(ODw)}}%
        {\GetTranslation{new minor forcing-(ODw)}}%
    }%
  \egroup%
  \xspace%
}% New Minor Forcing
%
\def\NMF{\nmforce*!}
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\tsforce}
% \begin{macro}{\TSF}
%    \begin{macrocode}
\NewDocumentCommand{\tsforce}{s t!}{%
  \bgroup%
    \ODw@OtherFont%
    \IfBooleanTF{#1}{%
      \IfBooleanTF{#2}%
        {\GetTranslation{TSF-(ODw)}}%
        {\GetTranslation{Third Suit Forcing-(ODw)}}%
    }{%
      \IfBooleanTF{#2}%
        {\GetTranslation{tsf-(ODw)}}%
        {\GetTranslation{third suit forcing-(ODw)}}%
    }%
  \egroup%
  \xspace%
}% Third Suit Forcing
%
\def\TSF{\tsforce*!}
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\fsforce}
% \begin{macro}{\FSF}
%    \begin{macrocode}
\NewDocumentCommand{\fsforce}{s t!}{%
  \bgroup%
    \ODw@OtherFont%
    \IfBooleanTF{#1}{%
      \IfBooleanTF{#2}%
        {\GetTranslation{FSF-(ODw)}}%
        {\GetTranslation{Fourth Suit Forcing-(ODw)}}%
    }{%
      \IfBooleanTF{#2}%
        {\GetTranslation{fsf-(ODw)}}%
        {\GetTranslation{fourth suit forcing-(ODw)}}%
    }%
  \egroup%
  \xspace%
}% Fourth Suit Forcing
%
\def\FSF{\fsforce*!}
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \subsection{Initialization}\label{Init}
%
% It's time to prepare everything. We clear the game and set the defaults.
%    \begin{macrocode}
\newgame
%    \end{macrocode}
% Set the default fonts
%    \begin{macrocode}
\setdefaults{bidder=\mdseries\sffamily}
\setdefaults{compass=\mdseries\sffamily}
\setdefaults{game=\bfseries\sffamily}
\setdefaults{legend=\mdseries\rmfamily}
\setdefaults{name=\mdseries\slshape}
\setdefaults*{other=\bfseries\sffamily}
%    \end{macrocode}
%
% Set default coloring to black and red
%    \begin{macrocode}
\setdefaults{colors=b+r}
%    \end{macrocode}
%
% Set the compass
%    \begin{macrocode}
\setdefaults{compshow=on,compturn=off}
%    \end{macrocode}
% set the start column for bidding (West is recommended) and the long form.
%    \begin{macrocode}
\setdefaults{bidfirst=W,bidders=on,bidlong=on}
%    \end{macrocode}
% Now we load the dictionaries for the languages that are to be used in
% the document. We use \packname{tracklang} to iterate over all the
% document languages and load the corresponding |ODw|-dictionaries. Due to
% an inconsistency between \packname{babel} and \packname{translations}
% with respect to the Norwegian language (\packname{babel} calls this
% language \emph{norsk} whereas \packname{translations} insist on using
% \emph{norwegian}, we redefine |\thislang| to the latter if it happens to
% be \emph{norsk}.
%    \begin{macrocode}
\AtBeginDocument{%
\ForEachTrackedLanguage{\thislang}{%
  \ifthenelse{\equal{\thislang}{norsk}}%
    {\def\thislang{norwegian}}{}%
  \IfFileExists{ODw-\thislang.trsl}%
  {%
    \LoadDictionaryFor{\thislang}{ODw}%
    \PackageInfo{ODw}{%
      Translation dictionary ODw-\thislang.trsl loaded%
    }%
  }{%
    \PackageWarning{ODw}{%
      Translation dictionary ODw-\thislang.trsl not found%
    }%
  }%
}% ForEach
}% AtBeginDocument
%    \end{macrocode}
% That's it folks, happy \TeX ing!
%    \begin{macrocode}
\endinput% onedown.sty
%    \end{macrocode}

%
% \iffalse
%</package>
% \fi
%
% \Finale
% \begin{thebibliography}{Laan}
% \bibitem{Laan} Kees van der Laan:
%   \emph{Typsetting Bridge via \TeX},
%   TUGboat Vol.~11, No.~2 (1990), p265ff
%
% \bibitem{Pav} Richard Pavlicek:
%   \emph{Bridge Writing Style Guide},
%   \url{http://www.rpbridge.net/7z69.htm}
% \end{thebibliography}
%
% \PrintChanges
% \newpage
% \PrintIndex
% \ifnumequal{\pdfshellescape}{1}{%
%   \newpage
%   \enlargethispage{1\baselineskip}
%   \immediate\closeout\UCFile
%   \begin{multicols}{3}[\section{List of User Commands}]
%
%     \IfFileExists{\jobname.odw}
%        {\noindent\input{\jobname.odw}}
%        {\PackageWarning{ODw}{File \jobname.odw not found}}
%   \end{multicols}
% }{}
\endinput
