在 xskak 循环中添加注释

在 xskak 循环中添加注释

如何在每次移动后添加注释以便在下面的代码中解释它:

\documentclass[10pt]{beamer}
\usepackage{xskak,chessboard}
\setbeamertemplate{navigation symbols}{}
\begin{document}
Marshall–MacClureSwindle\\
\begin{center}
\[\chessboard[setfen=k7/2p1rp1P/KpP2R/7r/1P/8/8/8/8, showmover,storefen=Marshall–MacClureSwindle]\]
\[\newchessgame[restorefen=Marshall–MacClureSwindle]\]
\hidemoves{1.Rh6! Rxh6 2.h8=Q+! Rxh8 3.b5! Rd7 4.cxd7  c5?? 5.bxc6 Kb8 6.Kxb6}
\xskakloop[step=1,showlast]{
\begin{tabular}{c}
\chessboard[normalboard,setfen=\xskakget{nextfen}]\\
\xskakget{opennr}
\xskakget{lan}
\end{tabular}\quad}
\end{center}
\end{document}

答案1

您可以使用 \xskakcomments 添加注释,并在循环中检索它们:

\documentclass[10pt]{article}
\usepackage{xskak}
\usepackage{chessboard}
\makeatletter
\providecommand\xskak@beforecomment{} %ups a bug, definition is missing
\makeatother

\begin{document}
Marshall–MacClureSwindle\\
\begin{center}
\[\chessboard[setfen=k7/2p1rp1P/KpP2R/7r/1P/8/8/8/8, showmover,storefen=Marshall–MacClureSwindle]\]
\[\newchessgame[restorefen=Marshall–MacClureSwindle]\]
\hidemoves{1.Rh6!         \xskakcomment{ That's a good move! } 
            Rxh6 2.h8=Q+! \xskakcomment{ That's another good move! }
            Rxh8 3.b5! Rd7 4.cxd7  c5?? 5.bxc6 Kb8 6.Kxb6}
\xskakloop[step=1,showlast]{
\begin{tabular}{c}
\chessboard[normalboard,setfen=\xskakget{nextfen}]\\
\xskakget{opennr}
\xskakget{lan} \\
\xskakget{nag} 
\end{tabular}\quad}
\end{center}
\end{document}

在此处输入图片描述

相关内容