使用棋盘包,如何在棋盘上用 + 号标记一个方格?

使用棋盘包,如何在棋盘上用 + 号标记一个方格?

我可以用 X 或圆圈标记正方形,但仍然不能用 + 号标记。 在此处输入图片描述

\usepackage{chessboard}

\begin{document}
\begin{center}

\newchessgame

\chessboard[maxfield=c4, color=black,
markstyle=cross,markfields=a2,
markstyle=cross,markfields=a3,
markstyle=cross,markfields=b1,
markstyle=cross,markfields=b2,
markstyle=cross,markfields=b3,
markstyle=cross,markfields=b4,
markstyle=cross,markfields=c2,
markstyle=cross,markfields=c3, 
pgfstyle={[fill]circle},
markarea=\mycenter,
padding=-0.8ex,color=black,
markfields=a1,
markfields=a4,
markfields=c1,
markfields=c4, showmover=false]

\end{center}

\end{document}

答案1

您可以定义加号样式,例如:

\documentclass{article}
\usepackage{chessboard}
\makeatletter
\cbDefinePgfFieldStyle{plus}{%
    \pgfsetroundcap
    \setlength\len@board@tempx{\dimexpr 0.1em + \board@pgf@shortenstart \relax}%
    \pgfsetshortenstart{\len@board@tempx}%
    \setlength\len@board@tempx{\dimexpr 0.1em + \board@pgf@shortenend \relax}%
    \pgfsetshortenend{\len@board@tempx}%
    \pgfsetlinewidth{\board@pgf@linewidth}%
    \pgfpathmoveto{\pgfpointxy{0}{0.5}}%
    \pgfpathlineto{\pgfpointxy{0}{-0.5}}%
    \pgfusepath{stroke}%
    \pgfpathmoveto{\pgfpointxy{-0.5}{0}}%
    \pgfpathlineto{\pgfpointxy{0.5}{0}}%
    \pgfusepath{stroke}}%
\makeatother

\begin{document}
\begin{center}


\chessboard[maxfield=c4, color=black,
markstyle=plus,markfields=c3]

\end{center}

\end{document}

在此处输入图片描述

相关内容