]> git.lyx.org Git - features.git/blob - lib/layouts/chess.layout
chess article layout
[features.git] / lib / layouts / chess.layout
1 #% Do not delete the line below; configure depends on this
2 #  \DeclareLaTeXClass[article,lyxskak.sty]{article (Chess)}
3 # chess article textclass definition file.
4
5 # This layout file was designed to allow easy access to all
6 # the cool features of the skak package for chess notation.
7 #
8 # Author : Kayvan A. Sylvan <kayvan@sylvan.com>
9 #
10 # Copyright (C) 2001 - The LyX team.
11 #
12 # Remaining minor problem:
13 #
14 # Sometimes there is too much space under a \showboard, especially
15 # if you use some of the ornamentation commands (\printknightmove,
16 # \highlight or \printarrow). For now, a workaround for the problem
17 # is to insert (using ERT) a \vspace* command (for example,
18 # \vspace*{-0.5in})
19
20
21 Preamble
22   \usepackage[ps,mover]{lyxskak}
23
24   %%% Modified routines from skak.sty
25   %
26   \def\lyxprintarrow#1{\lyxprintarrow@#1@}
27   \def\lyxprintarrow@#1->#2@{\ncline[style=psskak]{-|>}{#1}{#2}}
28
29   \def\lyxknightmove#1{\lyxknightmove@#1@}
30   \def\lyxknightmove@#1->#2@{% 
31     \setcounter{ps@knightangle}{\get@fileangle{\First#1}{\First#2}+%
32       \get@rankangle{\Second#1}{\Second#2} + \value{ps@inverse}}%
33     \ncdiagg[style=psskak,angleA=\arabic{ps@knightangle}]{-|>}{#1}{#2}}
34
35   %%% Variation indent (You can set this in your preamble)
36   %
37   \newlength{\lyxvarindent}
38   \setlength{\lyxvarindent}{0.2in}
39
40   %%% \Var[ moves ] - use in the Variation paragraph styles.
41   %
42   \def\Var[#1]{\variation{#1}}
43
44   %%% initialize board
45   %
46   \newgame
47
48 EndPreamble
49
50 Style Standard
51 # To be filled in later. This makes Standard first on the list of layouts.
52 End
53
54 # This is the main line of the chess game. Use PGN notation here.
55 # Also, this layout can be continued with Control-Enter without
56 # starting a new paragraph.
57 #
58 Style Mainline
59   LatexType Command
60   LatexName mainline
61   Margin Static
62   LeftMargin MMMMMM
63   Labeltype Static
64   LabelString "Mainline: "
65   Newline 0
66   PassThru 1
67   TopSep 0.0
68   ParSep 0.0
69
70   LabelFont
71     Color blue
72     Series bold
73   EndFont
74
75   TextFont
76     Color blue
77   EndFont
78 End
79
80 # This is a variation. It shows up in the normal fashion (styleB).
81 # You are free to redefine it by making a new \variationstyle
82 # as talked about in the skak documentation.
83 #
84 Style Variation
85   CopyStyle Mainline
86   LatexType Command
87   LatexName hspace*\lyxvarindent\variation
88   LabelString "Variation: "
89   LeftMargin MMMMMMMM
90 End
91
92 # Same as mainline, but it does not print the moves (only updates the
93 # board position.
94 #
95 Style HideMoves
96   CopyStyle Mainline
97   LatexName hidemoves
98   LabelString "HideMoves: "
99 End
100
101 # This simply prints a block left chessboard.
102 #
103 Style ChessBoard
104   CopyStyle Mainline
105   LatexType Command
106   LatexName showboard
107   LabelString "[chessboard]"
108   KeepEmpty 1
109   LabelFont
110     Color red
111   EndFont
112 End
113
114 # This prints a centered chessboard.
115 #
116 Style BoardCentered
117   CopyStyle Mainline
118   LatexType Command
119   LatexName [\showboard\]
120   LeftMargin MMMMMMMMMMMMM
121   LabelString "[centered board]"
122   KeepEmpty 1
123   LabelFont
124     Color red
125   EndFont
126 End
127
128 # This should be a list of comma-separated chessboard squares.
129 # Should be placed after a ChessBoard or BoardCentered.
130 #
131 Style HighLight
132   CopyStyle Mainline
133   LatexType Command
134   LatexName highlight
135   LeftMargin MMMMMMM
136   LabelString "Highlights: "
137   LabelFont
138     Color black
139     Series Bold
140     Shape SmallCaps
141   EndFont
142   TextFont
143     Series Bold
144     Color black
145   EndFont
146 End
147
148 # This should be a list of two squares with an ascii arrow (a1->c3)
149 # Should be placed after a ChessBoard or BoardCentered.
150 #
151 Style Arrow
152   CopyStyle HighLight
153   LatexType Command
154   LatexName lyxprintarrow
155   LeftMargin MMMMMMM
156   LabelString "Arrow: "
157 End
158
159 # This should be a list of two chessboard squares (again, like g1->e2)
160 # Should be placed after a ChessBoard or BoardCentered.
161 #
162 Style KnightMove
163   CopyStyle Arrow
164   LatexType Command
165   LatexName lyxknightmove
166   LeftMargin MMMMMMM
167   LabelString "KnightMove: "
168 End
169
170 Input article.layout