diff options
author | Karl Berry <karl@freefriends.org> | 2006-06-01 22:46:03 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2006-06-01 22:46:03 +0000 |
commit | 89fb5de10a767340ae26188164fae4ae80f99efc (patch) | |
tree | db6cb3083533684dbce6f593e9e8c3a69da24a3a /Master/texmf-dist/tex/latex/texmate | |
parent | 483caddbc7d58da2c9ca51b9cc616c6c6446e889 (diff) |
texmate2
git-svn-id: svn://tug.org/texlive/trunk@1644 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/texmate')
-rw-r--r-- | Master/texmf-dist/tex/latex/texmate/texmate.sty | 891 |
1 files changed, 677 insertions, 214 deletions
diff --git a/Master/texmf-dist/tex/latex/texmate/texmate.sty b/Master/texmf-dist/tex/latex/texmate/texmate.sty index 998a3fd9ff4..ef00a1a86eb 100644 --- a/Master/texmf-dist/tex/latex/texmate/texmate.sty +++ b/Master/texmf-dist/tex/latex/texmate/texmate.sty @@ -6,181 +6,131 @@ %% %% texmate.dtx (with options: `package') %% -%% Copyright 2005 Federico Garcia +%% Copyright 2005-6 Federico Garcia %% \NeedsTeXFormat{LaTeX2e}[1995/12/01] -\ProvidesPackage{texmate}[2005/03/12 v1 Chess typesetting (Federico Garcia)] -\newif\if@filling\@fillingfalse -\DeclareOption{filling}{\@fillingtrue} -\DeclareOption{notfilling}{\@fillingfalse} +\ProvidesPackage{texmate}[2005/06/31 v2 Chess typesetting (Federico Garcia)] +\newcommand*\TeXmate{\TeX mate} +\newif\if@skakon\@skakontrue +\newif\if@skaking +\newif\if@diagnostics\@diagnosticsfalse +\DeclareOption{filling}{\typeout{Option `filling' obsolete.}} +\DeclareOption{notfilling}{\typeout{Option `nofilling' obsolete.}} +\DeclareOption{skakoff}{\@skakonfalse + \typeout{Using TeXmate 2 without skak is dangerous. % + Consider using skak too, or using TeXmate 1 instead.}% + \@skakingfalse + } +\DeclareOption{diagnostics}{\@diagnosticstrue} \DeclareOption*{\typeout{Unknown option (`\CurrentOption')}} -\ExecuteOptions{filling} +\ExecuteOptions{} \ProcessOptions +\RequirePackage{amssymb} +\RequirePackage{chessfss} +\usesymfig +\if@skakon + \RequirePackage{skak}[2005/06/29 v1.4a] + \smallboard + \notationoff + \@skakontrue\@skakingtrue + \newtoks\@tmtoskak +\fi +\def\@chesscodes{\catcode`\ =\active \catcode`\.=\active \catcode`\;=\active + \catcode`\[=\active \catcode`\]=\active + \catcode`\>=\active \catcode`\+=\active + \catcode`\:=\active } +\def\@nochesscodes{\catcode`\ =10 \catcode`\.=12 \catcode`\;=12 + \catcode`\]=12 \catcode`\[=12 + \catcode`\>=12 \catcode`\x=11 \catcode`\+=12 + \catcode`\:=12 } +\def\@semicolon{; } +{\@chesscodes\iffalse +\fi\gdef\@chesschars{\iffalse + \fi\def+{\checksign}\iffalse + \fi\long\def ##1{\ifx ##1\else\iffalse + \fi\if@delimited\else\@@turn\fi\expandafter\@execute\fi##1}\iffalse + \fi\def.{ }\gdef;{ }\global\let\;\@semicolon\iffalse + \fi\def[{\@opencomm{open}}\iffalse + \fi\def\[{\@opencomm{opent}}\iffalse + \fi\def]{ \@closecomm{close} }\iffalse + \fi\def\]{\@closecomm{closet} }\iffalse + \fi\let>\egroup}\iffalse +\fi} +\def\@@openchess{% + \advance\@commlevel-1\relax + \if@skaking + \@tmtoskak{}% + \fi + \csname\@roman{\the\@commlevel}font\endcsname + \@chesscodes + \@chesschars + \@execute} +\def\@@closechess{% + \@nochesscodes + \if@delimited\else\@@turn\fi + \advance\@commlevel1\relax + \normalfont + \@resumingtrue\unskip} +\newcommand*\makebarother{\catcode`\|=12 } +{\catcode`\|=\active +\gdef\makebarchess{\catcode`\|=\active + \let|\@openchess} +\gdef\@openchess{\null + \let|\@closechess + \@@openchess} +\gdef\@closechess{\let|\@openchess + \@@closechess} +} +\AtBeginDocument{\ifnum\catcode`\|=12\relax + \makebarchess + \else + \PackageWarning{TeXmate}{`|' not used for chess + (it seems to have a special meaning for another package). + Use \string\begin{texmate} instead.}% + \fi} +\newenvironment{texmate}{\@@openchess}{\@@closechess} \def\pieceinitials#1{\@initials#1} \def\@initials#1#2#3#4#5#6{% - \def\@Pawn{#1}\def\@Rook{#2}\def\@Knight{#3}% - \def\@Bishop{#4}\def\@Queen{#5}\def\@King{#6}% - \lowercase{\def\@pawn{#1}\def\@rook{#2}\def\@knight{#3}% - \def\@bishop{#4}\def\@queen{#5}\def\@king{#6}}} -\newlength\diagramsize -\newcount\SquareNo -\newcount\@squarecount -\newif\if@blacksq\@blacksqfalse -\def\@togglesq{\if@blacksq\@blacksqfalse\else\@blacksqtrue\fi} -\newcount\@piececode -\def\diagram#1{\font\diagramfont=skak10 at \the\diagramsize - \@squarecount\SquareNo - \bgroup - \setlength\fboxsep{.8pt}% - \fbox{\parbox{\the\SquareNo\diagramsize}{% - \baselineskip\diagramsize\diagramfont\@diagline#1.}}\egroup} -\def\@diagpiece#1{\def\temp{#1}\symbol{% - \ifx\temp\@pawn\if@blacksq'157\else'160\fi\else - \ifx\temp\@rook\if@blacksq'163\else'162\fi\else - \ifx\temp\@knight\if@blacksq'155\else'156\fi\else - \ifx\temp\@bishop\if@blacksq'141\else'142\fi\else - \ifx\temp\@queen\if@blacksq'154\else'161\fi\else - \ifx\temp\@king\if@blacksq'152\else'153\fi\else - \ifx\temp\@Pawn\if@blacksq'117\else'120\fi\else - \ifx\temp\@Rook\if@blacksq'123\else'122\fi\else - \ifx\temp\@Knight\if@blacksq'115\else'116\fi\else - \ifx\temp\@Bishop\if@blacksq'101\else'102\fi\else - \ifx\temp\@Queen\if@blacksq'114\else'121\fi\else - \ifx\temp\@King\if@blacksq'112\else'113\fi\else - \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi}} -\def\@diagline#1{\@tempcnta0 \let\next\@diagline - \ifx#1.\let\next\relax\if@filling\@dospaces{\@squarecount}\fi - \else\ifx#1/\def\next{\if@filling\@dospaces{\@squarecount}\fi - \newline\@togglesq\@squarecount\SquareNo\relax - \@diagline}% - \else\ifcat1#12\@dospaces{#1}% - \else\@diagpiece#1\advance\@squarecount-1 \@togglesq - \fi\fi\fi - \next} -\def\@dospaces#1{\ifnum#1>0 - \if@blacksq\symbol{'132}\else\hphantom{\symbol{'132}}\fi - \@togglesq\@tempcntb#1 \advance\@tempcnta1 \advance\@squarecount-1 - \ifnum\@tempcnta<\@tempcntb\let\@next\@dospaces\else - \let\@next\@gobble\fi - \@next\@tempcntb\fi} -\newcommand{\skakfamily}{\usefont{U}{skak}{m}{n}} -\DeclareTextFontCommand{\textskakbf}{\skakfamily\bfseries} -\DeclareTextFontCommand{\textskak}{\skakfamily} -\newcount\@rk\@rk'122 -\newcount\@kt\@kt'116 -\newcount\@bp\@bp'102 -\newcount\@qn\@qn'121 -\newcount\@kg\@kg'113 -\DeclareRobustCommand\rook{\@piece\@rk } -\DeclareRobustCommand\knight{\@piece\@kt } -\DeclareRobustCommand\bishop{\@piece\@bp } -\DeclareRobustCommand\queen{\@piece\@qn } -\DeclareRobustCommand\king{\@piece\@kg } -\def\@piece#1{\bgroup\catcode`\x=11 \textpiece{\symbol{#1}}\egroup} -\def\@@piece#1{\def\temp{#1}% - \ifx\temp\@Rook\rook\else - \ifx\temp\@Knight\knight\else - \ifx\temp\@Bishop\bishop\else - \ifx\temp\@Queen\queen\else - \ifx\temp\@King\king\else - #1\fi\fi\fi\fi\fi} -\DeclareRobustCommand\takes{\makebox[1.2ex][c]{$\times$}} -{\catcode`\x=13 \gdefx{\takes}} -\def\@chesssymbol#1{\bgroup\catcode`\x=11 - \smash{\textskak{\symbol{#1}}}\egroup } -\DeclareRobustCommand\checksign{\smash{\@piece{'053}}} -\DeclareRobustCommand\mate{\smash{\@piece{'155}}} -\DeclareRobustCommand\wbetter{\raisebox{-.1ex}{\@chesssymbol{'146}}} -\DeclareRobustCommand\bbetter{\raisebox{-.1ex}{\@chesssymbol{'147}}} -\DeclareRobustCommand\wBetter{\raisebox{-.35ex}{\@chesssymbol{'143}}} -\DeclareRobustCommand\bBetter{\@chesssymbol{'145}} -\DeclareRobustCommand\WBetter{{\large\@chesssymbol{'150}}} -\DeclareRobustCommand\BBetter{{\large\@chesssymbol{'151}}} -\DeclareRobustCommand\equal{=} -\DeclareRobustCommand\unclear{\raisebox{-.5ex}{{\Large\@chesssymbol{'153}}}} -\DeclareRobustCommand\compensation{{\large\@chesssymbol{'156}}} -\DeclareRobustCommand\development{{\footnotesize\@chesssymbol{'164}}} -\DeclareRobustCommand\spaceadv{{\footnotesize\@chesssymbol{'171}}} -\DeclareRobustCommand\attack{\raisebox{-.3ex}{{\large\@chesssymbol{'101}}}} -\DeclareRobustCommand\initiative{\raisebox{-.2ex}{{\large\@chesssymbol{'103}}}} -\DeclareRobustCommand\counterplay{{\large\@chesssymbol{'126}}} -\DeclareRobustCommand\zugzwang{{\small\@chesssymbol{'104}}} -\DeclareRobustCommand\withidea{{\footnotesize\@chesssymbol{'105}}} -\DeclareRobustCommand\onlymove{{\footnotesize\@chesssymbol{'106}}} -\DeclareRobustCommand\betteris{{\footnotesize\@chesssymbol{'142}}} -\DeclareRobustCommand\boardfile{\@chesssymbol{'110}} -\DeclareRobustCommand\boarddiagonal{{\small\@chesssymbol{'107}}} -\DeclareRobustCommand\boardcenter{{\small\@chesssymbol{'111}}} -\DeclareRobustCommand\kingside{\@chesssymbol{'117}} -\DeclareRobustCommand\queenside{\@chesssymbol{'115}} -\DeclareRobustCommand\weak{{\small\@chesssymbol{'170}}} -\DeclareRobustCommand\ending{{\footnotesize\@chesssymbol{'114}}} -\DeclareRobustCommand\bishops{\@chesssymbol{'141}} -\DeclareRobustCommand\oppositebishops{\@chesssymbol{'157}} -\DeclareRobustCommand\samebishops{\@chesssymbol{'163}} -\DeclareRobustCommand\unitedpawns{\@chesssymbol{'153}} -\DeclareRobustCommand\separatedpawns{\@chesssymbol{'161}} -\DeclareRobustCommand\doubledpawns{\@chesssymbol{'144}} -\DeclareRobustCommand\passedpawn{\@chesssymbol{'162}} -\DeclareRobustCommand\pawnsno{{\small\@chesssymbol{'123}}} -\DeclareRobustCommand\timetrouble{{\small\@chesssymbol{124}}} -\DeclareRobustCommand\with{{\small\@chesssymbol{'166}}} -\DeclareRobustCommand\without{{\small\@chesssymbol{'167}}} -\DeclareRobustCommand\chessetc{\@chesssymbol{'120}} -\DeclareRobustCommand\chesssee{\@chesssymbol{'154}} -\def\ifont{\bfseries\let\textpiece\textskakbf} -\def\iifont{\normalfont\let\textpiece\textskak} -\def\iiifont{\normalfont} -\def\ivfont{\itshape} -\newcount\@commlevel -\let\iopen\relax\let\iclose\relax -\DeclareRobustCommand\iopent{\par\noindent } -\DeclareRobustCommand\icloset{\par} -\DeclareRobustCommand\iiopen{ [} -\DeclareRobustCommand\iiclose{\leavevmode\unskip]\textbf{;} } -\DeclareRobustCommand\iiiopen{ (} -\DeclareRobustCommand\iiiclose{\leavevmode\unskip) } -\DeclareRobustCommand\ivopen{ (} -\DeclareRobustCommand\ivclose{\leavevmode\unskip) } -\DeclareRobustCommand\iiopent{} -\DeclareRobustCommand\iicloset{} -\DeclareRobustCommand\iiiopent{} -\DeclareRobustCommand\iiicloset{} -\DeclareRobustCommand\ivopent{} -\DeclareRobustCommand\ivcloset{} -\def\makebarother{\catcode`\|=12 } -\def\makebarchess{\catcode`\|=13 } -\makebarchess -\def\@chesscodes{\catcode`\ =\active \catcode`\.=\active - \catcode`\;=\active \catcode`\[=\active \catcode`\]=\active - \catcode`\>=\active \catcode`\+=\active } -\def\@restorecodes{\catcode`\ =10 \catcode`\.=12 - \catcode`\;=12 \catcode`\]=12 \catcode`\[=12 - \catcode`\>=12 \catcode`\x=11 \catcode`\+=12 } + \if@skakon + \newskaklanguage{texmate}{#6#5#2#4#3#1}% + \skaklanguage[texmate]% + \fi + \setfigtextchars #6#5#2#4#3#1% + \gdef\@Pawn{#1}\gdef\@Rook{#2}\gdef\@Knight{#3}% + \gdef\@Bishop{#4}\gdef\@Queen{#5}\gdef\@King{#6}% + \lowercase{\gdef\@pawn{#1}\gdef\@rook{#2}\gdef\@knight{#3}% + \gdef\@bishop{#4}\gdef\@queen{#5}\gdef\@king{#6}}} +\pieceinitials{PRNBQK} +\def\@Castle{O} \newif\if@white \newif\if@resuming \newif\if@delimited -\def\@turn{\@delimitedtrue\if@white\@whitefalse\else\@whitetrue\fi} +\newcount\move \long\def\@execute#1{\let\next\relax \ifcat1\noexpand#1% \ifnum0=#1 \if@white \if@resuming - \def\next{\beforeno\the\move\afterno - \catcode`\x=\active\@@piece}% + \def\next{% + \beforeno\the\move\afterno + \expandafter\@castle\@gobble + }% \else - \def\next{\afterb\beforeno\the\move\afterno - \catcode`\x=\active\@@piece}% + \def\next{% + \afterb\beforeno\the\move\afterno + \expandafter\@castle\@gobble}% \fi \else \if@resuming - \def\next{\beforeb - \advance\move1 - \catcode`\x=\active\@@piece}% + \def\next{% + \beforeb + \advance\move1\relax + \expandafter\@castle\@gobble}% \else - \def\next{\afterw - \advance\move1 - \catcode`\x=\active\@@piece}% + \def\next{% + \afterw + \advance\move1\relax + \expandafter\@castle\@gobble}% \fi \fi \@delimitedfalse @@ -193,90 +143,603 @@ \if@white \if@resuming \def\next{\beforeno\the\move\afterno - \catcode`\x=\active\@@piece}% + \catcode`\x=\active + \@@piece}% \else \def\next{\afterb\beforeno\the\move\afterno - \catcode`\x=\active\@@piece}% + \catcode`\x=\active + \@@piece}% \fi \else \if@resuming - \def\next{\beforeb + \def\next{% + \beforeb \advance\move1 - \catcode`\x=\active\@@piece}% + \catcode`\x=\active + \@@piece}% \else - \def\next{\afterw + \def\next{% + \afterw \advance\move1 - \catcode`\x=\active\@@piece}% + \catcode`\x=\active + \@@piece}% \fi \fi \@delimitedfalse \@resumingfalse \fi\fi \next#1} -\newcount\move -\DeclareRobustCommand\afterno{.~} -\DeclareRobustCommand\afterw{ } -\DeclareRobustCommand\afterb{; } -\DeclareRobustCommand\beforeb{\the\move.~\dots\ } -\DeclareRobustCommand\beforeno{} -\def\@openchess{\let|\@closechess - \advance\@commlevel-1\relax - \csname\@roman{\the\@commlevel}font\endcsname - \@chesscodes - \@execute} -\let|\@openchess -\def\@closechess{\let|\@openchess - \if@delimited\else\@turn\fi - \@restorecodes\normalfont - \@resumingtrue\advance\@commlevel1\relax} +\def\@@piece#1{% + \ifcat\noexpand~\noexpand#1% + \def\next{\@#1}% + \else + \ifcat\relax\noexpand#1% + \def\next{\@#1}% + \else + \def\next{\@@piece}% + \if@skaking + \ifcat1\noexpand#1% + \@tmtoskak\expandafter{\the\@tmtoskak #1}% + \else\ifcat a#1% + \@tmtoskak\expandafter{\the\@tmtoskak #1}% + \fi\fi + \fi + \def\temp{#1}% + \ifx\temp\@Rook\textsymrook\else + \ifx\temp\@Knight\textsymknight\else + \ifx\temp\@Bishop\textsymbishop\else + \ifx\temp\@Queen\textsymqueen\else + \ifx\temp\@King\textsymking\else + \ifx\temp\@Castle\let\next\@castle\else + \def\next{#1\@@piece}% + \fi\fi\fi\fi\fi\fi + \fi\fi + \next} +\def\@castleadd{--\@castlechar} +\def\CastleO{\def\@castlechar{O}} +\def\Castle#1{\def\@castlechar{0}} +\long\def\@castle#1#2#3{% + \ifx-#3% + \mbox{\@castlechar\@castleadd\@castleadd}% + \if@skaking\@tmtoskak{O-O-O}\fi + \let\next\@gobble + \else + \mbox{\@castlechar\@castleadd}% + \if@skaking\@tmtoskak{O-O}\fi + \def\next{#3}% + \fi + \next + } +\Castle0 +\def\takes{\makebox[1.2ex][c]{$\times$}} +\if@skakon + \def\@takes{\catcode`\x=11\relax\@tmtoskak\expandafter + {\the\@tmtoskak x}\takes\@@piece} +\else + \def\@takes{\catcode`\x=11\relax\takes} +\fi +{\catcode`\x=\active \catcode`\:=\active \gdefx{\@takes}\gdef:{\@takes}} +\newcount\@commlevel +\let\tm@aftermove\relax \def\@opencomm#1{% \@resumingtrue - \catcode`\x=11 + \catcode`\x=11\relax + \if@skaking + \expandafter\storegame\expandafter{\@roman{\the\@commlevel}comm-game}% + \if@diagnostics\message{Stored position for comment at level + \the\@commlevel\ after \tm@tomainline.}\fi + \else{} \fi \bgroup - \if@delimited - \@turn - \fi - \@delimitedtrue + \renewcommand\@diagramtop{\analysistop}% + \renewcommand\@diagrambottom{}% + \if@delimited\else\@@turn\fi + \@turn \if@white\else\advance\move-1\fi - \advance\@commlevel1\relax + \advance\@commlevel1 + \if@skaking + \expandafter\restoregame\expandafter{\@roman{\the\@commlevel}comm-game}% + \if@diagnostics\message{Restored position for comment at level + \the\@commlevel}\fi + \else{} \fi \csname\@roman{\the\@commlevel}font\endcsname \csname\@roman{\the\@commlevel}#1\endcsname + \expandafter\let\expandafter\tm@var\csname tm@var#1\endcsname + \expandafter\let\expandafter\tm@vars\csname tm@var#1s\endcsname + \expandafter\let\expandafter\@preparevar\csname @preparevar#1\endcsname + \expandafter\let\expandafter\@finvar\csname @finvar#1\endcsname + \def\result##1{ ##1}% \@execute} \def\@closecomm#1{\csname\@roman{\the\@commlevel}#1\endcsname - \egroup} -\def\dummy{\@turn - \if@white\advance\move1\relax\fi\@execute} -\def\ddummy{\advance\move1\relax\@execute} -\def\black{\@whitefalse\@execute} -\def\white{\@whitetrue\@execute} + \egroup + \if@skaking + \expandafter\restoregame\expandafter{\@roman{\the\@commlevel}comm-game}% + \if@diagnostics\message{Restored position + after comment at level \the\@commlevel.}\fi + \else{} \fi} \def\steplevel{\advance\@commlevel1\relax\csname \@roman{\the\@commlevel}font\endcsname} -\def\backlevel{\advance\@commlevel-1\relax\csname - \@roman{\the\@commlevel}font\endcsname} -\def\newgame{\@whitetrue\@resumingtrue\@commlevel2 \move1 \@delimitedtrue} -\long\def\threat#1{\bgroup\ifcase\@commlevel\or +\def\backlevel{\advance\@commlevel-1\relax + \ifnum\@commlevel<1\relax\@commlevel1\relax\fi + \csname\@roman{\the\@commlevel}font\endcsname} +\def\@turn{\@delimitedtrue\if@white\@whitefalse\else\@whitetrue\fi} +\def\@@turn{% + \tm@aftermove + \global\let\tm@aftermove\relax + \if@skaking + \@tempcnta\@commlevel\advance\@tempcnta1\relax + \expandafter\storegame\expandafter{\@roman{\the\@tempcnta}comm-game}% + \@tempcnta\move\advance\@tempcnta-1\relax + \edef\tm@tomainline{\noexpand{\if@white\the\move + \else\the\@tempcnta..\fi.\the\@tmtoskak}}% + \if@diagnostics\message{Stored position at level + \the\@commlevel+1, before \tm@tomainline}\fi + \expandafter\hidemoves\tm@tomainline + \@tmtoskak{}% + \fi + \if@delimited\else\@turn\fi} +\let\ifont\bfseries +\let\iifont\normalfont +\let\iiifont\normalfont +\let\ivfont\itshape +\let\varfont\bfseries +\newcommand*\iopen{}\newcommand*\iclose{} +\newcommand\iiopen{[}\newcommand\iiclose{\leavevmode\unskip]} +\newcommand\iiiopen{(}\newcommand\iiiclose{\leavevmode\unskip)} +\newcommand\ivopen{(}\newcommand\ivclose{\leavevmode\unskip)} +\newcommand*\iiopent{}\newcommand*\iicloset{} +\newcommand*\iiiopent{}\newcommand*\iiicloset{} +\newcommand*\ivopent{}\newcommand*\ivcloset{} +\def\afterno{.~} +\def\afterw{\ } +\def\afterb{\ } +\def\beforeb{\the\move\dots} +\def\beforeno{} +\long\def\dummy{\PackageWarning{TeXmate}{Ignoring moves for + skak after \string\dummy}% + \@skakingfalse + \@turn + \if@white\advance\move1\relax\fi} +\long\def\ddummy{\PackageWarning{TeXmate}{Ignoring moves for + skak after \string\ddummy}% + \@skakingfalse + \advance\move1\relax} +\def\black{\if@skaking + \PackageWarning{TeXmate}{Ignoring moves for skak. + \string\black command is now almost obsolete}% + \@skakingfalse + \fi + \@whitefalse\@execute} +\def\white{\if@skaking + \PackageWarning{TeXmate}{Ignoring moves for skak. + \string\white command is now almost obsolete}% + \@skakingfalse + \fi + \@whitetrue\@execute} +\def\ahead{% + \if@skaking + \expandafter\hidemoves\tm@tomainline + \fi + \@turn + \if@white\advance\move1\relax\fi + \@execute} +\long\def\threat#1{\bgroup\@skakingfalse\ifcase\@commlevel\or \iifont\or\iiifont\or\ivfont\or\ivfont\fi\ - \@restorecodes\catcode`\>\active\withidea} -\def\@chessperiod{. } -\def\@chesssemicolon{; } -{\@chesscodes\iffalse -\fi\global\let\.\@chessperiod\iffalse -\fi\global\let\;\@chesssemicolon\iffalse -\fi\gdef+{\checksign}\iffalse -\fi\gdef\#{\mate}\iffalse -\fi\long\gdef #1{\ifx #1\else\iffalse - \fi\if@delimited\else\@turn\fi\expandafter\@execute\fi#1}\iffalse -\fi\gdef.#1{ }\gdef;{ }\iffalse -\fi\global\let>\egroup\iffalse -\fi\gdef[{\@opencomm{open}}\iffalse -\fi\gdef\[{\@opencomm{opent}}\iffalse -\fi\gdef]{\@closecomm{close} }\iffalse -\fi\gdef\]{\@closecomm{closet} }} -\setlength\diagramsize{18pt} -\SquareNo8 -\pieceinitials{PRNBQK} -\let\textpiece\textskak + \catcode`\>\active\withidea\@@piece} +\long\def\Threat#1{\bgroup + \@skakingfalse + \@resumingtrue + \ifcase\@commlevel\or + \iifont\or\iiifont\or\ivfont\or\ivfont\fi + \catcode`\>\active + \if@delimited\@turn\fi + \ddummy\@execute} +\newcommand*\var{\relax} +\newenvironment{variations}{% + \renewcommand\var{\@ifstar{\tm@vars}{\tm@var}}% + \if@skaking + \null\expandafter\storegame\expandafter + {\@roman{\the\@commlevel}comm-var}\leavevmode\unskip + \if@diagnostics + \message{Stored position for variations at level \the\@commlevel.}% + \fi + \fi + \@preparevar\ignorespaces}% + {\@finvar} +\newenvironment{variations*}{% + \renewcommand\var{\tm@vars}% + \if@skaking + \null\expandafter\storegame\expandafter + {\@roman{\the\@commlevel}comm-var}\leavevmode\unskip + \if@diagnostics + \message{Stored position for variations at level \the\@commlevel.}% + \fi + \fi + \@preparevaropen\ignorespaces} + {\@finvaropen} +\def\tm@varopen{\@semicolon\egroup + \if@skaking + \null\expandafter\restoregame\expandafter + {\@roman{\the\@commlevel}comm-var}\leavevmode\unskip + \if@diagnostics + \message{Restored position for variation at level \the\@commlevel.}% + \fi + \fi + \bgroup\varfont\def\tm@aftermove{\backlevel\steplevel}% + \@execute} +\def\tm@varopens{\egroup + \if@skaking + \null\expandafter\restoregame\expandafter + {\@roman{\the\@commlevel}comm-var}\leavevmode\unskip + \if@diagnostics + \message{Restored position for variation at level \the\@commlevel.}% + \fi + \fi + \bgroup\def\tm@aftermove{\backlevel\steplevel}% + \@execute} +\def\tm@varopent{\egroup + \item + \bgroup + \if@skaking + \expandafter\restoregame\expandafter{\@roman{\the\@commlevel}comm-var}% + \if@diagnostics\message{Restored position for variation at level + \the\@commlevel.}\fi + \fi + \@execute} +\let\tm@varopents\tm@varopens +\let\tm@var\tm@varopen +\let\tm@vars\tm@varopens +\def\@preparevaropen{\bgroup\let\@semicolon\relax} +\let\@preparevar\@preparevaropen +\let\@finvaropen\egroup +\let\@finvar\@finvaropen +\newcommand\VariationsEnvironment[2]{% + \def\@preparevaropent{#1\bgroup}\def\@finvaropent{\egroup#2}} +\VariationsEnvironment{\begin{itemize}}{\end{itemize}} +\newif\if@turnright +\newif\if@movebottom +\newif\if@turnleft +\newif\if@numbertop +\newif\if@defaultturnright +\newif\if@defaultmovebottom +\newif\if@defaultnumbertop +\newif\if@defaultturnleft +\newcommand*\TheDiagram{\textit{\small\bfseries\arabic{diagram}}} +\newcommand*\diagramnames{\renewcommand*\diagramtop{\textbf{\bname}}% + \renewcommand*\diagrambottom{\@name}% + \@restorediagramdefaults} +\newcommand*\topdiagramnames{\renewcommand*\diagramtop{\textbf{\wname--\bname}}% + \renewcommand*\diagrambottom{}% + \@restorediagramdefaults} +\newcommand*\bottomdiagramnames{\renewcommand*\diagramtop{}% + \renewcommand*\diagrambottom{\textbf{\wname--\bname}}% + \@restorediagramdefaults} +\newcommand*\nodiagramnames{% + \global\let\@diagramtop\relax + \global\let\@diagrambottom\relax} +\newcommand*\whiteturnmarker{\raisebox{.75\expandafter + \ht\csname chessdiag\@roman\@tempcnta\endcsname}{\textsl{W}}\ } +\newcommand*\blackturnmarker{\raisebox{.75\expandafter + \ht\csname chessdiag\@roman\@tempcnta\endcsname}{\textsl{B}}\ } +\newcommand*\diagramnumber{\@numbertoptrue} +\newcommand*\nodiagramnumber{\@numbertopfalse} +\newcommand*\leftdiagramturn{\@turnlefttrue\@turnrightfalse} +\newcommand*\rightdiagramturn{\@turnrighttrue\@turnleffalse} +\newcommand*\nodiagramturn{\@turnleftfalse\@turnrightfalse} +\newcommand*\diagrammove{\@movebottomtrue} +\newcommand*\nodiagrammove{\@movebottomfalse} +\newcommand*\nextdiagramtop[1]{\renewcommand*\@diagramtop{#1}} +\newcommand*\nextdiagrambottom[1]{\renewcommand*\@diagrambottom{#1}} +\newcommand\@restorediagramdefaults{% + \global\let\@diagramtop\diagramtop + \global\let\@diagrambottom\diagrambottom + \global\let\if@turnright\if@defaultturnright + \global\let\if@movebottom\if@defaultmovebottom + \global\let\if@numbertop\if@defaultnumbertop + \global\let\if@turnleft\if@defaultturnleft} +\@turnleftfalse +\@movebottomtrue +\@turnrightfalse +\@defaultmovebottomtrue +\@defaultturnrightfalse +\@defaultturnleftfalse +\@defaultnumbertopfalse +\@restorediagramdefaults +\let\makediagramsfont\small +\newcommand*\analysistop{Analysis} +\newcommand*\diagramtop{\textbf{\bname}} +\newcommand*\diagrambottom{\textbf{\wname}} +\newcommand*\diagramsign{~\mdseries(\textit{D})} +\let\@diagramtop\diagramtop +\let\@diagrambottom\diagrambottom +\newcount\@diagramsbuilt +\newcommand*\DiagramCache[1]{% + \@tempcnta#1 + \@whilenum\@tempcnta>0\do{% + \expandafter\newbox\csname chessdiag\@roman\@tempcnta\endcsname + \expandafter\newbox\csname chessdiag\@roman\@tempcnta top\endcsname + \expandafter\newbox\csname chessdiag\@roman\@tempcnta bottom\endcsname + \expandafter\newbox\csname chessdiag\@roman\@tempcnta move\endcsname + \@namedef{chessdiag\@roman\@tempcnta turn}{}% + \advance\@tempcnta-1\relax}% + } +\DiagramCache3 +\newcounter{diagram} +\newcommand*\makediagrams[1][\@diagramsbuilt]{% + \noindent\null\hfill + {\makediagramsfont + \@tempcnta0 + \@whilenum\@tempcnta<#1\do{% + \advance\@tempcnta1\relax + \refstepcounter{diagram}% + \quad\shortstack{% + \if@numbertop\TheDiagram\\\fi + \ifnum\expandafter\wd\csname + chessdiag\expandafter\@roman\@tempcnta top\endcsname>0\relax + \makebox[\expandafter\wd\csname + chessdiag\expandafter\@roman\@tempcnta\endcsname][c]{% + \expandafter\usebox\csname + chessdiag\expandafter\@roman\@tempcnta top\endcsname}% + \\ + \fi + \if@turnleft + \makebox[0pt][r]{\csname + chessdiag\@roman\@tempcnta turn\endcsname}% + \fi + \expandafter\usebox\csname + chessdiag\expandafter\@roman\@tempcnta\endcsname + \if@turnright + \makebox[0pt][l]{\csname + chessdiag\@roman\@tempcnta turn\endcsname}% + \fi + \\ + \expandafter\usebox + \csname chessdiag\expandafter\@roman\@tempcnta bottom\endcsname + \if@movebottom + \ifnum\expandafter\wd\csname + chessdiag\expandafter\@roman\@tempcnta move\endcsname>0 + \ifnum\expandafter\wd\csname + chessdiag\expandafter\@roman\@tempcnta bottom\endcsname>0 + \\ + \fi\expandafter\usebox + \csname chessdiag\expandafter\@roman\@tempcnta move\endcsname + \fi\fi}% + \hfill\quad}}% + \@killdiagrams{#1}% + } +\newcommand*\@killdiagrams[1]{% + \global\advance\@diagramsbuilt-#1\relax + \ifnum\@diagramsbuilt>0\relax + \@tempcnta0\relax + \@tempcntb#1\relax + \@whilenum\@tempcnta<\@diagramsbuilt\do{% + \advance\@tempcnta1\relax + \advance\@tempcntb1\relax + \expandafter\global\expandafter\sbox + \csname chessdiag\expandafter\@roman\@tempcnta\endcsname{% + \expandafter\usebox\csname + chessdiag\@roman\@tempcntb\endcsname}% + \expandafter\global\expandafter\sbox + \csname chessdiag\expandafter\@roman\@tempcnta top\endcsname{% + \expandafter\usebox\csname + chessdiag\@roman\@tempcntb top\endcsname}% + \expandafter\global\expandafter\sbox + \csname chessdiag\expandafter\@roman\@tempcnta bottom\endcsname{% + \expandafter\usebox\csname + chessdiag\@roman\@tempcntb bottom\endcsname}% + \expandafter\global\expandafter\sbox + \csname chessdiag\expandafter\@roman\@tempcnta move\endcsname{% + \expandafter\usebox\csname + chessdiag\@roman\@tempcntb move\endcsname}% + }% + \fi + } +\newcommand*\drawdiagram[2]{% + \global\advance\@diagramsbuilt1\relax + \expandafter\global\expandafter + \sbox\csname chessdiag\@roman\the\@diagramsbuilt\endcsname{\showboard}% + \expandafter\global\expandafter + \sbox\csname chessdiag\@roman\the\@diagramsbuilt + top\endcsname{\makediagramsfont#1}% + \expandafter\global\expandafter + \sbox\csname chessdiag\@roman\the\@diagramsbuilt + bottom\endcsname{\makediagramsfont#2}% + \expandafter\global\expandafter + \sbox\csname chessdiag\@roman\the\@diagramsbuilt + move\endcsname{}% + \if@white + \expandafter\let\csname chessdiag\@roman\@diagramsbuilt + turn\endcsname\whiteturnmarker + \else + \expandafter\let\csname chessdiag\@roman\@diagramsbuilt + turn\endcsname\blackturnmarker + \fi + } +\newcommand*\@toD[1]{\if@delimited\else\@@turn\fi + \global\advance\@diagramsbuilt1\relax + \expandafter\global\expandafter + \sbox\csname chessdiag\expandafter + \@roman\@diagramsbuilt\endcsname{\showboard}% + \expandafter\global\expandafter + \sbox\csname chessdiag\expandafter\@roman\@diagramsbuilt + move\endcsname{% + \mdseries\makediagramsfont\strut\@skakingfalse + \@turn + \if@white + \the\move\afterno + \else + \advance\move-1\relax + \beforeb + \fi + \@@piece#1\relax}% + \expandafter\global\expandafter + \sbox\csname chessdiag\expandafter\@roman\@diagramsbuilt + top\endcsname{\makediagramsfont\@diagramtop}% + \expandafter\global\expandafter + \sbox\csname chessdiag\expandafter\@roman\@diagramsbuilt + bottom\endcsname{\makediagramsfont\@diagrambottom}% + \if@white + \expandafter\let\csname ifwfordiag\expandafter + \@roman\@diagramsbuilt\endcsname\whiteturnmarker + \else + \expandafter\let\csname ifwfordiag\expandafter + \@roman\@diagramsbuilt\endcsname\blackturnmarker + \fi + \@restorediagramdefaults + } +\newcount\@squarecount +\newif\if@blacksq +\newcommand\diagram[2][w 1]{% + \position[#1]{#2}% + \showdiagram} +\newcommand*\fenposition[1]{\@fenposition#1.} +\if@skakon + \newcommand*\toD{\if@delimited\else\@@turn\fi\@ifstar{\@toD}{\diagramsign\@toD}} + \newcommand\position[2][w 1]{% + \@squarecount8\relax + \def\tm@tofen{}% + \@convertdiagram#2.% + \@completefen#1.% + \expandafter\fenboard\tm@tofen% + } + \def\@convertdiagram#1{% + \let\next\@convertdiagram + \ifx#1. + \let\next\relax + \ifnum\@squarecount>0 \edef\tm@tofen{\tm@tofen\the\@squarecount}\fi + \else + \ifx#1/% + \edef\tm@tofen{\tm@tofen\ifnum\@squarecount>0 \the\@squarecount\fi/}% + \@squarecount8\relax + \else + \ifcat1#1% + \edef\tm@tofen{\tm@tofen#1}% + \advance\@squarecount-#1% + \else + \edef\tm@tofen{\tm@tofen#1}% + \advance\@squarecount-1\relax + \fi + \fi\fi + \next} + \def\@completefen#1 #2.{% + \edef\tm@tofen{{\tm@tofen\space #1 KQkq - 0 #2}}% + \move#2\relax + \ifx#1w\@whitetrue\else\@whitefalse\fi} + \def\@fenposition#1 #2 #3 #4 #5 #6.{% + \@squarecount8\relax + \def\tm@tofen{}% + \@convertdiagram#1.% + \edef\tm@tofen{{\tm@tofen\space #2 #3 #4 #5 #6}}% + \expandafter\fenboard\tm@tofen + \move#6\relax + \ifx#2w\@whitetrue\else\@whitefalse\fi + } +\else + \newcommand*\toD{\let\toD\relax + \PackageError{TeXmate}{\string\toD\space requires skak. All occurrences ignored}{% + Go on, diagrams will not be automatically generated.}}% + \let\showboard\relax + \newcommand\position[2][w 1]{% + \@blacksqfalse + \@squarecount8\relax + \bgroup + \nointerlineskip + \boardfont + \noindent + \setlength\fboxsep{.6pt}% + \expandafter\fbox{\parbox{8\len@cfss@squarewidth}{\@diagline#2.}}\egroup} + \def\@diagpiece#1{\def\temp{#1}% + \ifx\temp\@pawn\csname BlackPawnOn\if@blacksq Black\else White\fi\endcsname\else + \ifx\temp\@rook\csname BlackRookOn\if@blacksq Black\else White\fi\endcsname\else + \ifx\temp\@knight\csname BlackKnightOn\if@blacksq Black\else White\fi\endcsname\else + \ifx\temp\@bishop\csname BlackBishopOn\if@blacksq Black\else White\fi\endcsname\else + \ifx\temp\@queen\csname BlackQueenOn\if@blacksq Black\else White\fi\endcsname\else + \ifx\temp\@king\csname BlackKingOn\if@blacksq Black\else White\fi\endcsname\else + \ifx\temp\@Pawn\csname WhitePawnOn\if@blacksq Black\else White\fi\endcsname\else + \ifx\temp\@Rook\csname WhiteRookOn\if@blacksq Black\else White\fi\endcsname\else + \ifx\temp\@Knight\csname WhiteKnightOn\if@blacksq Black\else White\fi\endcsname\else + \ifx\temp\@Bishop\csname WhiteBishopOn\if@blacksq Black\else White\fi\endcsname\else + \ifx\temp\@Queen\csname WhiteQueenOn\if@blacksq Black\else White\fi\endcsname\else + \ifx\temp\@King\csname WhiteKingOn\if@blacksq Black\else White\fi\endcsname\else + \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi + } + \def\@diagline#1{\@tempcnta0\relax\let\next\@diagline + \ifx#1.\let\next\relax\@dospaces{\@squarecount}% + \else\ifx#1/\def\next{\@dospaces{\@squarecount}% + \newline\@togglesq\@squarecount8\relax + \@diagline}% + \else\ifcat1#1\@dospaces{#1}% + \else\@diagpiece#1\advance\@squarecount-1\relax\@togglesq + \fi\fi\fi + \next} + \def\@dospaces#1{\null\ifnum#1>0\relax + \csname\if@blacksq Black\else White\fi EmptySquare\endcsname + \@togglesq\@tempcntb#1\relax\advance\@tempcnta1\relax\advance\@squarecount-1\relax + \ifnum\@tempcnta<\@tempcntb\let\@next\@dospaces\else + \let\@next\@gobble\fi + \@next\@tempcntb\fi} + \def\@togglesq{\if@blacksq\@blacksqfalse\else\@blacksqtrue\fi} + \def\@fenposition#1 #2 #3 #4 #5 #6.{% + \position[#2 #6]{#1}} +\fi +\def\wname{} +\def\bname{} +\let\@welo\relax +\let\@belo\relax +\let\@tourn\relax +\let\@opening\relax +\let\@eco\relax +\newcommand\whitename[1]{\def\wname{#1}} +\newcommand\blackname[1]{\def\bname{#1}} +\newcommand*\whiteelo[1]{\def\@welo{(#1)}} +\newcommand*\blackelo[1]{\def\@belo{(#1)}} +\newcommand*\chessevent[1]{\def\@tourn{#1}} +\newcommand*\chessopening[1]{\def\@opening{#1}} +\newcommand*\ECO[1]{\def\@eco{\ -- \textbf{#1}}} +\newcommand*\makegametitle{\bigskip\newgame + \noindent\hrule\nopagebreak\smallskip + \noindent\strut$\Box$\quad\textbf{\wname}\ \@welo\hfill\@tourn\nopagebreak\\ + \noindent\strut$\blacksquare$\quad\textbf{\bname}\ \@belo\hfill\@opening\@eco + \noindent\hrule\nopagebreak\medskip\nopagebreak + } +\newcommand*\result[1]{{\unskip\nobreak\hfil\penalty50 + \qquad\null\nobreak\hfill\textbf{#1}% + \parfillskip0pt \finalhyphendemerits0 \par}} +\newcommand\whitewins{\result{1\,:\,0}} +\newcommand\blackwins{\result{0\,:\,1}} +\newcommand\drawn{\result{1/2\,:\,1/2}} +\newcommand\resigns{\if@delimited\else\@@turn\fi + \if@white\blackwins\else\whitewins\fi} +\if@skakon + \let\skak@newgame\newgame +\else + \let\skak@newgame\relax +\fi +\def\newgame{\@whitetrue\@resumingtrue\@commlevel2\move1\@delimitedtrue + \skak@newgame} \newgame +\def\SkakOn{\global\@skakingtrue} +\def\SkakOff{\global\@skakingfalse} +\setboardfontsize{12pt} +\DeclareRobustCommand\BlackRookOnWhite{\cfss@boardsymbol{\cfss@BlackRookOnWhite}} +\let\checksign\checksymbol +\let\wBetter\wupperhand +\let\bBetter\bupperhand +\let\WBetter\wdecisive +\let\BBetter\bdecisive +\let\development\devadvantage +\let\spaceadv\moreroom +\let\attack\withattack +\let\initiative\withinit +\let\boardfile\file +\let\boarddiagonal\diagonal +\let\boardcenter\centre +\let\bishops\bishoppair +\let\oppositebishops\opposbishops +\let\separatedpawns\seppawns +\let\doubledpawns\doublepawns +\let\pawnsno\morepawns +\let\timetrouble\timelimit +\let\chessetc\etc \endinput %% %% End of file `texmate.sty'. |