棋盘 / xskak:如何在国际象棋注释中添加移动编号“0”。

棋盘 / xskak:如何在国际象棋注释中添加移动编号“0”。

是否有可能在移动注释打印输出中获取“起始位置”/“数字 0”?

如果我尝试,\hidemoves{0. Ke4 ... 1. Ke3 ... }
我会得到错误! mainline: 0 is not the correct move number.

在此处输入图片描述

\documentclass[margin=5mm, varwidth]{standalone}
\usepackage{chessboard, xskak}
\setchessboard{showmover=false}
% For hiding the black pieces annotation =====
% https://tex.stackexchange.com/a/634522/46023
\makeatletter
\def\xskak@do@printmove{%
\ifthenelse{\equal{\xskak@val@player}{b}}{}{\xskakget{san}\xskakget{nag}}}
% =============================

\begin{document}
\newchessgame[id=MyGame, 
setwhite={Ke4}% Startposition ----> " 0. Ke4 " 
]
\hidemoves{%0. Ke4 ...  --> not allowed
1. Ke3 ... 2. Kd3 ... 3. Ke4 ... 4. Ke5}
\chessboard

\printchessgame[style=styleC]

\printchessgame[style=UF]
\end{document}

答案1

我用了

\xskakset{defaultmovenr=0,}

所以:

在此处输入图片描述

\documentclass[a4paper]{article}
\usepackage[margin=10mm]{geometry}
%\documentclass[margin=5mm, varwidth]{standalone}
\usepackage[most]{tcolorbox}

\usepackage{chessboard, xskak}
\setchessboard{showmover=false, margin=false}
\xskakset{defaultmovenr=0,}
% For hiding the black pieces annotation =====
% https://tex.stackexchange.com/a/634522/46023
\makeatletter
\def\xskak@do@printmove{%
\ifthenelse{\equal{\xskak@val@player}{b}}{}{\xskakget{san}\xskakget{nag}}}
% alternativ: 
%\renewcommand\xskak@val@defaultmovenr{0}
\makeatother
% =============================

\begin{document}
\newchessgame[id=MyGame, 
setwhite={Ka4}% Startposition 
]
\hidemoves{0. Ke4 ... 
1. Ke3 ... 2. Kd3 ... 3. Ke4 ... 4. Ke5}
%\chessboard[]
%\printchessgame[style=styleC]

\foreach \MoveNo in {0,...,4}{%%
\begin{tcbitemize}[sharp corners, raster equal height=rows,
raster column skip=0mm,
boxrule=1.2pt, boxsep=5mm, 
colback=white, colbacktitle=white,  coltitle=black, fonttitle=\bfseries,
]
\tcbitem[title={Position \MoveNo}] \chessboard[
movenr=\MoveNo, player=w, setfen=\xskakget{nextfen}] 
\tcbitem[] \printchessgame[style=styleC]
\end{tcbitemize}
}%%
\end{document}

相关内容