summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/texmate
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/source/latex/texmate')
-rw-r--r--Master/texmf-dist/source/latex/texmate/texmate.dtx40
1 files changed, 26 insertions, 14 deletions
diff --git a/Master/texmf-dist/source/latex/texmate/texmate.dtx b/Master/texmf-dist/source/latex/texmate/texmate.dtx
index 45aed877612..71e967d8b8e 100644
--- a/Master/texmf-dist/source/latex/texmate/texmate.dtx
+++ b/Master/texmf-dist/source/latex/texmate/texmate.dtx
@@ -217,10 +217,11 @@
\ifcat\noexpand~\noexpand#1%
\def\next{\@#1}%
\else
+ \catcode`\x=11\relax
\ifcat\relax\noexpand#1%
\def\next{\@#1}%
\else
- \def\next{\@@piece}%
+ \def\next{\catcode`\x=\active\@@piece}%
\if@skaking
\ifcat1\noexpand#1%
\@tmtoskak\expandafter{\the\@tmtoskak #1}%
@@ -235,7 +236,7 @@
\ifx\temp\@Queen\textsymqueen\else
\ifx\temp\@King\textsymking\else
\ifx\temp\@Castle\let\next\@castle\else
- \def\next{#1\@@piece}%
+ \def\next{#1\catcode`\x=\active\@@piece}%
\fi\fi\fi\fi\fi\fi
\fi\fi
\next}
@@ -380,7 +381,7 @@
\@turn
\if@white\advance\move1\relax\fi
\@execute}
-\long\def\threat#1{\bgroup\@skakingfalse\ifcase\@commlevel\or
+\def\threat#1{\bgroup\@skakingfalse\ifcase\@commlevel\or
\iifont\or\iiifont\or\ivfont\or\ivfont\fi\
\catcode`\>\active\withidea\@@piece}
\long\def\Threat#1{\bgroup
@@ -389,8 +390,10 @@
\ifcase\@commlevel\or
\iifont\or\iiifont\or\ivfont\or\ivfont\fi
\catcode`\>\active
- \if@delimited\@turn\fi
- \ddummy\@execute}
+ \if@delimited\else\@turn\fi
+ \@turn
+ \if@white\advance\move1\relax\fi
+ \@execute}
% \end{macrocode}
%
%\section{Variations environments}
@@ -516,7 +519,7 @@
\newcommand*\analysistop{Analysis}
\newcommand*\diagramtop{\textbf{\bname}}
\newcommand*\diagrambottom{\textbf{\wname}}
-\newcommand*\diagramsign{~\mdseries(\textit{D})}
+\newcommand*\diagramsign{~{\mdseries(\textit{D})}}
\let\@diagramtop\diagramtop
\let\@diagrambottom\diagrambottom
% \end{macrocode}
@@ -527,14 +530,18 @@
\newcount\@diagramsbuilt
\newcommand*\DiagramCache[1]{%
\@tempcnta#1
- \@whilenum\@tempcnta>0\do{%
+ \@whilenum\@tempcnta>\MaxDiagramCache\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}%
+ \ifnum#1>\MaxDiagramCache
+ \def\MaxDiagramCache{#1}%
+ \fi
}
+\def\MaxDiagramCache{0}
\DiagramCache3
\newcounter{diagram}
\newcommand*\makediagrams[1][\@diagramsbuilt]{%
@@ -606,7 +613,7 @@
}%
\fi
}
-\newcommand*\drawdiagram[2]{%
+\newcommand*\preparediagram[2]{%
\global\advance\@diagramsbuilt1\relax
\expandafter\global\expandafter
\sbox\csname chessdiag\@roman\the\@diagramsbuilt\endcsname{\showboard}%
@@ -668,16 +675,17 @@
\newif\if@blacksq
\newcommand\diagram[2][w 1]{%
\position[#1]{#2}%
- \showdiagram}
-\newcommand*\fenposition[1]{\@fenposition#1.}
+ \showboard}
\if@skakon
+ \let\skak@fenboard\fenboard
+ \renewcommand*\fenboard[1]{\tm@fenboard#1.}
\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%
+ \expandafter\skak@fenboard\tm@tofen%
}
\def\@convertdiagram#1{%
\let\next\@convertdiagram
@@ -702,12 +710,12 @@
\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.{%
+ \def\tm@fenboard#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
+ \expandafter\skak@fenboard\tm@tofen
\move#6\relax
\ifx#2w\@whitetrue\else\@whitefalse\fi
}
@@ -756,9 +764,13 @@
\let\@next\@gobble\fi
\@next\@tempcntb\fi}
\def\@togglesq{\if@blacksq\@blacksqfalse\else\@blacksqtrue\fi}
- \def\@fenposition#1 #2 #3 #4 #5 #6.{%
+ \newcommand*\fenboard[1]{\tm@fenboard#1.}
+ \def\tm@fenboard#1 #2 #3 #4 #5 #6.{%
\position[#2 #6]{#1}}
\fi
+\let\fenposition\fenboard
+\let\drawdiagram\preparediagram
+% \end{macrocode}
%
%\section{Game mark-up}
%