如何使用 LaTex 创建以下棋盘?
先感谢您
更新
\usepackage{xskak,xcolor}
\usepackage[utf8]{inputenc}
\usepackage[LSBC3,T1]{fontenc}
\usepackage{chessboard}
\setchessboard{boardfontencoding=LSBC3}
\makeatletter
\renewcommand\board@do@printfieldempty[2]{%fileNr, rankNr
\ifthenelse%
{\board@test@iswhitefield{#1}{#2}}%white field
{}% {\@nameuse{board@\board@val@game @piece@empty@white}}%
{}% {\@nameuse{board@\board@val@game @piece@empty@black}}%
}
\makeatother
\begin{document}
\begin{center}
\newchessgame
\chessboard[whitefieldmaskcolor=gray!50!white,addfontcolors,
border=false,
printarea=a1-h8,
hidefields={a1, a2, a3, a4, a5, a6, a7, a8,
b1, b2, b3, b6, b7, b8,
c1, c2, c7, c8,
d1, d8,
f8, f1,
g1, g2, g7, g8,
h1, h2, h3, h6, h7, h8},
setwhite={rc6, rd5, re4, rf3},
linewidth=0.5pt,
markboard,
pgfstyle=border,
boardfontsize=30pt,
showmover=false]
\end{center}
\end{document}
答案1
我通过这个chessboard
包意识到了这一点:
\documentclass{article}
\usepackage[LSBC3,T1]{fontenc}
\usepackage[svgnames]{xcolor}
\usepackage{chessboard}
\setchessboard{%
showmover=false,
boardfontencoding=LSBC3,
blackfieldmaskcolor=BlanchedAlmond,
whitefieldmaskcolor=BurlyWood!30!brown,
blackfieldcolor=BlanchedAlmond,
setfontcolors,
label=false,
border=false,
maxfield=g8,
hidefields={a1,a2,a3,a6,a7,a8,b1,b2,b7,b8,c1,c8,e1,e8,f1,f2,f7,f8,g1,g2,g3,g6,g7,g8}
}
\makeatletter
\renewcommand\board@do@printfieldempty[2]{}
\makeatother
\begin{document}
\chessboard[setpieces={Rb6,Rc5,Rd4,Re3}]
\end{document}
- 对于棋盘的菱形,我遵循此解决方案:我用键指定
hidefields
哪些字段是不需要的,并重新定义\board@do@printfieldempty
为不打印这些字段。此外,您需要删除外边框(border=false
)。由于布局适合 7x8 单元格,因此我将此大小设置为maxfield
。 - 对于颜色,我使用带有选项的包中的
BlanchedAlmond
和。这些是在三个键中指定的,和(注意:我交换了黑色和白色以得到与您的示例完全相同的颜色)。然后保证这些颜色确实被使用。BurlyWood!30!brown
xcolor
svgnames
blackfieldmaskcolor
whitefieldmaskcolor
blackfieldcolor
setfontcolors