棋子不动

棋子不动

如图 2 和图 3 所示,f7 上的白棋骑士停留在自己的场地上。

在图 2 中,符号为1 Z-ZZ而不是 **1 Kf7 - h6+ **。

出了什么问题?

在此处输入图片描述

以下是代码:

    \documentclass{article}
    \usepackage{a4}
    \usepackage[german, ngerman]{babel}
    \usepackage[latin1]{inputenc}
    \usepackage[LSBC4,T1]{fontenc}
    \usepackage{chessboard}
    \usepackage{xskak}
    \setboardfontencoding{LSBC4}
    \newskaklanguage{german}{KDTLSB}
    \skaklanguage[german]        
    % set size of printed area
    \textheight 23.5cm
    \topmargin  -0.5cm
    \footskip 12mm

    \begin{document}        
    \styleB
    \newchessgame[id=A1,
    setfen=1n2B1n1/bp1ppNpb/6k1/1p2q3/5P2/2pK4/1r6/2B5,
    moveid=1w
    ]
    % Display starting position
    \chessboard[smallboard]%
    % Enter game
    \hidemoves{1. Nh6+ Kh6+ 2. f4f5+ g7g5 3. f5xg6+}%

    % Show board after white's first move
    \xskakset{moveid=1w}%
    \chessboard[smallboard ,setfen=\xskakget{nextfen}]%
    \quad \xskakget{opennr}\xskakget{lan}%
    \\
    Now the knight should be on h6.

    However, the white knight is still on f7.

    %increment move id
    \xskakset{moveid=1b}%
    % Show board after black's first move
    \chessboard[smallboard ,setfen=\xskakget{nextfen}]%
    \quad \xskakget{opennr}\xskakget{lan}%
    \\
    The king took the knight on h6.

    However, the white knight is still on f7.
    \end{document}

答案1

您已经声明并使用了一种新语言 ( {german}{KDTLSB}),但您的第一步是Nh6+使用默认的 ( {english}{KQRBNP})N来表示骑士。

解决的两个选项是:

  1. 更改Nh6+Sh6+,或
  2. 注释掉\skaklanguage[german]后就一直使用英文输入缩写。

如果您坚持german使用输入缩写,请注意确保所有其他动作也使用正确的字母。

任何一个选项都会产生正确的输出:

\documentclass{article}
\usepackage{a4}
\usepackage[german, ngerman]{babel}
\usepackage[latin1]{inputenc}
\usepackage[LSBC4,T1]{fontenc}
\usepackage{chessboard}
\usepackage{xskak}
\setboardfontencoding{LSBC4}
\newskaklanguage{german}{KDTLSB}
\skaklanguage[german]               %%% OR comment out language selection instead of fix below
% set size of printed area
\textheight 23.5cm
\topmargin  -0.5cm
\footskip 12mm

\begin{document}        
\styleB
\newchessgame[id=A1,
  setfen=1n2B1n1/bp1ppNpb/6k1/1p2q3/5P2/2pK4/1r6/2B5,
  moveid=1w
]
% Display starting position
\chessboard[smallboard]%
% Enter game
\hidemoves{1. Sh6+ Kh6+ 2. f4f5+ g7g5 3. f5xg6+}%%% changed Nh6+ to Sh6+ here...

% Show board after white's first move
\xskakset{moveid=1w}%
\chessboard[smallboard ,setfen=\xskakget{nextfen}]%
\quad \xskakget{opennr}\xskakget{lan}%
\\
Now the knight should be on h6.

Yes, it is now! \verb+:-)+

%increment move id
\xskakset{moveid=1b}%
% Show board after black's first move
\chessboard[smallboard ,setfen=\xskakget{nextfen}]%
\quad \xskakget{opennr}\xskakget{lan}%
\\
The king took the knight on h6.

Yay!
\end{document}

在此处输入图片描述

相关内容