Latex可以排版容易排版中国象棋, 围棋, 国际象棋棋谱和乐谱, 详情请见.

http://bbs.chinatex.org/forum.php?mod=viewthread&tid=4987&extra=page=1

这里以中国象棋棋谱为例:

中国象棋所需宏包:cchess(Chinese chess)\usepackage{cchess}

\normalboard 画出棋盘,然后用 position 环境置子,

纵线自左向右为:a, b, . . . , i,横线由下而上为:1, 2, . . . , 10

置子命令为

\piece {x}{y}{?}

x, y 为横纵坐标,如前所述,? 为棋子,符 号:

R車    N馬    B象    G士    K將    G士    B象    N馬    R車
                                                                           
         C砲                                                C砲        
P卒             P卒             P卒             P卒             P卒
                                                                           
       楚河                                             漢界           
                                                                            
p兵             p兵             p兵             p兵             p兵
         c炮                                                 c炮        
                                                                           
r車     n馬    b相    g仕    k 帥    g 仕   b相     n馬    r車
 

基本上红子就是黑子的小写字母版本

利用 \textpiece 命令可以排出具体的着法,比如:

\textpiece{c}八进四

命令可以达到 “炮八进四” 的效果

下面来看一个具体的源文件mychess.tex

 \documentclass{article}
\usepackage{cchess}
\begin{document}
\normalboard
\begin{position}
\piece{a}{}{r} \piece{i}{}{r}
\piece{b}{}{n} \piece{h}{}{n}
\piece{c}{}{b} \piece{g}{}{b}
\piece{d}{}{g} \piece{f}{}{g}
\piece{e}{}{c} \piece{e}{}{c}
\piece{a}{}{p} \piece{c}{}{p}
\piece{e}{}{p} \piece{g}{}{p}
\piece{i}{}{p} \piece{e}{}{k}
\piece{a}{}{R} \piece{i}{}{R}
\piece{a}{}{N} \piece{g}{}{N}
\piece{c}{}{B} \piece{g}{}{B}
\piece{d}{}{G} \piece{f}{}{G}
\piece{b}{}{C} \piece{h}{}{C}
\piece{a}{}{P} \piece{c}{}{P}
\piece{g}{}{P}
\piece{i}{}{P} \piece{e}{}{K}
\end{position}
\end{document}

注意一下编译的顺序: latex--- >dvips--- >ps2pdf

效果图:

LaTeX技巧009:中国象棋的LaTeX排版-LMLPHP

一定要按这个步骤来编译, 不然得到的效果不好.

如果你的latex还没有chess宏包, (点击这 里).

或到:

http://www.ctan.org/tex-archive/macros/latex/contrib/cchess/

下载即可。

选自:http://quantumfield.spaces.live.com/blog/cns!f433639184bc15ec!322.entry

另外,还有xq.sty宏包,关于LaTeX排版象棋的详细讨论还可以查看CTeX论坛

05-11 15:36