more skak tweaks

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@2957 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Jean-Marc Lasgouttes 2001-10-31 17:16:35 +00:00
parent bf3d330980
commit 44b7b7fc71
9 changed files with 282 additions and 26 deletions

View File

@ -1,3 +1,15 @@
2001-10-31 Jean-Marc Lasgouttes <Jean-Marc.Lasgouttes@inria.fr>
* examples/iecc05.fen:
* examples/iecc07.fen:
* examples/iecc12.fen:
* lib/examples/chessgame.lyx: an example for the new chess support.
2001-10-31 Kayvan A. Sylvan <kayvan@sylvan.com>
* external_templates: Minor tweak. Changed $$FPath/$$Basename
to $$FPath$$Basename.
2001-10-30 Kayvan A. Sylvan <kayvan@sylvan.com>
* external_templates: Fix up the help message for ChessDiagram

255
lib/examples/chessgame.lyx Normal file
View File

@ -0,0 +1,255 @@
#LyX 1.2 created this file. For more info see http://www.lyx.org/
\lyxformat 220
\textclass article
\begin_preamble
\usepackage{chess-workshop-symbols}
\end_preamble
\language english
\inputencoding auto
\fontscheme default
\graphics default
\paperfontsize 12
\spacing single
\papersize letterpaper
\paperpackage a4
\use_geometry 1
\use_amsmath 0
\use_natbib 0
\use_numerical_citations 0
\paperorientation portrait
\topmargin 0in
\bottommargin 0.5in
\headheight 0in
\headsep 0in
\secnumdepth 3
\tocdepth 3
\paragraph_separation skip
\defskip smallskip
\quotes_language english
\quotes_times 2
\papercolumns 2
\papersides 1
\paperpagestyle empty
\layout Title
Email Chess Game analyzed
\layout Author
Kayvan A.
Sylvan
\newline
<kayvan@sylvan.com>
\layout Date
\emph on
Game start 05/29/2001
\layout Standard
The following game was played at the IECC (International Email Chess Club).
It is presented as an example of the fun you can have with LyX's new chess
support.
You must have xboard installed on your machine to be able to open and view
the chess positions from LyX.
\layout Standard
\line_top \line_bottom
\noun on
Sylvan, Kayvan
\hfill
Wakeham, Marc
\newline
(1623)
\hfill
(1639)
\layout Standard
\begin_inset ERT
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}
\end_inset
\layout Standard
\added_space_top medskip
\begin_inset ERT
status Collapsed
\layout Standard
\backslash
[
\end_inset
\begin_inset External ChessDiagram,"iecc05.fen",""
\end_inset
\begin_inset ERT
status Inlined
\layout Standard
\backslash
]
\backslash
printknightmove{g1}{e2}
\backslash
highlight{d4,f4}
\end_inset
\layout Standard
So far, so good.
This is all according to theory.
\layout Standard
\begin_inset ERT
status Open
\layout Standard
\backslash
mainline{5... Be7?!}
\backslash
variation{5... Nge7}
\backslash
equal %
\layout Standard
\backslash
mainline{6. d4 cxd4 7. Nxd4 a6}
\end_inset
\layout Standard
With 7...\SpecialChar ~
a6, we are back in the well-trodden theory of this opening.
\layout Standard
\begin_inset ERT
status Collapsed
\layout Standard
\backslash
[
\end_inset
\begin_inset External ChessDiagram,"iecc07.fen",""
\end_inset
\begin_inset ERT
status Collapsed
\layout Standard
\backslash
]
\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 Standard
\begin_inset ERT
status Collapsed
\layout Standard
\backslash
[
\end_inset
\begin_inset External ChessDiagram,"iecc12.fen",""
\end_inset
\begin_inset ERT
status Inlined
\layout Standard
\backslash
]
\backslash
printarrow{a1}{d1}
\end_inset
\layout Standard
White continues to develop pieces and also sets a trap for Black.
\layout Standard
\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
\the_end

1
lib/examples/iecc05.fen Normal file
View File

@ -0,0 +1 @@
r1bqkbnr/pp3ppp/2npp3/2p5/4P3/2N3P1/PPPPNPBP/R1BQK2R b KQkq - 0 5

1
lib/examples/iecc07.fen Normal file
View File

@ -0,0 +1 @@
r1bqk1nr/1p2bppp/p1npp3/8/3NP3/2N3P1/PPP2PBP/R1BQK2R w KQkq - 0 8

1
lib/examples/iecc12.fen Normal file
View File

@ -0,0 +1 @@
r2qk2r/1b2nppp/p1pppb2/8/4PBQ1/2N3P1/PPP2PBP/3R1RK1 b kq - 0 12

View File

@ -108,7 +108,7 @@ Template ChessDiagram
EditCommand "xboard -lpf $$FName -mode EditPosition"
AutomaticProduction true
Format LaTeX
Product "\\loadgame{$$FPath/$$Basename}\\showboard"
Product "\\loadgame{$$FPath$$Basename}\\showboard"
Requirement "chess"
FormatEnd
Format Ascii

View File

@ -1,24 +0,0 @@
#!/usr/bin/python
#
# Copyright (C) 2001 The LyX Team.
#
# This file is distributed under the GPL license.
#
# This script will convert a chess position in the FEN
# format to a chunk of LaTeX to be used with the skak.sty
# style.
import sys,string,os
os.close(0)
os.close(1)
sys.stdin = open(sys.argv[1],"r")
sys.stdout = open(sys.argv[2],"w")
line = sys.stdin.readline()
if line[-1] == '\n':
line = line[:-1]
print "\\fenboard{"+line+"}"
print "\\showboard%"

View File

@ -1,3 +1,10 @@
2001-10-31 Kayvan A. Sylvan <kayvan@sylvan.com>
* insetexternal.C (doSubstitution): Fix filepath ($$FPath in
external_templates) to use the buffer->fileName() but only if
previewing. Generating a TeX file should make FPath return
"".
2001-10-30 John Levon <moz@compsoc.man.ac.uk>
* insetert.h:

View File

@ -235,7 +235,10 @@ string const InsetExternal::doSubstitution(Buffer const * buffer,
{
string result;
string const basename = ChangeExtension(params_.filename, string());
string const filepath = OnlyPath(MakeAbsPath(params_.filename));
string filepath = "";
if (buffer && (!buffer->niceFile)) {
filepath = OnlyPath(MakeAbsPath(buffer->fileName()));
}
result = subst(s, "$$FName", params_.filename);
result = subst(result, "$$Basename", basename);
result = subst(result, "$$Parameters", params_.parameters);