diff options
author | Karl Berry <karl@freefriends.org> | 2014-04-20 22:04:40 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2014-04-20 22:04:40 +0000 |
commit | d5e93667cefc1e7a311d7352143d095120b492dc (patch) | |
tree | 0102610e09534c7aec2b7e32fd74b382cc31a495 /Master/texmf-dist/tex/latex/xskak/xskak.sty | |
parent | 33a4d5f43d0935e7074701ce4937755e9badac4b (diff) |
xskak (20apr14)
git-svn-id: svn://tug.org/texlive/trunk@33559 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/xskak/xskak.sty')
-rw-r--r-- | Master/texmf-dist/tex/latex/xskak/xskak.sty | 75 |
1 files changed, 55 insertions, 20 deletions
diff --git a/Master/texmf-dist/tex/latex/xskak/xskak.sty b/Master/texmf-dist/tex/latex/xskak/xskak.sty index cedd6715609..a6dade3461a 100644 --- a/Master/texmf-dist/tex/latex/xskak/xskak.sty +++ b/Master/texmf-dist/tex/latex/xskak/xskak.sty @@ -6,8 +6,8 @@ %% %% xskak-src.dtx (with options: `xskak') %% -%% xskak: an extension to the package skak for chess typesetting -%% Copyright 2007 Ulrike Fischer (skak@nililand.de) +%% xskak: a package to parse and print chess games +%% Copyright 2006-2014 Ulrike Fischer (chess@nililand.de) %% ------------------------------------------- %% %% This file can be redistributed and/or modified under the terms of @@ -17,9 +17,8 @@ %% %% For error reports see documentation. \NeedsTeXFormat{LaTeX2e} -\def\@rcs@ $#1Date: #2-#3-#4 #5$$#6Version: #7$ { - \ProvidesPackage{xskak}[#2/#3/#4 version #7 extended Chess typesetting and parsing]} -\@rcs@ $Date: 2008-10-20 19:58 +0200 $$Version: v1.2 $ +\ProvidesPackage{xskak}[2014/04/19 version v1.3 extended chess typesetting and parsing] +%%$Date: 2014/04/19 13:39:37 $$Version: 7992681de4b7 $ \newif\ifxskakpdfmatch @@ -79,7 +78,9 @@ nextmovenr,% nextmoveid,% diagramlist,% - gameid} + gameid,% + parentid%NEW records game id of parent if the game is a variation, the last move of the parent=initmoveid + } \newcommand\xskak@list@movetypes{% movenr,% @@ -113,7 +114,9 @@ nag,% san,% lan,% - opennr%% + opennr,% + vars,% NEW, records game id of child variations + varnum% NEW, records number of child variations } %% setting pgn infos @@ -162,6 +165,7 @@ \newboolean{xskakboolpromotion} \newboolean{xskakboolcomment} \newboolean{xskakboolnag} +\newboolean{xskakboolvar} %%%%%%%%%%%%%%% %%%%%%%%%%%%%%% @@ -267,7 +271,11 @@ \expandafter\xdef \csname Xskak\xskak@val@gameid nextmovenr\endcsname{\the\c@move}% \expandafter\xdef - \csname Xskak\xskak@val@gameid nextmoveid\endcsname{\the\c@move\WhiteToMove{w}{b}}} + \csname Xskak\xskak@val@gameid nextmoveid\endcsname{\the\c@move\WhiteToMove{w}{b}}% + \expandafter\xdef\csname %new 1.6. Initialization of nag + Xskak.\xskak@val@gameid.% + \csname Xskak\xskak@val@gameid lastmovenr\endcsname.% + \csname Xskak\xskak@val@gameid lastplayer\endcsname.nag\endcsname{}} %% continuing a game \newcommand\resumechessgame[1][]{% @@ -525,6 +533,9 @@ %%% move related informations %%%% <type> <value> +%%%% vars list of game id of variations. Is set to empty by \xskak@do@dothemove. Can be +%%%% change by variation games to notify the "parent" about its "child" +%%%% varnum record the number of variations of the move. Set to 0 by \xskak@do@dothemove. %%%% pgnpiece K,Q,R,B or N (independent from language). Is empty for Pawn and Castling moves %%%% piece K,Q,R,B,N or P or k,q,r,b,n or p (for black). Is empty for Castling %%%% piecechar K,Q,R,B,N or p. Is empty for Castling @@ -560,7 +571,7 @@ %%%% \castlingchar\castlinghyphen\castlingchar %%%% lan long algebraic notation of the move. %%%% opennr The number representation for an open move e.g. 2... -%%% Game related informations. Don't use @ or "." to simply use by the user +%%% Game related informations. Don't use @ or "." to simplify use by the user %%%% gameid stores the gameid (for easier retrieving) %%%% initfen The fen before the first move. Set by \newchessgame %%%% initplayer w or b, The color of the next (first) player. @@ -591,6 +602,14 @@ \setkeys[UFCB]{locfill}{setfen=\temp@board}% %\expandafter\show\csname board@val@f4r4@piecechar\endcsname %===========% + %% vars + varnum + \expandafter\xdef + \csname Xskak.\xskak@val@gameid.\the\c@move.\WhiteToMove{w}{b}.vars\endcsname{}% + %\expandafter\show\csname Xskak.\xskak@val@gameid.\the\c@move.\WhiteToMove{w}{b}.vars\endcsname + \expandafter\xdef + \csname Xskak.\xskak@val@gameid.\the\c@move.\WhiteToMove{w}{b}.varnum\endcsname{0}% + %\expandafter\show\csname Xskak.\xskak@val@gameid.\the\c@move.\WhiteToMove{w}{b}.varnum\endcsname + %===========% %% pgnpiece \expandafter\xdef \csname Xskak.\xskak@val@gameid.\the\c@move.\WhiteToMove{w}{b}.pgnpiece\endcsname{% @@ -763,7 +782,10 @@ %% new naming, changed to boolean \begingroup \WhiteToMove% - {\ifthenelse%white enpassant + {\ifthenelse% + {\equal{\csname Xskak.\xskak@val@gameid.\the\c@move.w.piecechar\endcsname}{p}} + {% pawn move: + \ifthenelse%white enpassant {\equal {\csname Xskak.\xskak@val@gameid.\the\c@move.w.moveto\endcsname}% {\csname Xskak.\xskak@val@gameid.\the\numexpr\the\c@move-1\relax.b.enpassantsquare\endcsname}}% @@ -775,7 +797,14 @@ {\expandafter\xdef \csname Xskak.\xskak@val@gameid.\the\c@move.\WhiteToMove{w}{b}.enpassant\endcsname {\noexpand\setboolean{xskakboolenpassant}{false}}}}% - {\ifthenelse%black enpassant + {\expandafter\xdef + \csname Xskak.\xskak@val@gameid.\the\c@move.\WhiteToMove{w}{b}.enpassant\endcsname + {\noexpand\setboolean{xskakboolenpassant}{false}}}% + }% + {\ifthenelse + {\equal{\csname Xskak.\xskak@val@gameid.\the\c@move.b.moveto\endcsname}{p}} + {%pawn move: + \ifthenelse%black enpassant {\equal {\csname Xskak.\xskak@val@gameid.\the\c@move.b.moveto\endcsname}% {\csname Xskak.\xskak@val@gameid.\the\c@move.w.enpassantsquare\endcsname}}% @@ -786,8 +815,11 @@ \csname Xskak.\xskak@val@gameid.\the\c@move.\WhiteToMove{w}{b}.lostpiece\endcsname{P}}% {\expandafter\xdef \csname Xskak.\xskak@val@gameid.\the\c@move.\WhiteToMove{w}{b}.enpassant\endcsname - {\noexpand\setboolean{xskakboolenpassant}{false}}}% - }% + {\noexpand\setboolean{xskakboolenpassant}{false}}}}% + {\expandafter\xdef + \csname Xskak.\xskak@val@gameid.\the\c@move.\WhiteToMove{w}{b}.enpassant\endcsname + {\noexpand\setboolean{xskakboolenpassant}{false}}}} + % \endgroup %\expandafter\show\csname Xskak.\xskak@val@gameid.\the\c@move.\WhiteToMove{w}{b}.enpassant\endcsname %\expandafter\show\csname Xskak.\xskak@val@gameid.\the\c@move.\WhiteToMove{w}{b}.lostpiece\endcsname @@ -992,7 +1024,7 @@ %% tests if the argument is \xskakcomment{...} \def\xskak@test@comment#1=\xskakcomment#2=={% \def\@tempa{#1}% - \ifx\@tempa\empty%#1 beginnt mit \chesscomment + \ifx\@tempa\empty%#1 beginnt mit \xskakcomment \setboolean{xskakboolcomment}{true}% \else \setboolean{xskakboolcomment}{false}% @@ -1027,7 +1059,7 @@ }}% {}%variation \PrintMoves{{\xskak@beforecomment{#1}}}{}% - \Mainline(#2)% + \xskak@do@parsemainline(#2)% \else \xskak@test@nag#1YXX% \ifthenelse% @@ -1072,10 +1104,11 @@ {{\xskak@beforeNAG{\csname#1\endcsname}}}}% %\expandafter\show\csname Xskak.\xskak@val@gameid.\the\c@move.w.nag\endcsname }}% + {}%variation \PrintMoves{{\xskak@beforeNAG{\csname#1\endcsname}}}{}% - \Mainline(#2)}% + \xskak@do@parsemainline(#2)}% {\EqStr{ }{#1}% - {\Mainline(#2)}% + {\xskak@do@parsemainline(#2)}% {% \EqStr{Z}{#1}% {}% @@ -1085,14 +1118,15 @@ % number with a space, eg, 1.e4 %{\gdef\NumberNext{\False}\Mainline(#2)}% %\gdef\NumberNext{\False}% - \Mainline(#2)}% + \xskak@do@parsemainline(#2)}% {\Fen@calculate% 16.10.2008 skak1.5 \expandafter\xdef\csname chessgame.skak.temp.previous\endcsname{\temp@board}%16.10.2008 skak1.5 \MakeMoveMainline{#1}% - \Mainline(#2)}}}}% + \xskak@do@parsemainline(#2)}}}}% \fi} %% overwrite the skak version: +%% currently needed as \runmoves use \Mainline \let\Mainline\xskak@do@parsemainline %% Printing @@ -1317,6 +1351,7 @@ \newcommand\printchessgame[1][]{% \setkeys*[UFXS]{print}{#1}%set style and level + \leavevmode%UF 2012-09-10 to allow wrapping around wrapfigure \begingroup \setkeys*[UFXS]{xprint}{#1}%% getting the id \xdef\xskak@val@movenr{% @@ -1428,7 +1463,7 @@ \gdef\StoreLastMove{\False}% {\variationstyle\opencommands% \variationmovemode - \Mainline(#1 Z )% + \xskak@do@parsemainline(#1 Z )% \closecommands}} %%% Read/store commands |