国际象棋:裁剪棋盘符号样式中的图形周围的空白

国际象棋:裁剪棋盘符号样式中的图形周围的空白

考虑一下 Ulrike Fischer 的代码这里

\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
  \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}

\Huge
\svendusefigurine
\svendusefigblack
\textsymfigsymbol{Q}\capturesymbol\bonde{e}

\svendusefigwhite
\textsymfigsymbol{Q}\capturesymbol\bonde{e}

\end{document}

输出

黑色棋子周围的空白比白色棋子周围的空白多。是否可以裁剪黑色棋子周围的空白,使其与白色棋子周围的空白相同?

答案1

黑色棋子是仿制自棋盘字体的。棋盘字体的字符是二次的,这意味着它们不仅具有与小雕像不同的基线,而且侧边距也不同。对于棋子来说,这一点比其他字符更明显。您可以测量白色棋子并使用此宽度 - 您可以使用 \vphantom 来设置高度和深度。

\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
\newlength\svendfigwidthA
  \newcommand*\cfss@king@@LSBblack  {\raisebox{-0.31ex}{\setboardfontsize{\f@size}%
    \settowidth\svendfigwidthA{\symking}%
    \makebox[\svendfigwidthA]{\BlackKingOnWhite}}}
\newlength\svendfigwidthB
  \newcommand*\cfss@queen@@LSBblack {\raisebox{-0.37ex}{\setboardfontsize{\f@size}%
    \settowidth\svendfigwidthB{\symqueen}%
    \makebox[\svendfigwidthB]{\BlackQueenOnWhite}}}
\newlength\svendfigwidthC
  \newcommand*\cfss@rook@@LSBblack  {\raisebox{-0.26ex}{\setboardfontsize{\f@size}%
    \settowidth\svendfigwidthC{\symrook}%
    \makebox[\svendfigwidthC]{\BlackRookOnWhite}}}
\newlength\svendfigwidthD
  \newcommand*\cfss@bishop@@LSBblack{\raisebox{-0.35ex}{\setboardfontsize{\f@size}%
    \settowidth\svendfigwidthD{\symbishop}%
    \makebox[\svendfigwidthD]{\BlackBishopOnWhite}}}
\newlength\svendfigwidthE
  \newcommand*\cfss@knight@@LSBblack{\raisebox{-0.30ex}{\setboardfontsize{\f@size}%
    \settowidth\svendfigwidthE{\sympknight}%
    \makebox[\svendfigwidthE]{\BlackKnightOnWhite}}}
\newlength\svendfigwidthF
  \newcommand*\cfss@pawn@@LSBblack  {%
   \vphantom{\sympawn}%
   \raisebox{-0.31ex}[0pt][0pt]{%
    \setboardfontsize{\f@size}%
    \settowidth\svendfigwidthF{\sympawn}%
    \makebox[\svendfigwidthF]{\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}
\makeatletter \Huge
\fbox{\setboardfontsize{\f@size}\BlackPawnOnWhite} \fbox{\sympawn} \fbox{\cfss@pawn@@LSBblack}


\svendusefigurine
\svendusefigblack
\textsymfigsymbol{Q}\capturesymbol\bonde{e}


\svendusefigwhite
\textsymfigsymbol{Q}\capturesymbol\bonde{e}

\end{document}

在此处输入图片描述

相关内容