考虑以下代码:
\documentclass{article}
\usepackage{chessboard}
\storechessboardstyle{8x8}{maxfield=h8}
\usepackage{graphicx}
\begin{document}
\begin{tabular}{cc}
\chessboard[pgfstyle=straightmove, style=8x8, markmoves={
a8-c7, c7-b5, b5-d6, d6-e8, e8-g7, g7-h5, h5-f6, f6-e4,
e4-g3, g3-h1, h1-f2, f2-d1, d1-b2, b2-c4, c4-a3, a3-c2,
c2-a1, a1-b3, b3-d4, d4-e2, e2-g1, g1-h3, h3-f4, f4-e6,
e6-g5, g5-h7, h7-f8, f8-d7, d7-b8, b8-a6, a6-c5, c5-a4,
a4-c3, c3-b1, b1-d2, d2-f1, f1-h2, h2-g4, g4-e3, e3-f5,
f5-h6, h6-g8, g8-e7, e7-d5, d5-b6, b6-c8, c8-a7, a7-c6,
c6-a5, a5-b7, b7-d8, d8-f7, f7-h8, h8-g6, g6-h4, h4-g2,
g2-e1, e1-f3, f3-e5, e5-d3, d3-c1, c1-a2, a2-b4}, setwhite={Na8}, linewidth=0.01em, showmover = false]
\end{tabular}
\end{document}
如何将上面代码中的箭头改为普通线?
答案1
使用arrow={}
:
\documentclass{article}
\usepackage{chessboard}
\storechessboardstyle{8x8}{maxfield=h8}
\usepackage{graphicx}
\begin{document}
\begin{tabular}{cc}
\chessboard[pgfstyle=straightmove, style=8x8, arrow={},markmoves={
a8-c7, c7-b5, b5-d6, d6-e8, e8-g7, g7-h5, h5-f6, f6-e4,
e4-g3, g3-h1, h1-f2, f2-d1, d1-b2, b2-c4, c4-a3, a3-c2,
c2-a1, a1-b3, b3-d4, d4-e2, e2-g1, g1-h3, h3-f4, f4-e6,
e6-g5, g5-h7, h7-f8, f8-d7, d7-b8, b8-a6, a6-c5, c5-a4,
a4-c3, c3-b1, b1-d2, d2-f1, f1-h2, h2-g4, g4-e3, e3-f5,
f5-h6, h6-g8, g8-e7, e7-d5, d5-b6, b6-c8, c8-a7, a7-c6,
c6-a5, a5-b7, b7-d8, d8-f7, f7-h8, h8-g6, g6-h4, h4-g2,
g2-e1, e1-f3, f3-e5, e5-d3, d3-c1, c1-a2, a2-b4}, setwhite={Na8}, linewidth=0.01em, showmover = false]
\end{tabular}
\end{document}
答案2
只要稍加注意,你就可以插入 tikz 代码来画线:
\documentclass{article}
\usepackage{chessboard}
\storechessboardstyle{8x8}{maxfield=h8}
\usepackage{graphicx,tikz}
\begin{document}
\begin{tabular}{cc}
\chessboard[pgfstyle=straightmove,
addpgf={\tikz[overlay]\draw[red,line width=0.1em](b1)--(c3)node[fill,blue,circle,inner sep=0.1em]{}--(d5)--(c7)--(e6);},
style=8x8,, setwhite={Nb1}, linewidth=, showmover = false]
\end{tabular}
\end{document}