%%
%% onedown-ref.tex
%% Oct 04, 2019
%% Requires  the onedown bundle 
%% Part of the OneDown bundle (mirror.ctan.org/onedown)
%% author: J. Wiersma
%%--------NOTE-------------------------------------------
%% USAGE:   (pdf)latex  onedown-ref.tex
%%-------------------------------------------------------

\PassOptionsToPackage{shorthands=off}{babel}
\documentclass[a4paper,fontsize=11pt,%
  danish,%
  dutch,%
  french,%
  german,%
  norsk,%
  spanish,%
  swedish,%
  turkish,%
  english,%  this is the default language
]{scrartcl}
\usepackage{scrlayer-scrpage}
%
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
%
\usepackage{babel}%  
\usepackage{onedown}%       our own style to set bridge stuff
\usepackage[a4paper, total={185mm, 257mm},left=12mm,top=20mm]{geometry}
\newcommand\OneDown{\textcolor{red}{\smaller\bfseries\textsc{OneDown}}\xspace}
\usepackage{shortvrb}
\MakeShortVerb{\|}
\usepackage{enumitem}%
%\fi
%
%%%
%
\usepackage[Q=yes]{examplep}
\makeatletter
\def\verbatim@font{\ttfamily\bfseries
                   \hyphenchar\font\m@ne
                   \@noligs}
\makeatother
%
\newcommand\bs{%
  \texttt{%
    \upshape% the itshape of meta screws the backslash
    \textbackslash%
  }%
}% bs
%
\let\olditem\item
\renewcommand\item[1][\relax]{\olditem\textbf{\bs#1}}
%\def\Item{\olditem[\bs]}
%
\definecolor{optbackgr}{named}{lightgray}
\newcommand\Oarg[1]{\colorbox{optbackgr}{\texttt{#1}}}
% default language to show the onedown command
\def\RefLang{english}
\begin{document}
% when compiled with:
% pdflatex '\AtBeginDocument{\def\RefLang{YourLanguage}}\input{onedown-ref.tex}'
% you'll get the onedown commands expansions in YourLanguage
% YourLanguage can be any language out of:
% english, danish, dutch, french, german, norsk, spanish, swedish, turkish
%
\expandafter\selectlanguage\expandafter{\RefLang}
%
\larger
\newgeometry{total={150mm, 265mm},left=25mm,top=15mm}
\pagestyle{empty}
%\iffalse
\centerline{\larger\larger\textbf{\OneDown Reference Guide}}
\par\vspace{1\baselineskip}\noindent
Here we show all user commands of the package |onedown| in alphabetical
order. If we only show the ouput that a command produces, then this output
is shown directly behind the command on the same line. If a description of
the command is given, then this description starts on a new line. Optional
parameters of a command appear in brackets |[...]|, parenthesis |(...)| or
angles |<...>|. Optional tokens of a command appear with a different
background color, like \Oarg{*!}. Output of a tokenized |\macro*!| is shown
as:
\quad|\macro|\Oarg{*!}|: \macro, \macro*, \macro!, \macro*!|\\
The explanatory text is always in the English language. But you can show the output of all commands
in any of the supported languages.\\
These are: english, danish, dutch, french, german, norsk, spanish, swedish, turkish. \\
You obtain this output in \emph{YourLanguage} by compiling onedown-ref.tex with: \\[0.5em]
%
\verb|pdflatex '\AtBeginDocument{\def\RefLang{YourLanguage}}\input{onedown-ref.tex}'|
\\[0.7em]
\centerline{\textbf{This document shows the commands for the \emph{\languagename}\ language}}
\begin{description}[itemsep=-0.3em]
\item[ace]: \ace
\item[Ace\Oarg{*!}]: \Ace, \Ace*, \Ace!, \Ace*!

\item[alert]: |2\NT\alert| typesets 2\NT\alert and |2\Cl\alert| typesets
2\Cl\alert

\item[all]: \all
\item[All\Oarg{*!}]: \All, \All*, \All!, \All*! 

\item[allpass]: \allpass 
\item[Allpass\Oarg{*!}]: \Allpass, \Allpass*, \Allpass!, \Allpass*! 

\item[announce]: |2\He\announce| typesets 2\He\announce

\item[bidderfont\Q{{font} }]\\
Defines the font for the names in
bidding diagrams. The mandatory parameter for all font commands is a font
description like |\sffamily\bfseries\HUGE| or |\mdseries\slshape\smaller|
or |\sffamily\scalefont{3}|.

\item[board]: \board
\item[Board\Oarg{*!}]: \Board, \Board*, \Board!, \Board*! 

\item[boardnr\Q{{Nr} }]\\
Calculates (and stores) the dealership and vulnerability if |Nr|
is a number. If it is just a text it is stored to be used instead of a
board number.

\item[boardtext\Oarg{*}]\\
Typesets the value that is stored with |\boardnr|.
The star version writes the text \textbf{\boardtext*} in front of it.

\item[by]: \by

\item[Cl]: \Cl

\item[compassfont\Q{{font} }]\\
Defines the font for the compass.

\item[contract]: \contract
\item[Contract\Oarg{*!}]: \Contract, \Contract*, \Contract!, \Contract*!

\item[deal]: \deal
\item[Deal\Oarg{*!}]: \Deal, \Deal*, \Deal!, \Deal*! 

\item[dealer\Q{[text]}]\\
Typeset the defined dealer. With the optional
parameter one can define the dealer.

\item[dealertext\Q{[text]}]\\
Typeset the user-defined value for the |\dealer|,
e.g.\ \mbox{\dealertext[\east]}. With the optional parameter one can define
the |text| to be printed \emph{as is}.

\item[declarer]: \declarer
\item[Declarer\Oarg{*!}]: \Declarer, \Declarer*, \Declarer!, \Declarer*! 

\item[Di]: \Di

\item[double]: \double
\item[Double\Oarg{*!}]: \Double, \Double*, \Double!, \Double*!

\item[DP]: \DP
\item[dpts\Oarg{*!}]: \dpts, \dpts*, \dpts!, \dpts*!

\item[east]: \east
\item[East\Oarg{*!}]: \East, \East*, \East!, \East*!

\item[easthand\Q{[h-offset]{Sp}{He}{Di}{Cl}}]\\
Defines the cards for the
\East*!-player. With the optional parameter |h-offset| one can adapt the
(\emph{horizontal}) distance between hand and compass (default
\textbf{0pt}). The 4 mandatory parameters define the cards for the 4 suits.
To denote the rank \suit{T}, one has to use the uppercase letter |T|.

\item[eastwest]: \eastwest
\item[Eastwest\Oarg{*!}]: \EastWest, \EastWest*, \EastWest!, \EastWest*!

\item[expertquiz\Oarg{*!}\Q{[comment]{award}}]\\
Typesets a quiz, showing a
predefined hand and a predefined bidding diagram. The star version centers
the output. The token |!| forces a newline between hand and bidding
diagram. With the optional parameter one can add some comments. The
mandatory parameter defines the award for the different solutions.

\item[explainit\Q{{expl} }]\\
writes \emph{expl} below the bidding diagram in a footnote like way.

\item[footlinetext\Q{{text} }]\\
Typeset the text below the card diagram.

\item[FSF]: \FSF
\item[fsforce\Oarg{*!}]: \fsforce, \fsforce*, \fsforce!, \fsforce*!

\item[gamefont\Q{{font} }]\\
Defines the font for card diagrams, hands and suits.

\item[GF]: \GF
\item[gforce\Oarg{*!}]: \gforce, \gforce*, \gforce!, \gforce*!

\item[hand\Oarg{*!-}\Q{[pos]{Sp}{He}{Di}{Cl}}]\\
Typesets the cards of 1 single hand,
normally horizontally, left aligned. The star version centers the output.
The token |!| typesets the hand vertically, left aligned. With both |*!|
the hand is typeset vertically, centered. The optional argument |pos|
(default \textbf{c}), controls the horizontal alignment. 
The third token |-| suppresses all output, which is then only saved for
later use (in e.g.\ |\expertquiz|). The 4
mandatory parameters define the cards for the 4 suits. To denote the rank
\suit{T}, one has to use the uppercase letter |T|.

\item[handskip\Q{{length description} }]\\
Adds |length| to the distance (default |1em|) between the rightmost hand
and the bidding diagram.

\item[HCP]: \HCP

\item[headlinetext\Q{{text} }]\\
Typeset the text above the card diagram.

\item[He]: \He

\item[HLP]: \HLP

\item[hpts\Oarg{*!}]: \hpts, \hpts*, \hpts!, \hpts*!

\item[jack]: \jack
\item[Jack\Oarg{*!}]: \Jack. \Jack*, \Jack!, \Jack*!
 
\item[king]: \king
\item[King\Oarg{*!}]: \King, \King*, \King!, \King*!

\item[lead]: \lead
\item[Lead\Oarg{*!}]: \Lead, \Lead*, \Lead!, \Lead*!

\item[leftlower\Q{[h-offset]{line1}{line2}{line3}}]

\item[leftupper\Q{[h-offset]{line1}{line2}{line3}}]\\
Typesets an annotation of 3 lines in the left lower/upper corner of the
card diagram. With the optional parameter one can add some extra horizontal
space between hand and annotation.

\item[legendfont\Q{{font} }]\\
Defines the font for annotations in card diagrams.

\item[LP]: \LP
\item[lpts\Oarg{*!}]: \lpts, \lpts*, \lpts!, \lpts*!

\item[markit]\\
sets a footnote-like marker in a bidding diagram.

\item[namefont\Q{{font} }]\\
Defines the font for the real world names in bidding diagrams.

\item[namesEW\Q{{E-name}{W-name}}]\\
Defines the real world names for the \eastwest players, that will appear
in the bidding diagram.

\item[namesNS\Q{{N-name}{S-name}}]\\
Defines the real world names for the \northsouth players, that will appear
in the bidding diagram.


\item[newgame]\\
Resets some stored data 

\item[NMF]: \NMF
\item[nmforce\Oarg{*!}]: \nmforce, \nmforce*, \nmforce!, \nmforce*!

\item[none]: \none
\item[None\Oarg{*!}]: \None, \None*, \None!, \None*! 

\item[north]: \north 
\item[North\Oarg{*!}]: \North, \North*, \North!, \North*! 

\item[northhand\Q{[v-offset]{Sp}{He}{Di}{Cl}}]\\
Defines the cards for the
\North*!-player. With the optional parameter |v-offset| one can adapt the
(\emph{vertical}) distance between hand and compass (default \textbf{0pt}).
The 4 mandatory parameters define the cards for the 4 suits. To denote the
rank \suit{T}, one has to use the uppercase letter |T|.

\item[northsouth]: \northsouth 
\item[NorthSouth\Oarg{*!}]: \NorthSouth, \NorthSouth*, \NorthSouth!, \NorthSouth*! 

\item[nt\Oarg{*!}]: \nt, \nt*, \nt!, \nt*! 
\item[NT]: \NT 

\item[onesuitAll\Oarg{*!}\Q{{N}{S}{E}{W}}]\\
Typesets the cards of 1 suit for all
players. The star version centers the output. The token |!| prints a small
box rather than the compass. The 4 mandatory parameters denote the cards
for the \North*!-, the \South*!-, the \East*!- and the \West*!-player.

\item[onesuitEW\Oarg{*!}\Q{{E}{W}}]\\
Same as |onesuitAll|, but only for the \East*!- and the \West*!-player.

\item[onesuitNE\Oarg{*!}\Q{{N}{E}}]\\
Same as |onesuitAll|, but only for the \North*!- and the \East*!-player.

\item[onesuitNS\Oarg{*!}\Q{{N}{S}}]\\
Same as |onesuitAll|, but only for the \North*!- and the \South*!-player.

\item[onesuitNW\Oarg{*!}\Q{{N}{W}}]\\
Same as |onesuitAll|, but only for the \North*!- and the \West*!-player.

\item[otherfont\Q{{font} }]\\
Defines the font for other items.

\item[pass]: \pass 
\item[Pass\Oarg{*!}]: \Pass, \Pass*, \Pass!, \Pass*! 

\item[queen]: \queen
\item[Queen\Oarg{*!}]: \Queen, \Queen*, \Queen!, \Queen*!

\item[redouble]: \redouble 
\item[Redouble\Oarg{*!}]: \Redouble, \Redouble*, \Redouble!, \Redouble*! 

\item[resetfonts]\\
Sets all fonts back to their default value.

\item[rightlower\Q{[h-offset]{line1}{line2}{line3}}]
\item[rightupper\Q{[h-offset]{line1}{line2}{line3}}]\\
Typesets an annotation of 3 lines in the right lower/upper corner of the
card diagram. With the optional parameter one can add some extra horizontal
space between hand and annotation.

\item[setdefaults\Oarg{*}\string{key1=val1,key2=val2,\ldots\string}]\\
With the keys |bidder|, |compass|, |game|, |legend|, |name| or |other| one
can set the default font for the respective items. With the keys
|compline|, |compmid|, |compshow|, |compsize| or |compturn| on can set the
look of the compass. With the keys |bidders|, |bidfirst|, |bidline| or
|bidlong| one can fine-tune the bidding diagram. The keys that can be used
as package options (|colors|, |err| and |warn|) can also be set here.
The star form also calls |\resetfonts| which effectuates any font change
immediately.

\item[SF]: \SF
\item[sforce\Oarg{*!}]: \sforce, \sforce*, \sforce!, \sforce*!

\item[showAll\Oarg{*+}\Q{[pos]}]\\
Typesets a card diagram with 4 (previously
defined, i.e.\ with |\northhand| etc.) hands. The star version centers the
output. The token |+| adds a bidding table to the diagram, that has to be
previously defined, i.e.\ with e.g:\\
|\begin{bidding}-|\ldots|\end{bidding}|. The optional parameter |pos|
(default~\textbf{c}) aligns the diagram.

\DeleteShortVerb{\|}
\item[showEW\Oarg{*+}\Q{[pos]}(E|W)]\\
\MakeShortVerb{\|}
Same as |\showAll|, but for the \East*!- and the \West*!-hand. |\showEW(E)|
prints only the \East*!-hand

\item[showNE\Oarg{*+}\Q{[pos]}]\\
Same as |\showAll|, but for the \North*!- and the \East*!-hand.

\DeleteShortVerb{\|}
\item[showNS\Oarg{*+}\Q{[pos]}(N|S)]\\
\MakeShortVerb{\|}
Same as |\showAll|, but for the \North*!- and the \South*!-hand. |\showNS(S)|
prints only the \South*!-hand
\item[showNW\Oarg{*+}\Q{[pos]}]\\
Same as |\showAll|, but for the \North*!- and the \West*!-hand.

\item[south]: \south
\item[South\Oarg{*!}]: \South, \South*, \South!, \South*!

\item[southhand\Q{[v-offset]{Sp}{He}{Di}{Cl}}]\\
Defines the cards for the
\South*!-player. With the optional parameter |v-offset| one can adapt the
(\emph{vertical}) distance between hand and compass (default \textbf{0pt}).
The 4 mandatory parameters define the cards for the 4 suits. To denote the
rank \suit{T}, one has to use the uppercase letter |T|.

\item[Sp]: \Sp

\item[suit\Q{[suit symbol]{cards}}]\\
Typesets the cards of 1 single suit.
With the optional parameter one can add a suit symbol (e.g.\ \He) in front
of the cards. The mandatory parameter defines the cards for the suit. To
denote the rank \suit{T}, one has to use the letter |T|.

\item[TP]: \TP
\item[tpts\Oarg{*!}]: \tpts, \tpts*, \tpts!, \tpts*!

\item[TSF]: \TSF
\item[tsforce\Oarg{*!}]: \tsforce, \tsforce*, \tsforce!, \tsforce*!

\item[vulner\Q{[text]}]\\
Typeset the user-defined vulnerability. With the optional parameter one can
define the vulnerability.

\item[vulnertext\Q{[text]}]\\
Typeset the defined value for the |\vulner|, e.g.\
\mbox{\vulnertext[\NorthSouth*]}.  With the optional parameter one can
define the |text| to be printed \emph{as is}.

\item[west]: \west 
\item[West\Oarg{*!}]: \West, \West*, \West!, \West*! 

\item[westhand\Q{[h-offset]{Sp}{He}{Di}{Cl}}]\\
Defines the cards for the
\West*!-player. With the optional parameter |h-offset| one can adapt the
(\emph{horizontal}) distance between hand and compass (default
\textbf{0pt}). The 4 mandatory parameters define the cards for the 4 suits.
To denote the rank \suit{T}, one has to use the uppercase letter |T|.

\olditem[\string\begin\string{bidding\string}\Oarg{*!-}\Q{[pos](description)}\ldots\string\end\string{bidding\string}]~\\
Typesets a bidding diagram. The star version centers the output. The
token~|!| forces a short form (\North*!) rather than the long form
(\North*) in the table header. The token~|-| suppresses all output, but the
saved data can be used elsewhere. The optional paramater |pos| (default
\textbf{c}) controls the alignment of the diagram. With the 2nd optional
parameter |description| one can add annotations (see also |\markit| and
|\explainit|) below the diagram. The bids in the bidding can both be
shorthands like |3S| as well as |3\Sp|. The same goes for calls: both |p|
and |\pass| are possible. For an overview of all possible shorthands, refer
to the last page of this document.
\par
The command |\setdefaults| has some keys to fine tune the
look of the bidding diagram. If the real world names of the players are
defined (e.g.\ with |\namesNS|, then they also appear in the table header.

\olditem[\string\begin\string{biddingpair\string}\Oarg{*!-}\Q{[pos](description)}\ldots\string\end\string{biddingpair\string}]~\\
Same as environment |bidding| but with only 2 columns.

\olditem[\string\begin\string{play\string}\Oarg{*}\Q{{lead}[trump]}\ldots\string\end\string{play\string}]~\\
Typesets a diagram with the playing tricks. The star version centers the
output. The mandatory parameter defines the player who had the opening
lead. The optional parameter defines the trump suit, the default is \NT.
This environment produces 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 only to enter the 4 colums that denote the 4 cards
played in each trick. The rest is handled by \OneDown.
%
\end{description}
%
% reset \item
%\fi
\let\item\olditem
%
\newpage
\centerline{\larger\textbf{Shorthands/Specials in bidding diagrams}}
\par\vspace{1\baselineskip}\noindent
%
\begin{minipage}{6cm}
\begin{verbatim}
\begin{bidding}
p & X & R & P \\
\end{bidding}
\end{verbatim}
\end{minipage}
%
\begin{minipage}{7cm}
\begin{bidding}
p & X & R & P \\
\end{bidding}
\end{minipage}
%
\\[1\baselineskip]
%
\begin{minipage}{6cm}
\begin{verbatim}
\setdefaults{bidlong=off}
\begin{bidding}
p & X & R & P \\
{\frame{2H}} & 
{\frame{2\He}} & 
{\textit{R}} & 
{\textit{\redouble}} \\
\end{bidding}
\end{verbatim}
\end{minipage}
%
\begin{minipage}{6cm}
\setdefaults{bidlong=off}
\begin{bidding}
p & X & R & P \\
{\frame{2H}} & {\frame{2\He}} & {\textit{R}} & {\textit{\redouble}} \\
\end{bidding}
\end{minipage}
%
\\[1\baselineskip]
%
\centerline{\larger\textbf{Macros in bidding diagrams}}
\par\vspace{0.3\baselineskip}\noindent
These macros, called in a bidding table\ldots
\par\vspace{0.5\baselineskip}\noindent
%
\begin{verbatim}
\begin{bidding}
1 \Pass     & \Double     & \Redouble     & \Allpass \\
2 \Pass*    & \Double*    & \Redouble*    & \Allpass* \\
3 \Pass!    & \Double!    & \Redouble!    & \Allpass! \\
4 \Pass*!   & \Double*!   & \Redouble*!   & \Allpass*! \\
5 \pass     & \double     & \redouble     & \allpass \\
6 {\Pass*}  & {\Double*}  & {\Redouble*}  & {\Allpass*} \\
7 {\Pass!}  & {\Double!}  & {\Redouble!}  & {\Allpass!} \\
8 {\Pass*!} & {\Double*!} & {\Redouble*!} & {\Allpass*!} \\
9 {\pass}   & {\double}   & {\redouble}   & {\allpass} \\
\end{bidding}
\end{verbatim}
%

\ldots produce this output. Please note that line 2--5 are peculiar.
\par\vspace{0.3\baselineskip}\noindent
\begin{tabular}{lBBBB}
  & {\west}   & {\north}    & {\east}       & {\south} \\
1 & \Pass     & \Double     & \Redouble     & \Allpass \\
2 & \Pass*    & \Double*    & \Redouble*    & \Allpass* \\
3 & \Pass!    & \Double!    & \Redouble!    & \Allpass! \\
4 & \Pass*!   & \Double*!   & \Redouble*!   & \Allpass*! \\
5 & \pass     & \double     & \redouble     & \allpass \\
6 & {\Pass*}  & {\Double*}  & {\Redouble*}  & {\Allpass*} \\
7 & {\Pass!}  & {\Double!}  & {\Redouble!}  & {\Allpass!} \\
8 & {\Pass*!} & {\Double*!} & {\Redouble*!} & {\Allpass*!} \\
9 & {\pass}   & {\double}   & {\redouble}   & {\allpass} \\
\end{tabular}\\

\end{document}
\endinput

