答案1
虽然 OP 不想绘制图像,但我还是尝试并想出了下面的方法,它仅使用calc
带有 TikZ 的库并提供一种简单的方法来输入图表和符号:
\documentclass[border=1mm]{standalone}
\usepackage[dvipsnames]{xcolor}
\usepackage{tikz}
\usetikzlibrary{calc}
\usepackage{xeCJK}
\setCJKmainfont{AR PL UKai TW}
\newenvironment{threekingdoms}{
\begin{tikzpicture}
\foreach \i in {1,...,3} {
\begin{scope}[rotate around={{120*(\i-1)}:(0:0)}]
\foreach \j in {0,...,4} {
\coordinate (p\i0\j) at ([shift={(240:5)}]120:{\j*5/9});
\coordinate (p\i8\j) at ([shift={(300:5)}]60:{\j*5/9});
\coordinate (p\i4\j) at (270:{cos(30)*5-cos(30)*10/9*\j});
\coordinate (p\i2\j) at ($(p\i0\j)!0.5!(p\i4\j)$);
\coordinate (p\i1\j) at ($(p\i0\j)!0.5!(p\i2\j)$);
\coordinate (p\i3\j) at ($(p\i2\j)!0.5!(p\i4\j)$);
\coordinate (p\i6\j) at ($(p\i4\j)!0.5!(p\i8\j)$);
\coordinate (p\i5\j) at ($(p\i4\j)!0.5!(p\i6\j)$);
\coordinate (p\i7\j) at ($(p\i6\j)!0.5!(p\i8\j)$);
}
\end{scope}
}
}{
\end{tikzpicture}
}
\newcommand{\board}[1][none]{
\fill[#1] (p100) -- (p180) -- (p200) -- (p280) -- (p300) -- (p380) -- cycle;
\foreach \i in {1,...,3} {
\draw (p\i00) -- (p\i04) -- (p\i44) -- (p\i84) -- (p\i80) -- cycle;
\foreach \j in {1,...,7} {
\draw (p\i\j0) -- (p\i\j4);
}
\foreach \j in {1,...,3} {
\draw (p\i0\j) -- (p\i4\j) -- (p\i8\j);
}
\draw (p\i30) -- (p\i41) -- (p\i52)
(p\i50) -- (p\i41) -- (p\i32);
}
\draw (p384) -- (p104)
(p184) -- (p204)
(p284) -- (p304)
(p344) -- (p144) -- (p244) -- cycle;
}
\newcommand{\piece}[3]{
\def\fieldcolor{\ifcase#1\relax\or BrickRed\or PineGreen\or RoyalBlue\else black\fi}
\def\markadv{A}
\def\markcan{C}
\def\markchr{R}
\def\markele{E}
\def\markgen{G}
\def\markhrs{H}
\def\marksol{S}
\def\markban{B}
\def\fieldfigure{
\if#2\markadv\ifnum#1=1 仕\else 士\fi\else
\if#2\markcan\ifnum#1=1 炮\else\ifnum#1=2 礮\else 砲\fi\fi\else
\if#2\markchr 車\else
\if#2\markele\ifnum#1=1 相\else\ifnum#1=2 向\else 象\fi\fi\else
\if#2\markgen\ifnum#1=1 蜀\else\ifnum#1=2 吳\else 魏\fi\fi\else
\if#2\markhrs 馬\else
\if#2\marksol\ifnum#1=1 兵\else\ifnum#1=2 勇\else 卒\fi\fi\else
\if#2\markban\ifnum#1=1 火\else\ifnum#1=2 風\else 旗\fi\fi\else
\fi\fi\fi\fi\fi\fi\fi\fi
}
\node[circle, draw, double, \fieldcolor, fill=white, inner sep=0pt] at (p#3) {\fieldfigure};
}
\begin{document}
\begin{threekingdoms}
\board[Apricot!10]
% first argument: player
% 1 = Shu
% 2 = Wei
% 3 = Wu
% second argument: figure
% A = advisory
% C = cannon
% R = chariot
% E = elephant
% G = general
% H = horse
% S = soldier
% B = banner
% third argument: position
% first digit: field (1 = bottom, 2 = left, 3 = right)
% second digit: column (0 to 8, 0 being the leftmost line)
% third digit: row (0 to 4, 0 being the outermost line)
\piece{1}{S}{103}
\piece{1}{S}{123}
\piece{1}{S}{143}
\piece{1}{S}{163}
\piece{1}{S}{183}
\piece{1}{C}{112}
\piece{1}{B}{132}
\piece{1}{B}{152}
\piece{1}{C}{172}
\piece{1}{R}{100}
\piece{1}{H}{110}
\piece{1}{E}{120}
\piece{1}{A}{130}
\piece{1}{G}{140}
\piece{1}{A}{150}
\piece{1}{E}{160}
\piece{1}{H}{170}
\piece{1}{R}{180}
\piece{2}{S}{203}
\piece{2}{S}{223}
\piece{2}{S}{243}
\piece{2}{S}{263}
\piece{2}{S}{283}
\piece{2}{C}{212}
\piece{2}{B}{232}
\piece{2}{B}{252}
\piece{2}{C}{272}
\piece{2}{R}{200}
\piece{2}{H}{210}
\piece{2}{E}{220}
\piece{2}{A}{230}
\piece{2}{G}{240}
\piece{2}{A}{250}
\piece{2}{E}{260}
\piece{2}{H}{270}
\piece{2}{R}{280}
\piece{3}{S}{303}
\piece{3}{S}{323}
\piece{3}{S}{343}
\piece{3}{S}{363}
\piece{3}{S}{383}
\piece{3}{C}{312}
\piece{3}{B}{332}
\piece{3}{B}{352}
\piece{3}{C}{372}
\piece{3}{R}{300}
\piece{3}{H}{310}
\piece{3}{E}{320}
\piece{3}{A}{330}
\piece{3}{G}{340}
\piece{3}{A}{350}
\piece{3}{E}{360}
\piece{3}{H}{370}
\piece{3}{R}{380}
\end{threekingdoms}
\end{document}
如果问题只是关于如何在 LaTeX 中输入(某些)中文字符,本页上有几个答案涉及如何设置 LaTeX 以排版中文。为了在计算机上输入中文,通常您需要一种输入法和至少一些中文知识,因为大多数输入法只有在您知道字符的书写顺序或发音时才能使用。最好的办法是直接复制字符(例如从下面复制)。
Advisory: 士 or 仕
Cannon: 砲 or 炮 or 礮 (last one not used in traditional Xiangqi)
Chariot: 車 (traditional Xiangqi also uses 俥 as red variant)
Elephant: 象 or 相 or 向 (last one not used in traditional Xiangqi)
General: 魏 or 蜀 or 吳 (將 or 帥 in traditional Xiangqi)
Horse: 馬 (traditional Xiangqi also uses 傌 as red variant)
Soldier: 卒 or 兵 or 勇 (last one not used in traditional Xiangqi)
Bannermen: 旗 or 火 or 風 (not used in traditional Xiangqi)
此游戏是传统象棋的一个特殊变体,只有两名玩家。因此,它使用了一些特殊符号,这些符号可能不会包含在为中国象棋排版而设计的软件包中,也不会以 Unicode 编码(目前)。因此,最好的方法确实是使用相关汉字自己绘制这些符号。
答案2
这张图片绝对是你可以用 做的tikz
。至于字体,有几个用于排版中文、日文或韩文字符的软件包。
下面是一个如何(可能)实现这一点的示例:
\documentclass{standalone}
\usepackage{tikz}
\usepackage{fontspec}
\usetikzlibrary{shapes.geometric,calc,intersections}
\usepackage{xeCJK}
\setCJKmainfont{SimSun}
\begin{document}
\begin{tikzpicture}[thick,piece/.style={circle,inner sep=1pt,fill=white,double},
shu/.style={piece,draw=red,text=red},
wu/.style={piece,draw=green,text=green},
wei/.style={piece,draw=blue,text=blue}]
%Board outline (and anchors)
\node[regular polygon,regular polygon sides=6,draw,thick,minimum width=12cm] (b) {};
%Center triangle
\path[name path=tri1] ($(b.corner 1)!.0555!(b.corner 6)$) -- ($(b.corner 4)!.0555!(b.corner 5)$);
\path[name path=tri2] ($(b.corner 5)!.0555!(b.corner 4)$) -- ($(b.corner 2)!.0555!(b.corner 3)$);
\path[name path=tri3] ($(b.corner 6)!.0555!(b.corner 1)$) -- ($(b.corner 3)!.0555!(b.corner 2)$);
\path[name intersections={of=tri1 and tri2,by=A}];
\path[name intersections={of=tri1 and tri3,by=B}];
\path[name intersections={of=tri2 and tri3,by=C}];
\draw (A) -- (B) -- (C) -- cycle;
%% Shu field (red)
\foreach \n [count=\i] in {1,...,9}
\coordinate (rA\i) at ($(b.corner 4)!{(\n-1)*.125}!(b.corner 5)$);
\coordinate (rE1) at ($(b.corner 4)!.444!(b.corner 3)$);
\path ($(b.corner 3)!.555!(b.corner 4)$) -- (A) coordinate[pos=.25] (rE2);
\path ($(b.corner 3)!.555!(b.corner 4)$) -- (A) coordinate[pos=.50] (rE3);
\path ($(b.corner 3)!.555!(b.corner 4)$) -- (A) coordinate[pos=.75] (rE4);
\path ($(b.corner 3)!.555!(b.corner 4)$) -- (A) coordinate (rE5);
\path ($(b.corner 5)!.444!(b.corner 6)$) -- (A) coordinate[pos=.75] (rE6);
\path ($(b.corner 5)!.444!(b.corner 6)$) -- (A) coordinate[pos=.50] (rE7);
\path ($(b.corner 5)!.444!(b.corner 6)$) -- (A) coordinate[pos=.25] (rE8);
\coordinate (rE9) at ($(b.corner 5)!.444!(b.corner 6)$);
\foreach \i in {2,...,8}
\draw (rA\i) -- (rE\i) coordinate[pos=.25] (rB\i) coordinate[pos=.50] (rC\i) coordinate[pos=.75](rD\i);
\foreach \n [count=\i] in {rB,rC,rD}{
\coordinate (\n1) at ($(b.corner 4)!{\i*.111}!(b.corner 3)$);
\coordinate (\n9) at ($(b.corner 5)!{\i*.111}!(b.corner 6)$);
\draw (\n1) -- (\n5) -- (\n9);
}
\draw (rE1) -- (rE5) -- (rE9) (rC4) -- (rB5) -- (rA6) (rA4) -- (rB5) -- (rC6);
\node[shu] at (rA1){車};
\node[shu] at (rA2){馬};
\node[shu] at (rA3){相};
\node[shu] at (rA4){仕};
\node[shu] at (rA5){蜀};
\node[shu] at (rA6){仕};
\node[shu] at (rA7){相};
\node[shu] at (rA8){馬};
\node[shu] at (rA9){車};
\node[shu] at (rD1){兵};
\node[shu] at (rD3){兵};
\node[shu] at (rD5){兵};
\node[shu] at (rD7){兵};
\node[shu] at (rD9){兵};
\node[shu] at (rC4){火};
\node[shu] at (rC6){火};
\node[shu] at (rC2){焙};
\node[shu] at (rC8){焙};
%% Wei field (blue)
\draw ($(b.corner 1)!.555!(b.corner 2)$) -- (C) -- ($(b.corner 3)!.444!(b.corner 4)$);
\node[wei] at (b.corner 2) {車};
\node[wei] at ($(b.corner 2)!.125!(b.corner 3)$){馬};
\node[wei] at ($(b.corner 2)!.250!(b.corner 3)$){象};
\node[wei] at ($(b.corner 2)!.375!(b.corner 3)$){士};
\node[wei] at (b.side 2) {魏};
\node[wei] at ($(b.corner 2)!.625!(b.corner 3)$){士};
\node[wei] at ($(b.corner 2)!.750!(b.corner 3)$){象};
\node[wei] at ($(b.corner 2)!.875!(b.corner 3)$){馬};
\node[wei] at (b.corner 3) {車};
%% Wu field (green)
\draw ($(b.corner 1)!.444!(b.corner 2)$) -- (B) --($(b.corner 5)!.555!(b.corner 6)$);
\node[wu] at (b.corner 6) {車};
\node[wu] at ($(b.corner 6)!.125!(b.corner 1)$){馬};
\node[wu] at ($(b.corner 6)!.250!(b.corner 1)$){向};
\node[wu] at ($(b.corner 6)!.375!(b.corner 1)$){士};
\node[wu] at (b.side 6) {吳};
\node[wu] at ($(b.corner 6)!.625!(b.corner 1)$){士};
\node[wu] at ($(b.corner 6)!.750!(b.corner 1)$){向};
\node[wu] at ($(b.corner 6)!.875!(b.corner 1)$){馬};
\node[wu] at (b.corner 1) {車};
\end{tikzpicture}
\end{document}
(我不确定,我的几何形状 100% 正确,但应该足够接近了)
答案3
象棋棋子于 2018 年 6 月被添加到 Unicode 标准中,并发布了 11.0 版。
它们出现在国际象棋符号 Unicode 块中,即 U+1FA00–U+1FA6F,但实际上很少有字体包含这些字符(我的 Mac 上的字体都不包含这些字符)。
不过,有一种免费字体确实包含这些字符(由提出将这些字符添加到 Unicode 的请求的人设计),可在https://www.babelstone.co.uk/Fonts/Xiangqi.html
至于图表的其余部分,将使用 TiKZ 完成。