以下示例使用 \hidemoves 输入 4 步。前 2 步(4 步半)后显示棋盘是可以的。下一步后显示棋盘也是可以的。但是,一步半(白方第四步)后显示棋盘会导致错误的位置。
\documentclass{article}
\usepackage[german, ngerman]{babel}
\usepackage[latin1]{inputenc}
\usepackage{xskak}
\begin{document}
\newchessgame[id=demo]
\hidemoves{%
1.d4 Nf6
2.c4 g6
3.Nc3 Bg7
4. Nd5 d6
}
%\xskakset{style=styleC}
\printchessgame[stopmoveid=2b]
\chessboard[tinyboard, setfen =\xskakget{pastfen}]
\printchessgame[initmoveid=3w, stopmoveid=3b]
Diagramm with two half moves later.\\
\chessboard[tinyboard, setfen =\xskakget{pastfen}]
\printchessgame[initmoveid=4w, stopmoveid=4w]
A very strange move. \\
However, that is not the expected position.\\
\chessboard[tinyboard, setfen =\xskakget{pastfen}]
\end{document}
答案1
您依赖于 的副作用\xskakget{pastfen}
。\printchessgame
确实会改变 moveid,它必须在处理过程中执行此操作,但这并不意味着在外部使用。
我会考虑如果将数字设置为最后处理的移动(也许)是否有意义,\printchessgame
但在此之前,您不应该依赖 moveid 来具有确定的值并在棋盘上明确地改进它(并使用 nextfen,因为您想要移动后的位置):
\documentclass{article}
\usepackage[ngerman]{babel}
\usepackage[utf8]{inputenc}
\usepackage{xskak}
\begin{document}
\newchessgame[id=demo]
\hidemoves{%
1.d4 Nf6
2.c4 g6
3.Nc3 Bg7
4.Nd5 d6
}
%\xskakset{style=styleC}
\printchessgame[stopmoveid=2b]
\chessboard[tinyboard, moveid=2b, setfen =\xskakget{nextfen}]
\printchessgame[initmoveid=3w, stopmoveid=3b]
Diagramm with two half moves later.\\
\chessboard[tinyboard, moveid=3b,setfen =\xskakget{nextfen}]
\printchessgame[initmoveid=4w, stopmoveid=4w]
A very strange move. \\
However, that is not the expected position.\\
\chessboard[tinyboard, moveid=4w,setfen =\xskakget{nextfen}]
\end{document}