mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-09 18:31:04 +00:00
better chess support from Kayvan
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@3055 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
96175b2fe6
commit
1ea49f41d5
@ -1,3 +1,18 @@
|
||||
2001-11-20 Kayvan A. Sylvan <kayvan@sylvan.com>
|
||||
|
||||
* examples/chess-article.lyx: Fixed comments. Removed hacks
|
||||
caused by my lack of understanding of TeX macros and LyX layouts.
|
||||
This version is immensely cleaner.
|
||||
|
||||
* examples/chessgame.lyx: Minimized ERT while still showing off
|
||||
the external chess material insets.
|
||||
|
||||
* tex/lyxskak.sty: Added LyX supporting macros. Added better embedded
|
||||
comment handling into skak framework. Fixed some bugs in skak.sty!
|
||||
|
||||
* layouts/chess.layout: Fixed up layout. Removed kludges in previous
|
||||
version. Added Subvariation, Subsubvariation, etc.
|
||||
|
||||
2001-11-13 André Pönitz <poenitz@gmx.net>
|
||||
|
||||
* ui/default.ui: create a new Submenu Insert->Math, since placing
|
||||
|
@ -128,7 +128,7 @@ status Collapsed
|
||||
\layout Standard
|
||||
|
||||
\backslash
|
||||
vspace*{-1in} % This is a hack!
|
||||
vspace*{-0.75in} % This is a hack!
|
||||
\end_inset
|
||||
|
||||
|
||||
@ -145,9 +145,10 @@ So far, so good.
|
||||
\layout Variation
|
||||
|
||||
5...
|
||||
Nge7}
|
||||
Nge7 [
|
||||
\backslash
|
||||
equal{} was better.{
|
||||
equal{} was better.
|
||||
]
|
||||
\layout Mainline
|
||||
|
||||
6.
|
||||
@ -191,8 +192,8 @@ White continues to develop pieces and also sets a trap for Black.
|
||||
\layout Mainline
|
||||
|
||||
12...
|
||||
O-O?} This move loses instantly.
|
||||
{
|
||||
O-O? [ This move loses instantly.
|
||||
]
|
||||
\layout Standard
|
||||
|
||||
The following was better, even though white retains the upper hand.
|
||||
@ -201,9 +202,9 @@ The following was better, even though white retains the upper hand.
|
||||
12...
|
||||
e5 13.
|
||||
Be3 Qc7 14.
|
||||
Na4 O-O }
|
||||
Na4 O-O [
|
||||
\backslash
|
||||
wbetter {
|
||||
wbetter ]
|
||||
\layout Mainline
|
||||
|
||||
13.
|
||||
|
@ -1,8 +1,9 @@
|
||||
#LyX 1.2 created this file. For more info see http://www.lyx.org/
|
||||
\lyxformat 220
|
||||
\textclass article
|
||||
\textclass chess
|
||||
\begin_preamble
|
||||
\usepackage{chess-workshop-symbols}
|
||||
\smallboard
|
||||
\end_preamble
|
||||
\language english
|
||||
\inputencoding auto
|
||||
@ -63,6 +64,14 @@ Wakeham, Marc
|
||||
(1623)
|
||||
\hfill
|
||||
(1639)
|
||||
\layout Mainline
|
||||
|
||||
1.
|
||||
e4 c5 2.
|
||||
Nc3 d6 3.
|
||||
g3 Nc6 4.
|
||||
Bg2 e6 5.
|
||||
Nge2
|
||||
\layout Standard
|
||||
|
||||
|
||||
@ -72,13 +81,7 @@ status Open
|
||||
\layout Standard
|
||||
|
||||
\backslash
|
||||
newgame
|
||||
\backslash
|
||||
smallboard%
|
||||
\layout Standard
|
||||
|
||||
\backslash
|
||||
mainline{1. e4 c5 2. Nc3 d6 3. g3 Nc6 4. Bg2 e6 5. Nge2}
|
||||
vspace*{-0.2in}
|
||||
\end_inset
|
||||
|
||||
|
||||
@ -101,23 +104,21 @@ status Collapsed
|
||||
|
||||
|
||||
\begin_inset ERT
|
||||
status Inlined
|
||||
status Collapsed
|
||||
|
||||
\layout Standard
|
||||
|
||||
\backslash
|
||||
]
|
||||
\backslash
|
||||
printknightmove{g1}{e2}
|
||||
\backslash
|
||||
highlight{d4,f4}
|
||||
\end_inset
|
||||
|
||||
|
||||
\layout Standard
|
||||
\layout KnightMove
|
||||
|
||||
So far, so good.
|
||||
This is all according to theory.
|
||||
g1->e2
|
||||
\layout HighLight
|
||||
|
||||
d4,f4
|
||||
\layout Standard
|
||||
|
||||
|
||||
@ -127,20 +128,31 @@ status Open
|
||||
\layout Standard
|
||||
|
||||
\backslash
|
||||
mainline{5... Be7?!}
|
||||
\backslash
|
||||
variation{5... Nge7}
|
||||
\backslash
|
||||
equal %
|
||||
\layout Standard
|
||||
|
||||
\backslash
|
||||
mainline{6. d4 cxd4 7. Nxd4 a6}
|
||||
vspace*{-0.5in} % This is a hack!
|
||||
\end_inset
|
||||
|
||||
|
||||
\layout Standard
|
||||
|
||||
So far, so good.
|
||||
This is all according to theory.
|
||||
\layout Mainline
|
||||
|
||||
5...
|
||||
Be7?!
|
||||
\layout Variation
|
||||
|
||||
5...
|
||||
Nge7 [
|
||||
\backslash
|
||||
equal{} ]
|
||||
\layout Mainline
|
||||
|
||||
6.
|
||||
d4 cxd4 7.
|
||||
Nxd4 a6
|
||||
\layout Standard
|
||||
|
||||
With 7...\SpecialChar ~
|
||||
a6, we are back in the well-trodden theory of this opening.
|
||||
\layout Standard
|
||||
@ -171,19 +183,14 @@ status Collapsed
|
||||
\end_inset
|
||||
|
||||
|
||||
\layout Standard
|
||||
|
||||
|
||||
\begin_inset ERT
|
||||
status Open
|
||||
|
||||
\layout Standard
|
||||
|
||||
\backslash
|
||||
mainline{8. Nxc6 bxc6 9. O-O Bb7 10. Qg4 Bf6 11. Bf4 Ne7 12. Rad1}
|
||||
\end_inset
|
||||
|
||||
\layout Mainline
|
||||
|
||||
8.
|
||||
Nxc6 bxc6 9.
|
||||
O-O Bb7 10.
|
||||
Qg4 Bf6 11.
|
||||
Bf4 Ne7 12.
|
||||
Rad1
|
||||
\layout Standard
|
||||
|
||||
|
||||
@ -203,53 +210,50 @@ status Collapsed
|
||||
|
||||
|
||||
\begin_inset ERT
|
||||
status Inlined
|
||||
status Collapsed
|
||||
|
||||
\layout Standard
|
||||
|
||||
\backslash
|
||||
]
|
||||
\backslash
|
||||
printarrow{a1}{d1}
|
||||
\end_inset
|
||||
|
||||
|
||||
\layout Arrow
|
||||
|
||||
a1->d1
|
||||
\layout Standard
|
||||
|
||||
White continues to develop pieces and also sets a trap for Black.
|
||||
\layout Mainline
|
||||
|
||||
12...O-O? [ This move loses instantly.
|
||||
]
|
||||
\layout Variation
|
||||
|
||||
12...
|
||||
e5 13.
|
||||
Be3 Qc7 14.
|
||||
Na4 O-O [
|
||||
\backslash
|
||||
wbetter{} is best ]
|
||||
\layout Mainline
|
||||
|
||||
13.
|
||||
e5!
|
||||
\layout Standard
|
||||
|
||||
Black's knight and bishop are in each other's way.
|
||||
The bishop is doomed.
|
||||
\layout Mainline
|
||||
|
||||
\begin_inset ERT
|
||||
status Open
|
||||
|
||||
\layout Standard
|
||||
|
||||
\backslash
|
||||
mainline{12... O-O?} This loses instantly.
|
||||
\layout Standard
|
||||
Best was
|
||||
\backslash
|
||||
variation{12... e5 13. Be3 Qc7 14. Na4 O-O}
|
||||
\backslash
|
||||
wbetter
|
||||
\layout Standard
|
||||
|
||||
\backslash
|
||||
mainline{13. e5!} Black's knight and bishop form a bumbling pair here, the Bishop is doomed.
|
||||
\layout Standard
|
||||
|
||||
\backslash
|
||||
mainline{13... Nd5!? 14. Bxd5 cxd5 15. exf6 Qxf6 16. Bxd6 Rfd8 17. Bc7 Rd7 18. Bf4 1-0 }%
|
||||
\layout Standard
|
||||
|
||||
\backslash
|
||||
[
|
||||
\backslash
|
||||
showboard
|
||||
\backslash
|
||||
]
|
||||
\end_inset
|
||||
|
||||
13...
|
||||
Nd5!? 14.
|
||||
Bxd5 cxd5 15.
|
||||
exf6 Qxf6 16.
|
||||
Bxd6 Rfd8 17.
|
||||
Bc7 Rd7 18.
|
||||
Bf4 1-0
|
||||
\layout BoardCentered
|
||||
|
||||
\the_end
|
||||
|
@ -21,26 +21,6 @@
|
||||
Preamble
|
||||
\usepackage[ps,mover]{lyxskak}
|
||||
|
||||
%%% Modified routines from skak.sty
|
||||
%
|
||||
\def\lyxprintarrow#1{\lyxprintarrow@#1@}
|
||||
\def\lyxprintarrow@#1->#2@{\ncline[style=psskak]{-|>}{#1}{#2}}
|
||||
|
||||
\def\lyxknightmove#1{\lyxknightmove@#1@}
|
||||
\def\lyxknightmove@#1->#2@{%
|
||||
\setcounter{ps@knightangle}{\get@fileangle{\First#1}{\First#2}+%
|
||||
\get@rankangle{\Second#1}{\Second#2} + \value{ps@inverse}}%
|
||||
\ncdiagg[style=psskak,angleA=\arabic{ps@knightangle}]{-|>}{#1}{#2}}
|
||||
|
||||
%%% Variation indent (You can set this in your preamble)
|
||||
%
|
||||
\newlength{\lyxvarindent}
|
||||
\setlength{\lyxvarindent}{0.2in}
|
||||
|
||||
%%% \Var[ moves ] - use in the Variation paragraph styles.
|
||||
%
|
||||
\def\Var[#1]{\variation{#1}}
|
||||
|
||||
%%% initialize board
|
||||
%
|
||||
\newgame
|
||||
@ -84,11 +64,56 @@ End
|
||||
Style Variation
|
||||
CopyStyle Mainline
|
||||
LatexType Command
|
||||
LatexName hspace*\lyxvarindent\variation
|
||||
LatexName lyxvariation[1]
|
||||
LabelString "Variation: "
|
||||
LeftMargin MMMMMMMM
|
||||
End
|
||||
|
||||
# This is a subvariation.
|
||||
#
|
||||
Style SubVariation
|
||||
CopyStyle Variation
|
||||
LatexName lyxvariation[2]
|
||||
LabelString "Subvariation: "
|
||||
LeftMargin MMMMMMMMMMM
|
||||
End
|
||||
|
||||
# This is a subsubvariation.
|
||||
#
|
||||
Style SubVariation2
|
||||
CopyStyle Variation
|
||||
LatexName lyxvariation[3]
|
||||
LabelString "Subvariation(2): "
|
||||
LeftMargin MMMMMMMMMMMMMM
|
||||
End
|
||||
|
||||
# This is a subsubsubvariation.
|
||||
#
|
||||
Style SubVariation3
|
||||
CopyStyle Variation
|
||||
LatexName lyxvariation[4]
|
||||
LabelString "Subvariation(3): "
|
||||
LeftMargin MMMMMMMMMMMMMMMMM
|
||||
End
|
||||
|
||||
# This is a subsubsubsubvariation.
|
||||
#
|
||||
Style SubVariation4
|
||||
CopyStyle Variation
|
||||
LatexName lyxvariation[5]
|
||||
LabelString "Subvariation(4): "
|
||||
LeftMargin MMMMMMMMMMMMMMMMMMMM
|
||||
End
|
||||
|
||||
# This is a subsubsubsubsubvariation.
|
||||
#
|
||||
Style SubVariation5
|
||||
CopyStyle Variation
|
||||
LatexName lyxvariation[6]
|
||||
LabelString "Subvariation(5): "
|
||||
LeftMargin MMMMMMMMMMMMMMMMMMMMMMM
|
||||
End
|
||||
|
||||
# Same as mainline, but it does not print the moves (only updates the
|
||||
# board position.
|
||||
#
|
||||
@ -131,7 +156,7 @@ End
|
||||
Style HighLight
|
||||
CopyStyle Mainline
|
||||
LatexType Command
|
||||
LatexName highlight
|
||||
LatexName lyxhighlight
|
||||
LeftMargin MMMMMMM
|
||||
LabelString "Highlights: "
|
||||
LabelFont
|
||||
|
@ -1,5 +1,7 @@
|
||||
% based on skak.sty
|
||||
% modified to work with older babel versions
|
||||
% Bug fixes and comment parsing code by Kayvan Sylvan <kayvan@sylvan.com>
|
||||
%
|
||||
\NeedsTeXFormat{LaTeX2e}
|
||||
\ProvidesPackage{lyxskak}
|
||||
|
||||
@ -269,7 +271,6 @@
|
||||
\expandafter\xdef\csname skaklanguage.#1\endcsname{#2}}
|
||||
|
||||
\newcommand{\skaklanguage}[1][english]{%
|
||||
%\def\skaklanguage#1{%
|
||||
\def\currentlanguage{#1}%
|
||||
\skak@ifthenelse{\equal{#1}{english}}%
|
||||
{\let\skak@pieceToEnglish=\skak@englishToEnglish%
|
||||
@ -807,7 +808,7 @@
|
||||
\ParseCoordinates(#2)}%
|
||||
{\IsPromotion{#1}%
|
||||
{\def\Promotion{\True}%
|
||||
\gdef\PromotionPieceName{\skak@pieceToEnlish{\FirstChar(#2)}}}}%
|
||||
\gdef\PromotionPieceName{\skak@pieceToEnglish{\FirstChar(#2)}}}}%
|
||||
{}% no more information is of interest
|
||||
}}}}
|
||||
|
||||
@ -1116,7 +1117,6 @@
|
||||
\def\@mainline#1{\endgroup\gdef\NumberNext{\True}%
|
||||
\Mainline(#1 Z ){\mainlinestyle\typeset@A{#1}}}
|
||||
|
||||
|
||||
\def\hidemoves{\begingroup\catcode`\#=12 \@hidemoves}
|
||||
\def\@hidemoves#1{\endgroup\def\NumberNext{\True}%
|
||||
\Mainline(#1 Z )}
|
||||
@ -1166,18 +1166,20 @@
|
||||
|
||||
\def\Mainline(#1 #2){%
|
||||
\EqStr{Z}{#1}%
|
||||
{}%
|
||||
{\NumberNext%
|
||||
{\EatNumber{#1}% sets \NumberOK, \ExpectedColour
|
||||
{\EqStr{Z}{#2}{}{\Mainline(#2)}}%
|
||||
{\EqStr{[}{#1}%
|
||||
{\typeset@eatcomment#1#2QXXQQ}%
|
||||
{\NumberNext%
|
||||
{\EatNumber{#1}% sets \NumberOK, \ExpectedColour
|
||||
% executes a move not separated from the
|
||||
% number with a space, eg, 1.e4
|
||||
\NumberOK%
|
||||
{\gdef\NumberNext{\False}%
|
||||
\Mainline(#2)}%
|
||||
{\errmessage{mainline: not the correct move number}}}%
|
||||
{\MakeMoveMainline{#1}%
|
||||
\Mainline(#2)}}}
|
||||
|
||||
\NumberOK%
|
||||
{\gdef\NumberNext{\False}%
|
||||
\Mainline(#2)}%
|
||||
{\errmessage{mainline: not the correct move number}}}%
|
||||
{\MakeMoveMainline{#1}%
|
||||
\Mainline(#2)}}}}
|
||||
\def\typeset@eatcomment[#1]#2QXXQQ{\Mainline(#2)}
|
||||
|
||||
%%%%% typesetting
|
||||
%%% figurine notation
|
||||
@ -1313,13 +1315,15 @@
|
||||
\def\typeset@AA(#1 #2){%
|
||||
\EqStr{Z}{#1}%
|
||||
{}%
|
||||
{\TypeSetNumberNext%
|
||||
{\typeset@number{#1}% sets \TypeSetColour
|
||||
\gdef\TypeSetNumberNext{\False}%
|
||||
\typeset@AA(#2)}%
|
||||
{\typeset@A@move{#1}%
|
||||
\typeset@AA(#2)}}}
|
||||
|
||||
{\EqStr{[}{#1}%
|
||||
{\typeset@printcomment#1#2QXXQX}%
|
||||
{{\TypeSetNumberNext%
|
||||
{\typeset@number{#1}% sets \TypeSetColour
|
||||
\gdef\TypeSetNumberNext{\False}%
|
||||
\typeset@AA(#2)}%
|
||||
{\typeset@A@move{#1}%
|
||||
\typeset@AA(#2)}}}}}
|
||||
\def\typeset@printcomment[#1]#2QXXQX{{\ }{#1}{\typeset@AA(#2)}}
|
||||
|
||||
\def\variation{\begingroup\catcode`\#=12 \@variation}
|
||||
\def\@variation#1{\endgroup{\variationstyle\typeset@A{#1}}}
|
||||
@ -1569,7 +1573,37 @@
|
||||
\edef\restore@temp{\csname chessgame.#1\endcsname}
|
||||
\expandafter\FenBoard\restore@temp)}
|
||||
|
||||
% end skak.sty
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
% Added in support of the chess.layout by Kayvan Sylvan <kayvan@sylvan.com>
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
|
||||
%%% Modified routines from skak.sty
|
||||
%
|
||||
\def\lyxprintarrow#1{\lyxprintarrow@#1@\vspace*{-1\parskip}}
|
||||
\def\lyxprintarrow@#1->#2@{\ncline[style=psskak]{-|>}{#1}{#2}}
|
||||
|
||||
\def\lyxknightmove#1{\lyxknightmove@#1@\vspace*{-1\parskip}}
|
||||
\def\lyxknightmove@#1->#2@{%
|
||||
\setcounter{ps@knightangle}{\get@fileangle{\First#1}{\First#2}+%
|
||||
\get@rankangle{\Second#1}{\Second#2} + \value{ps@inverse}}%
|
||||
\ncdiagg[style=psskak,angleA=\arabic{ps@knightangle}]{-|>}{#1}{#2}}
|
||||
|
||||
\def\lyxhighlight#1{\highlight{#1}\vspace*{-1\parskip}}
|
||||
|
||||
%%% Variation indent (You can set this in your preamble)
|
||||
%
|
||||
\newlength{\lyxvarindent}
|
||||
\setlength{\lyxvarindent}{0.15in}
|
||||
|
||||
\newlength{\lyxvar@ll}% temporary for storing line length in variations
|
||||
|
||||
%%% lyxvariation{....} - Indented paragraph of variation moves, typeset
|
||||
%%% in the normal fashion (styleB).
|
||||
%
|
||||
\def\lyxvariation[#1]#2{%
|
||||
%\setlength{\lyxvar@ll}{\textwidth}%
|
||||
\setlength{\lyxvar@ll}{\columnwidth}%
|
||||
\addtolength{\lyxvar@ll}{-#1\lyxvarindent}%
|
||||
\hspace*{#1\lyxvarindent}\parbox{\lyxvar@ll}{\variation{#2}}}
|
||||
|
||||
% end lyxskak.sty
|
||||
|
Loading…
Reference in New Issue
Block a user