在 xskak 中添加从位置到位置的箭头

在 xskak 中添加从位置到位置的箭头

我正在尝试使用以下代码在棋盘上添加从位置到位置的箭头,但没有成功,如何做到这一点

\documentclass{beamer}
\usepackage{xskak, chessboard}
\setbeamertemplate{navigation symbols}{}
\begin{document}
\newcommand\getmovestyle[1]{%
\ifthenelse
  {\equal{#1}{N}}%knight move
  {\def\mymovestyle{[clockwise=false,style=knight]curvemove}}%
  {\ifthenelse
    {\equal{#1}{}}% castling
    {\def\mymovestyle{curvemove}}%
    {\def\mymovestyle{straightmove}}}}%

\newgame\longmoves

\mainline{1. d4}
\xskakloop{%
\getmovestyle{\xskakget{piecechar}}%
\[\chessboard[normalboard, 
 pgfstyle=\mymovestyle, color=blue!50,
  markmoves=\xskakget{move}, pgfshortenend=0.3em, arrow=to, coloremph, color=red!50, markstyle=circle, markfield=\xskakget{movefrom},
  emphfields=\xskakget{moveto}, setfen=\xskakget{nextfen}]\]
  }% End of \xskakloop...

\mainline{1... e6}
\xskakloop{%
\getmovestyle{\xskakget{piecechar}}%
\[\chessboard[normalboard, 
 pgfstyle=\mymovestyle, color=blue!50,
  markmoves=\xskakget{move}, pgfshortenend=0.3em, arrow=to, coloremph, color=red!50, markstyle=circle, markfield=\xskakget{movefrom},
  emphfields=\xskakget{moveto}, setfen=\xskakget{nextfen}]\]
  }% End of \xskakloop...

\end{document}

答案1

\newchessgame如果您想访问 提供的数据,您必须使用 开始游戏xskak。不要忽略错误——它们表示出了问题...

\documentclass{beamer}
\usepackage{xskak, chessboard}
\setbeamertemplate{navigation symbols}{}
\begin{document}
\newcommand\getmovestyle[1]{%
\ifthenelse
  {\equal{#1}{N}}%knight move
  {\def\mymovestyle{[clockwise=false,style=knight]curvemove}}%
  {\ifthenelse
    {\equal{#1}{}}% castling
    {\def\mymovestyle{curvemove}}%
    {\def\mymovestyle{straightmove}}}}%

\newchessgame\longmoves

\mainline{1. d4}
\xskakloop{%
\getmovestyle{\xskakget{piecechar}}%
\[\chessboard[normalboard,
 pgfstyle=\mymovestyle, color=blue!50,
  markmoves=\xskakget{move}, pgfshortenend=0.3em, arrow=to, coloremph, color=red!50, markstyle=circle, markfield=\xskakget{movefrom},
  emphfields=\xskakget{moveto}, setfen=\xskakget{nextfen}]\]
  }% End of \xskakloop...

\mainline{1... e6}
\xskakloop{%
\getmovestyle{\xskakget{piecechar}}%
\[\chessboard[normalboard,
 pgfstyle=\mymovestyle, color=blue!50,
  markmoves=\xskakget{move}, pgfshortenend=0.3em, arrow=to, coloremph, color=red!50, markstyle=circle, markfield=\xskakget{movefrom},
  emphfields=\xskakget{moveto}, setfen=\xskakget{nextfen}]\]
  }% End of \xskakloop...

\end{document}

在此处输入图片描述

相关内容