![国际象棋:符号风格问题](https://linux22.com/image/366647/%E5%9B%BD%E9%99%85%E8%B1%A1%E6%A3%8B%EF%BC%9A%E7%AC%A6%E5%8F%B7%E9%A3%8E%E6%A0%BC%E9%97%AE%E9%A2%98.png)
这是对第一个问题的后续问题这里。
使用 Ulrike 的代码这里,
\documentclass{article}
\usepackage{xskak}
\usepackage{expl3}
\makeatletter
\ExplSyntaxOn
\clist_const:Nn \c_svend_figlanguages_clist {@LSB , @LSBblack}
\cs_generate_variant:Nn \clist_if_in:NnTF {NxTF}
\newcommand*\bonde[1]
{
\clist_if_in:NxTF \c_svend_figlanguages_clist { \cfss@figlanguage }
{ \textsymfigsymbol {p} } { #1 }
}
\ExplSyntaxOff
\makeatother
\usesymfig
\makeatletter
\newcommand*\cfss@king@@LSBblack {\raisebox{-0.31ex}{\setboardfontsize{\f@size}\BlackKingOnWhite}}
\newcommand*\cfss@queen@@LSBblack {\raisebox{-0.37ex}{\setboardfontsize{\f@size}\BlackQueenOnWhite}}
\newcommand*\cfss@rook@@LSBblack {\raisebox{-0.26ex}{\setboardfontsize{\f@size}\BlackRookOnWhite}}
\newcommand*\cfss@bishop@@LSBblack{\raisebox{-0.35ex}{\setboardfontsize{\f@size}\BlackBishopOnWhite}}
\newcommand*\cfss@knight@@LSBblack{\raisebox{-0.30ex}{\setboardfontsize{\f@size}\BlackKnightOnWhite}}
\newcommand*\cfss@pawn@@LSBblack {\raisebox{-0.31ex}{\setboardfontsize{\f@size}\BlackPawnOnWhite}}
\newcommand\usesymfigblack{%
\def\cfss@figlanguage{@LSBblack}}
\makeatother
\begin{document}
\usetextfig
\textsymfigsymbol{Q}, \bonde{e} --
\usesymfig
\textsymfigsymbol{Q}, \bonde{e} --
\usesymfigblack
\textsymfigsymbol{Q}, \bonde{e}
\footnotesize
\usetextfig
\textsymfigsymbol{Q}, \bonde{e} --
\usesymfig
\textsymfigsymbol{Q}, \bonde{e} --
\usesymfigblack
\textsymfigsymbol{Q}, \bonde{e}
\end{document}
我想\usetextfig
在同时使用它们时切换到“否决” \usesymfigblack
。我的意思是,如果我\usetextfig
在序言中使用,并且
\usesymfigblack
\textsymfigsymbol{Q}, \bonde{e}
介于\begin{document}
和之间\end{document}
,则输出应为Q
和e
。原因是我使用\usesymfigblack
在文档中使用了多次来通过小雕像表示黑色棋子,但我想在 和 之间进行全局切换代数符号和小雕像代数符号。
我如何实现这个目标?
答案1
\documentclass{article}
\usepackage{xskak}
\usepackage{expl3}
\ExplSyntaxOn\makeatletter
\clist_const:Nn \c_svend_figlanguages_clist {@LSB , @LSBblack}
\cs_generate_variant:Nn \clist_if_in:NnTF {NxTF}
\newcommand*\bonde[1]
{
\clist_if_in:NxTF \c_svend_figlanguages_clist { \cfss@figlanguage }
{ \textsymfigsymbol {p} } { #1 }
}
\ExplSyntaxOff\makeatother
\makeatletter
\newcommand*\cfss@king@@LSBblack {\raisebox{-0.31ex}{\setboardfontsize{\f@size}\BlackKingOnWhite}}
\newcommand*\cfss@queen@@LSBblack {\raisebox{-0.37ex}{\setboardfontsize{\f@size}\BlackQueenOnWhite}}
\newcommand*\cfss@rook@@LSBblack {\raisebox{-0.26ex}{\setboardfontsize{\f@size}\BlackRookOnWhite}}
\newcommand*\cfss@bishop@@LSBblack{\raisebox{-0.35ex}{\setboardfontsize{\f@size}\BlackBishopOnWhite}}
\newcommand*\cfss@knight@@LSBblack{\raisebox{-0.30ex}{\setboardfontsize{\f@size}\BlackKnightOnWhite}}
\newcommand*\cfss@pawn@@LSBblack {\raisebox{-0.31ex}{\setboardfontsize{\f@size}\BlackPawnOnWhite}}
\newcommand\svendusefigurine{%
\def\svend@blacklanguage{@LSBblack}
\def\svend@whitelanguage{@LSB}}
\newcommand\svendusealgebraic{%
\def\svend@blacklanguage{english}% change if needed
\def\svend@whitelanguage{english}%
}
\newcommand\svendusefigblack{%
\def\cfss@figlanguage{\svend@blacklanguage}}
\newcommand\svendusefigwhite{%
\def\cfss@figlanguage{\svend@whitelanguage}}
\newcommand\svendfigblack[1]{%
\csname cfss@\csname cfss@input@#1@english\endcsname @\svend@blacklanguage\endcsname}
\newcommand\svendfigwhite[1]{%
\csname cfss@\csname cfss@input@#1@english\endcsname @\svend@whitelanguage\endcsname}
\makeatother
\svendusealgebraic
\begin{document}
\svendusealgebraic
\svendusefigblack
\textsymfigsymbol{Q}, \bonde{e} --
\svendusefigwhite
\textsymfigsymbol{Q}, \bonde{e} --
\svendfigwhite{Q}, \svendfigblack{Q}
\svendusefigurine
\svendusefigblack
\textsymfigsymbol{Q}, \bonde{e} --
\svendusefigwhite
\textsymfigsymbol{Q}, \bonde{e} --
\svendfigwhite{Q}, \svendfigblack{Q}
\end{document}